API
Publishing
One post goes to one or more targets (accounts). Each target can override the text, media, time and options for its platform.
Endpoints
POST /v1/posts create: publish now, schedule, queue or draft
GET /v1/posts list
GET /v1/posts/{post_id} one post with its targets
PATCH /v1/posts/{post_id} edit (see below for live posts)
DELETE /v1/posts/{post_id} delete
POST /v1/posts/{post_id}/publish publish a draft or scheduled post now
POST /v1/posts/{post_id}/retry retry the failed targets
POST /v1/posts/{post_id}/unpublish remove it from the platforms
POST /v1/posts/validate dry run: the same checks, nothing created, no credit spent
GET /v1/posts/validate text and media rules per platform (?platform=tiktok)
POST /v1/posts/import create posts from a CSV fileYour first post
curl https://api.zaynstack.com/v1/posts \
-H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
-d '{
"text": "New menu is live",
"media": [{ "type": "image", "source_type": "url", "source": "https://example.com/menu.jpg" }],
"platform_data": { "tiktok": { "privacy_level": "PUBLIC_TO_EVERYONE" } },
"targets": [
{ "account_id": "<instagram account>" },
{ "account_id": "<tiktok account>" },
{ "account_id": "<pinterest account>", "board_id": "<board id>" }
],
"scheduled_at": "2026-12-01T09:00:00Z"
}'What the request does depends on one field: publish_now: true sends at once, scheduled_at schedules, queue_id takes the next free slot of a queue, and none of them saves a draft. stagger (min_seconds, max_seconds) spreads the targets over time.
Fields every platform shares
| Field | What it does |
|---|---|
text | The post text (the caption, description or message, depending on the platform). |
title | Title on platforms that have one: YouTube (required), Pinterest, Zalo, LinkedIn documents. |
media | Items of { type, source_type, source }. type is image, video or document; source_type is url or media_id. |
targets | Up to 100. Each needs account_id and may set page_id, board_id (Pinterest), text, title, media, first_comment, visibility, scheduled_at and platform_data. |
platform_data | Options per platform, keyed by platform name. See below. |
segments | Follow-up posts of an X thread: [{ text }]. |
first_comment | A comment added right after publishing, where the platform allows it. |
visibility | public, private, connections_only or logged_in, where the platform has the idea. |
skip_validation | Skip the platform rule check. The platform may still refuse. |
skip_duplicate_check | Allow the same text to the same account within 24 hours (otherwise 409 resource.conflict). |
Where platform options go
On the post, platform_data is keyed by platform name: { "youtube": { "privacy": "unlisted" } }. On a target, platform_data is flat, without the platform key, and wins over the post's. twitter or x, and google or google_business, are both accepted.
Every platform's options, with types and limits, are on its page:
- Instagram options
- Facebook options
- Threads options
- TikTok options
- YouTube options
- X (Twitter) options
- Bluesky options
- LinkedIn options
- Telegram options
- WhatsApp options
- Google Business options
- Zalo options
- Pinterest options
- App Store Connect options
Required per platform
| Platform | Required | Missing answers |
|---|---|---|
| TikTok | platform_data.tiktok.privacy_level | validation.privacy_level_required (no default; drafts excepted) |
| YouTube | title | validation.field_required, meta.field title (never taken from the text) |
targets[].board_id | validation.board_id_required | |
platform_data.whatsapp.to | a validation error naming the recipients | |
| Instagram, TikTok, YouTube, Pinterest | An image or video | publishing.validation_failed |
| App Store Connect | Cannot be a target | 422 account.platform_unsupported |
Validation
Posts are checked against each target's platform before they are saved. A broken rule answers 400 with the first problem's code (or publishing.validation_failed) and every problem in meta.issues. Drafts and skip_validation skip the check.
{
"error": {
"code": "validation.privacy_level_required",
"message": "TikTok: Choose who can see the TikTok post: privacy_level is required …",
"meta": { "issues": [{ "platform": "tiktok", "field": "privacy_level", "code": "validation.privacy_level_required", "target": "<account id>", "type": "error", "message": "…" }] }
},
"request_id": "5e0b9c12"
}Validation codes you can meet: validation.privacy_level_required, validation.invalid_privacy_level, validation.branded_content_private, validation.post_mode and validation.posting_limit (TikTok); validation.field_required (YouTube title); validation.board_id_required, validation.duplicate_board_id, validation.use_board_id and validation.use_page_id (Pinterest boards); validation.media_type and validation.field_invalid. All codes: Errors.
GET /v1/posts/validate returns each platform's rules: text length and counting, hashtags and mentions, text.photo_max_length, media counts, sizes and types, media.max_video_fps, media.supported_document_types, max_document_size_bytes and max_document_pages.
Media
- By URL:
{ "type": "image", "source_type": "url", "source": "https://…" }. The URL must stay public until the post is sent. A URL that answers 401, 404 or 410 is refused with422 publishing.media.url_unreachable(meta.fieldnames the item). - From the library: upload first, then use
source_type: "media_id".GET /v1/media/upload-urlreturns anupload_urlthat expires after 15 minutes (expires_at); PUT the bytes, thenPOST /v1/media/{media_id}/verify.POST /v1/media/uploadtakes the file in one request. - Drafts and
skip_validationaccept library files that are not verified yet; they are read again when the post is sent. - Types: JPEG, PNG, WebP and GIF images; MP4, MOV and WebM videos; PDF, PPT(X) and DOC(X) documents.
- Documents publish on LinkedIn only, as the only media item, up to 100 MB and 300 pages, and not on a link post. Every other platform refuses them.
- Answers list the media of the post and of each target, with
media_ids(the library ids) at both levels.
Platform media limits differ (Bluesky images 2 MB, Instagram Story videos 60 seconds, Pinterest videos 100 MB…): see each platform page.
Statuses
| Status | Meaning |
|---|---|
draft | Saved, not scheduled. |
scheduled | Waiting for its time. A scheduled post stays scheduled while its targets are being sent; watch the targets or the events. |
publishing | Sending now. Only for publish_now, POST /publish and POST /retry. |
published | Live on every target. |
partial | Live on some targets, failed on others. |
failed | Failed on every target. |
cancelled | No target was sent. |
Each target has its own status: pending, publishing, published or failed, with platform_post_id, permalink and published_at once live, or error (code, message, category, caused_by) when it failed. Some platforms (TikTok, video uploads) finish after the call returns: the target stays publishing until the platform reports it live or failed, for up to 2 hours.
Retries and timeouts
- A target is retried automatically only when the platform answered 429 or 503, which means it did not take the post. It gets up to 3 attempts, after 2 and then 10 minutes, or the platform's own wait if longer.
- Any other failure is final after one attempt, so a post is never published twice. Retry it with
POST /v1/posts/{post_id}/retryafter checking the platform. - One send that takes more than 15 minutes fails with
publishing.delivery.timeout. A target that has no final answer an hour after sending started fails withsystem.internal. In both cases the post may be live: check before you retry. - A target at its posting cap waits for the window to clear; see Rate limits.
- An account whose token died fails its targets and must be reconnected; creating a post for it answers
403 account.reconnection_required.
Edit a post
Draft, scheduled and failed posts can change anything with PATCH /v1/posts/{post_id}. A post that has started publishing answers 409 post.state_invalid.
A published or partial post can change only text, and platform_data.google.callToAction ({ "actionType": "BOOK" | "ORDER" | "SHOP" | "LEARN_MORE" | "SIGN_UP" | "CALL", "url" }). Any other field answers 400 validation.field_not_editable.
- Text is edited in place on Facebook (text and photo posts), Google Business and YouTube (the description).
- Targets that cannot take the change keep what is live and are listed in
not_updated_account_ids, for example Facebook videos, Reels and Stories, and platforms with no edit (Instagram, Threads, X, TikTok…). - If no target can take the change, the answer is
409 post.state_invalid.
Import from CSV
POST /v1/posts/import creates posts from a CSV file. Send the file (up to 5 MB) as multipart form data; a Content-Length header is not required.
Events
post.scheduled, post.published, post.partial, post.failed, post.updated (also after a live edit), post.deleted, post.unpublished and post.retried. See Webhook events.