For the complete documentation index, see llms.txt. This page is also available as Markdown.

REST workflow examples

REST source, visual, and publication sequences with operation IDs, polling intervals, and completion checks.

Publishing, source extraction, and visual generation use the Submit → Poll → Result pattern. Read the completion rules for the exact operation. For task instructions using MCP, start with Agent workflows.

System Prompt for Agents

You can use the following snippet to instruct your AI agent on how to interact with Blotato:

Blotato API Protocol: All creation operations (posts, videos, sources) are async.

  1. Call the CREATE endpoint. Record the ID from the 201 response (id for sources, item.id for videos, postSubmissionId for posts). A scheduled post also returns scheduledTime, the resolved UTC publish time.

  2. Check the GET endpoint at least 10 seconds apart for posts and sources, and at least 15 seconds apart for visuals.

  3. Continue polling while status is processing (see status values below).

  4. Stop on a terminal result. Report success only for the operation's success state, not for a failure or draft.

  5. Set a waiting limit. Preserve the operation ID if processing remains unfinished. Do not submit a duplicate write because a poll failed or time elapsed.

Terminal Status Values by Operation:

  • Sources: completed (success) or failed

  • Videos: done (success), creation-from-template-failed, insufficient-credits, or any response with item.error. A draft is not a rendered result.

  • Posts: published (success), failed, or scheduled for a future publication. Stop immediate polling after a scheduled result.

All Video Status Values (in order): queueing -> generating-script -> script-ready -> generating-media -> media-ready -> exporting -> done

Always fetch accounts first: GET /v2/users/me/accounts to get accountId for publishing. To get pageId for Facebook/LinkedIn or playlistIds for YouTube, also fetch GET /v2/users/me/accounts/{accountId}/subaccounts.

For social platforms, set content.platform and target.targetType to the same value (e.g., both "twitter"). The REST webhook target uses other with webhook.

Content Calendar: GET /v2/schedules to list scheduled posts. PATCH /v2/schedules/:id to update content or time. DELETE /v2/schedules/:id to cancel. GET /v2/schedule/slots for recurring time slots.

Full reference: API reference for agents.


1. Create Source -> Get Source

Goal: Research a topic or extract content from a URL so Blotato can generate related visuals.

Endpoints:

  • Create: POST /v2/source-resolutions-v3

  • Poll: GET /v2/source-resolutions-v3/:id

Source Types:

  • youtube, tiktok, article, pdf, audio, twitter - Extract content from a URL (each type requires a url field)

  • text - Transform raw text content with optional AI instructions

  • perplexity-query - AI-powered web research on any topic (requires a text field)

Example Payloads

From YouTube URL:

From AI Research Query (use this for agents to research topics):

From Text with Custom Instructions:


2. Create Visual -> Get Visual

Goal: Generate a video or image from a template.

Endpoints:

  • Create: POST /v2/videos/from-templates

  • Poll: GET /v2/videos/creations/:id

  • Templates: GET /v2/videos/templates?fields=id,name,description,inputs

Discovering Templates

If you don't have a specific template ID, retrieve available templates:

Choose the template for the requested output. An image carousel, a narrated video, and a clip compilation use different templates and input structures. Inspect the selected template's inputs before generating.

Visual Generation Flow

Example Payload (with AI Prompt)

Example Payload (with Manual Inputs)

Replace the example image URLs with the user's accessible media URLs before submitting. These URLs illustrate the request structure, not content to publish.


3. Create Post -> Get Post

Goal: Publish content to a social platform.

Endpoints:

  • Create: POST /v2/posts

  • Poll: GET /v2/posts/:postSubmissionId

  • Account Lookup: GET /v2/users/me/accounts (docs)

  • Subaccounts (for pageId): GET /v2/users/me/accounts/:accountId/subaccounts (docs)

n8n / Make.com users: Check the operations in your installed integration. If it exposes Get Post, pass the original postSubmissionId. Otherwise, use an HTTP request to GET /v2/posts/{postSubmissionId} with your Blotato credential. Do not assume all integration versions expose the same operations.

