> 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

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)

```
1. accounts = GET /users/me/accounts
   For Facebook or LinkedIn: also GET /users/me/accounts/{accountId}/subaccounts
   Use subaccount id as target.pageId (REQUIRED for Facebook, optional for LinkedIn)
   For YouTube: also GET /users/me/accounts/{accountId}/subaccounts to get playlist IDs
   Use subaccount ids as target.playlistIds (optional, array)
   For Pinterest: also GET /social/pinterest/boards?accountId={accountId}
   Use board id as target.boardId (REQUIRED for Pinterest)
2. Create a source if needed. Save response.id from POST /source-resolutions-v3.
3. Poll GET /source-resolutions-v3/{id} at least 10 seconds apart.
   Stop on "completed" or "failed".
4. Select a template from GET /videos/templates. Keep its exact id.
   POST /videos/from-templates { templateId, inputs: {}, prompt, render: true }
   Save response.item.id.
5. Poll GET /videos/creations/{id} at least 15 seconds apart.
   Inspect item.error first. Stop on error, failure, insufficient credits, or draft.
   Use item.mediaUrl or item.imageUrls only when item.status is "done".
6. 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.
8. Report publicUrl only after publication. Preserve IDs if processing outlasts the session.
```

## 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
   There is no /accounts endpoint. Always use the full path /users/me/accounts.
```

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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
