Skip to content
Connect an agent

Templates

Schedule a post from a template

Creates a post from the template, to its accounts or the ones given, filling {{variables}}.

POST/v1/templates/{id}/deploy

TL;DR

QuestionAnswer
What does it do?Schedule a post from a template.
What does it need?An API key or an OAuth access token.
What does it take?A JSON body with the fields below, and id in the path.
What does it return?Status 201 with a body of type Post.
In the SDK?flung.templates.deploy()
As an MCP tool?deploy_template
What can go wrong?401 Missing, unknown, revoked or expired API key; 404 No such template in this workspace; 422 The request failed validation; 429 Too many requests for this credential; wait for retry-after seconds. Every failure has the same error shape.

What it does

Creates a post from the template, to its accounts or the ones given, filling {{variables}}. The same checks as POST /v1/posts apply.

Example

bash
curl -X POST 'https://api.flung.dev/v1/templates/tpl_aaaaaaaaaaaaaaaaaaaaaaaa/deploy' \  --header "Authorization: Bearer $FLUNG_API_KEY" \  --header 'Content-Type: application/json' \  --header "Idempotency-Key: $(uuidgen)" \  --data '{}'

A successful answer looks like this:

json
{  "id": "post_aaaaaaaaaaaaaaaaaaaaaaaa",  "status": "scheduled",  "content": "string",  "mediaIds": [    "string"  ],  "platformOverrides": {},  "publishAt": "2026-11-01T09:00:00.000Z",  "createdAt": "2026-11-01T09:00:00.000Z",  "updatedAt": "2026-11-01T09:00:00.000Z",  "targets": [    {      "id": "string",      "accountId": "string",      "platform": "x",      "status": "pending",      "platformPostId": "string",      "url": "string",      "error": {},      "publishedAt": "2026-11-01T09:00:00.000Z"    }  ]}

Path parameters

FieldTypeRequiredDescription
idstringyes

Request body

The body has the type an object, with the fields below.

FieldTypeRequiredDescription
accountIdsstring[]noOverrides the template's accounts.
publishAtstringno
variablesobjectno

Responses

StatusMeaningBody
201The post.Post
401Missing, unknown, revoked or expired API key.Error
404No such template in this workspace.Error
422The request failed validation.Error
429Too many requests for this credential; wait for retry-after seconds.Error

Response body

A 201 answer has the type Post.

FieldTypeRequiredDescription
idstringyes
status"scheduled" | "publishing" | "published" | "partially_published" | "failed" | "cancelled"yes
contentstringyes
mediaIdsstring[]yes
platformOverridesobjectyes
platformOverrides.xobjectno
platformOverrides.x.contentstringno
platformOverrides.instagramobjectno
platformOverrides.instagram.contentstringno
platformOverrides.facebookobjectno
platformOverrides.facebook.contentstringno
platformOverrides.threadsobjectno
platformOverrides.threads.contentstringno
platformOverrides.linkedinobjectno
platformOverrides.linkedin.contentstringno
platformOverrides.tiktokobjectno
platformOverrides.tiktok.contentstringno
platformOverrides.youtubeobjectno
platformOverrides.youtube.contentstringno
platformOverrides.pinterestobjectno
platformOverrides.pinterest.contentstringno
platformOverrides.blueskyobjectno
platformOverrides.bluesky.contentstringno
platformOverrides.mastodonobjectno
platformOverrides.mastodon.contentstringno
platformOverrides.discordobjectno
platformOverrides.discord.contentstringno
platformOverrides.farcasterobjectno
platformOverrides.farcaster.contentstringno
publishAtstringyes
createdAtstringyes
updatedAtstringyes
targetsPostTarget[]yes
targets[].idstringyes
targets[].accountIdstringyes
targets[].platformPlatformyes
targets[].status"pending" | "publishing" | "published" | "failed" | "cancelled"yes
targets[].platformPostIdstring | nullyes
targets[].urlstring | nullyes
targets[].errorobject | nullyes
targets[].error.codestringyes
targets[].error.messagestringyes
targets[].publishedAtstring | nullyes

See also

DocWhy
API referenceEvery endpoint
SchemasEvery request and response type
ErrorsEvery error code and what to do about it
deploy_templateThe same operation as an MCP tool