[!IMPORTANT] Prerequisites:

  1. accountId: Get this from GET /v2/users/me/accounts. Always fetch the user's accounts before publishing. See Accounts reference.

  2. pageId: Required for Facebook Pages and LinkedIn company Pages. Omit it for a LinkedIn personal-profile post. Get it from GET /v2/users/me/accounts/{accountId}/subaccounts. See How to Get the Right IDs.

  3. mediaUrls: Use existing accessible media URLs, or mediaUrl and imageUrls from an authorized visual-generation request. No upload step required for these URLs. Do not generate new media for a request to publish an existing file. Text-only posts omit media when the selected platform supports them.

  4. content.platform and target.targetType: For social platforms, set both to the same value (e.g., both "twitter").

Step 0: Fetch Available Accounts (Always Do This First)

Response:

For a Facebook Page or LinkedIn company Page, fetch subaccounts and select the requested pageId. Omit pageId for a LinkedIn personal profile. For YouTube, fetch subaccounts only when playlist placement is requested:

See Accounts reference for full details.

Publish Flow

Example Payload

Get accountId from GET /v2/users/me/accounts. For social platforms, set content.platform and target.targetType to the same value.

To schedule instead of publishing immediately, add useNextFreeSlot or scheduledTime as a top-level field (sibling of post, not inside it). See Publish Post for details.


This is the standard content creation sequence: research topic → create visual → publish to social.

Pseudocode for Agents


4. Managing the Content Calendar

Goal: View, update, reschedule, or delete scheduled posts. Manage the recurring time slots that define your posting cadence.

How Slots and Schedules Work Together:

  1. Slots define recurring time windows (e.g., "Monday 9 AM for Twitter"). Create them with POST /v2/schedule/slots.

  2. When you publish with useNextFreeSlot: true, Blotato finds the next open slot matching the target platform and queues the post at that time.

  3. A slot is "occupied" when a scheduled post is already queued at that time. The next useNextFreeSlot call skips occupied slots.

  4. Schedules are the queued posts. Slots are the time windows. Manage them separately.

Endpoints:

  • Schedules: GET /v2/schedules, GET /v2/schedules/:id, PATCH /v2/schedules/:id, DELETE /v2/schedules/:id (docs)

  • Slots: GET /v2/schedule/slots, POST /v2/schedule/slots, PATCH /v2/schedule/slots/:id, DELETE /v2/schedules/slots/:id, POST /v2/schedule/slots/next-available (docs)

Schedule Response Shape

The draft field in a schedule is the same shape as the post object in Publish Post:

Note: The response uses scheduledAt for the publish time. The update endpoint accepts scheduledTime as the input field name.

Rescheduling to the Next Free Slot

The PATCH /v2/schedules/:id endpoint accepts scheduledTime but not useNextFreeSlot. To move a post to the next available slot:

Pseudocode for Calendar Management


Error Handling

All asynchronous operations can fail during processing. Handle failures gracefully:

Status Failure

When polling returns status: "failed", check the error message:

Source Failure (Get Source endpoint):

Video Failure (Get Visual Status endpoint):

Post Failure (Get Post Status endpoint):

Retry Strategy

  • Don't retry automatically on failure - most failures are permanent

  • Log the error message and report it to the user

  • Inform user that the operation failed and provide next steps

  • Retry failed reads after a delay. For a create request with an uncertain result, check existing work before resubmitting. For 429, wait and reduce request frequency. See Errors and retries.


Platform-Specific Setup

Different platforms require different fields and have different requirements. See detailed guides:

When publishing, always include the required fields for the target platform:

  • Facebook: target.pageId (required), target.mediaType -- required "reel" for videos (regular feed videos no longer supported), optional "story" for Stories, omit for text/image posts

  • LinkedIn: target.pageId (optional)

  • Pinterest: target.boardId (required)

  • YouTube: target.playlistIds (optional - array of playlist IDs from subaccounts)

  • TikTok: target.privacyLevel, target.disabledComments, etc. (required)

  • Instagram: target.mediaType (optional - default is "reel")

  • Twitter, Threads, Bluesky: Minimal required fields

Last updated