> For the complete documentation index, see [llms.txt](https://help.blotato.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.blotato.com/start-with-an-ai-agent/llm/workflow.md).

# Workflow and common mistakes

Choose only the requested REST operations, preserve asynchronous IDs, and verify results without duplicate writes.

Compact reference for agents making REST requests. All endpoint paths below are relative to `https://backend.blotato.com/v2`. For task instructions, read the [workflow guide](/api-and-mcp-concepts/async-jobs-and-polling.md). For tool calls, use the [MCP reference](/start-with-an-ai-agent/mcp/tools.md).

## Complete workflow (for ai agents)

Use only the stages needed for the user's request. A setup test ends after a read-only account lookup. A source extraction or visual request does not authorize publication. Reuse supplied media when suitable. Do not generate paid media to test a connection or to publish an existing file.

```
1. accounts = GET /users/me/accounts
   For publishing, match the platform and destination requested by the user.
   For a Facebook Page or LinkedIn company Page:
   GET /users/me/accounts/{accountId}/subaccounts and select target.pageId.
   For a LinkedIn personal profile: omit target.pageId.
   For YouTube playlist placement, fetch subaccounts and select target.playlistIds.
   Omit playlistIds when no playlist placement is requested.
   For Pinterest: also GET /social/pinterest/boards?accountId={accountId}
   Select target.boardId. Stop if the requested account or required destination is unresolved.
2. Optional source extraction: POST /source-resolutions-v3. Save response.id.
3. Only for a submitted source, poll GET /source-resolutions-v3/{id} at least 10 seconds apart.
   On "completed", use content and title. On "failed", report message and stop.
4. Optional, authorized visual generation: read GET /videos/templates.
   Select a template matching the requested output and keep its exact id.
   Read its inputs schema before supplying manual values.
   POST /videos/from-templates { templateId, inputs: {}, prompt, render: true }
   Use a nonempty prompt for AI-filled inputs. Save response.item.id.
5. Only for a submitted visual, poll GET /videos/creations/{id} at least 15 seconds apart.
   Inspect item.error first. Stop on error, failure, insufficient credits, or draft.
   On "done", verify the mediaUrl or imageUrls needed for the requested output exists.
   Stop here for a visual-only request. Do not create a post.
6. Only when publication or scheduling is authorized:
   POST /posts { post: { accountId, content, target } }
   Save response.postSubmissionId. For scheduling, scheduledTime and useNextFreeSlot
   go OUTSIDE "post". A returned scheduledTime confirms scheduling, not publication.
7. For immediate posts, poll GET /posts/{postSubmissionId} at least 10 seconds apart.
   Stop on "published" or "failed". On "scheduled", report the time and stop polling.
   On "failed", report errorMessage. Do not claim publication for "in-progress".
8. Report publicUrl only if returned after publication. The URL field is optional.
   Use bounded polling. Preserve IDs and pending state when the wait budget ends.
   Resume lookup of the saved ID. Do not repeat a write because polling timed out.
```

## Common mistakes

```
1. Scheduling fields nested inside "post":
   scheduledTime and useNextFreeSlot are ROOT-LEVEL fields, siblings of "post".
   WRONG: { "post": { ..., "scheduledTime": "2025-12-25T15:00:00Z" } }
   RIGHT: { "post": { ... }, "scheduledTime": "2025-12-25T15:00:00Z" }
   If nested inside "post", the post publishes immediately instead of scheduling.

2. Missing pageId for Facebook:
   Facebook REQUIRES target.pageId. You must call GET /users/me/accounts/{accountId}/subaccounts
   to get the pageId before publishing. Without it, the request fails.

3. content.platform and target.targetType mismatch:
   For social platforms these fields use the same value (e.g., both "twitter").
   The REST webhook target instead pairs content.platform="other" with targetType="webhook".

4. Altering the returned template ID:
   Copy the exact id from the template listing into templateId.
   Do not strip /base/v2/.../v1 paths to UUIDs or add paths to UUID-only IDs.

5. Guessing template input names:
   Set "inputs": {} with a prompt for AI-filled inputs, or read the selected
   template schema before supplying manual values.

6. Wrong accounts endpoint path:
   WRONG: GET /accounts or GET /v2/accounts
   RIGHT: GET /users/me/accounts
   Use /users/me/accounts for this API workflow.
```

Return to the [agent reference index](/start-with-an-ai-agent/llm.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.blotato.com/start-with-an-ai-agent/llm/workflow.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
