Pages in API reference

Posts

New to publishing with Ampost? Read the Publishing API overview. Posts that need a person's approval first: approval mode.

A post is one piece of content for one or more platforms. The top-level text, linkUrl and media apply to every platform; options.<platform> changes them for one platform. Without scheduledFor a new post is a draft. Set publishNow to publish it in the same call, or call the publish endpoint later.

  • Media: each item in media is a public https URL with a required type (image or video) and optional metadata such as width, height, durationSeconds and altText. URLs that use http, carry credentials, or point at localhost, private, link-local or internal hosts fail with VALIDATION_FAILED. If Ampost cannot download a URL (also after up to 3 redirects, each checked the same way), the error is MEDIA_FETCH_FAILED. To upload files instead, see Media upload.
  • Alt text: media[].altText goes to X, Bluesky (images and video), LinkedIn, Instagram (feed and carousel images), Threads, Facebook (feed photos), Pinterest (the first item's, as the Pin's alt text) and Discord. altText in GET /api/platforms gives each platform's maxLength; longer alt text fails with CONTENT_TOO_LONG. Where a platform takes none (TikTok, Telegram, YouTube, a video on X, a story or reel), it is not sent and the platform post lists a warning.
  • Media conversion: before publishing, Ampost fits each image and video to the target platform's rules (media.conversion in GET /api/platforms). Media within these rules is sent as it is; anything else is converted to fit them, video to H.264/AAC MP4 and images to JPEG, PNG or WebP, whichever the platform takes. Media outside a platform's aspect ratio (Instagram feed 4:5 to 1.91:1; Reels, Stories and TikTok 9:16) is fitted by mediaFit: pad (default), crop or none. What changed is in platformPosts[].mediaTransforms; the original stays in media. A video conversion runs in the background, so the account waits as pending for a minute or a few. Ampost never trims a video: one too long or too short for the platform fails with VALIDATION_FAILED, and media that cannot be converted fails with MEDIA_TRANSFORM_FAILED.
  • Options: every platform accepts text; Instagram and Facebook add placement, LinkedIn and TikTok add their own settings. Unknown keys are rejected. The full schema per platform is in GET /api/platforms.
  • Targets: targets lists platform sets, each with its platforms; each platform goes to the set's account for it. Omit platformSetId to use your default set. A set holds one account per platform, so to post to several accounts of the same platform, list each account's set in one post. options.<platform> applies to every account of that platform.
  • Results: platformPosts has one entry per account with its platform, set, status, published URL, error and notice. A post whose accounts partly failed is partial; retry the failed ones, or pass accountIds to retry only some.
  • Automatic retries: when a platform rate-limits a publish, times out or has a server error (error.retryable true), Ampost tries again by itself, up to 5 attempts, waiting longer each time (up to 1, 2, 4 and 8 minutes, with jitter) or until the platform's own reset time when it sends one. While it waits the account stays pending with the last error, attempts and nextAttemptAt, and the post is posting. Only after the last attempt does the account turn failed and the post.failed or post.partial webhook fire. Errors that will not pass on their own (expired auth, invalid media) fail at once.
  • No duplicates: when a publish times out after the platform got it, Ampost first looks for the post on the account and publishes again only if it is not there. Where the platform has no way to look (Facebook stories and reels, LinkedIn, TikTok, X, Telegram and Discord), the account fails with PUBLISH_OUTCOME_UNKNOWN: check the account, and retry only if the post is missing.
  • Platform rate limits: Ampost spreads publishes per account and per platform app so that a burst of posts due at once stays inside each platform's limits (for example Instagram's 100 posts a day, TikTok's uploads per day, LinkedIn's daily caps and X's posting window). A post held back this way waits with nextAttemptAt and is never marked failed for it; its account stays pending.
  • Status: ampost.io/status shows whether publishing works on each platform right now, from real publish outcomes, and explains these guarantees.
  • First comment: firstComment is posted on each new post right after it publishes: a comment on Instagram, Facebook, LinkedIn and YouTube, a reply on X, Threads and Bluesky. TikTok, Telegram, Discord and Pinterest take none. Set it per platform with options.<platform>.firstComment ("" turns it off there). Each account's result is in platformPosts[].firstComment; a failed comment leaves the post published, and retrying that account posts only the comment again.
  • Threads (multi-post chains): thread lists follow-up posts that publish right after the post on X, Bluesky and Threads, in order, each a reply to the one before (up to 25 items; each item has text, media with alt text, or both, checked like a post). Set it per platform with options.<platform>.thread ([] turns it off there); it replaces the top-level thread on that platform, so list every item. A top-level thread must suit every platform of the post: one that also goes to Instagram, say, sets the thread in options.twitter.thread (and the other thread platforms) instead. A thread and a first comment cannot go to the same platform: add the comment as the last item. Each account's items are in platformPosts[].thread. A failed item stops the chain and fails the account (the post and earlier items stay up); retrying the account continues from that item without posting anything twice. Unpublish deletes the whole chain, last item first.
  • Unpublish: the unpublish endpoint deletes a published post from the platforms. Each account it left turns deleted; one the platform refused stays published with a notice (its error stays null). Instagram and TikTok have no delete API (UNPUBLISH_NOT_SUPPORTED), and Telegram bots cannot delete messages older than 48 hours.
  • Edit published text: the edit-published endpoint replaces the text of a published post on Facebook, LinkedIn, Telegram, Discord, YouTube and Pinterest (the video or Pin description); media and links stay. Each edited account keeps the new text in platformPosts[].text; one the platform refused keeps its text, with a notice. Instagram, Threads, TikTok, Bluesky and X answer EDIT_NOT_SUPPORTED. Drafts and scheduled posts change with the update endpoint instead.
  • CSV import: POST /api/posts/bulk creates one post per CSV row, with the same checks as POST /api/posts. Send dryRun first: every row is checked and nothing is created. The response lists each row's result and errors (with the column); a bad row never stops the others. Send an Idempotency-Key with the import so a retry creates nothing twice. The CSV export of the dashboard uses the same columns, so an exported file imports again.
  • Source: source is where the post was created: api, mcp or dashboard. Ampost sets it from the request; posts created before it was recorded have null.

The same Facebook post on two Pages, in two platform sets:

POST /api/posts
{
  "targets": [
    {
      "platformSetId": "0b6e4d2a-9c3f-4e1b-8a7d-5f2c1e9b3d40",
      "platforms": [
        "facebook"
      ]
    },
    {
      "platformSetId": "9a4f2c7e-1d3b-4a6e-8c5f-2b7d9e1a3c50",
      "platforms": [
        "facebook"
      ]
    }
  ],
  "text": "We are hiring two engineers. Apply by Friday.",
  "linkUrl": "https://example.com/jobs",
  "publishNow": true
}
Response: one result per account
{
  "id": "7f1c2a9e-4b1d-4c55-9a0e-2f6d8b3c1a10",
  "status": "published",
  "targets": [
    {
      "platformSetId": "0b6e4d2a-9c3f-4e1b-8a7d-5f2c1e9b3d40",
      "platforms": [
        "facebook"
      ]
    },
    {
      "platformSetId": "9a4f2c7e-1d3b-4a6e-8c5f-2b7d9e1a3c50",
      "platforms": [
        "facebook"
      ]
    }
  ],
  "platforms": [
    "facebook"
  ],
  "text": "We are hiring two engineers. Apply by Friday.",
  "firstComment": null,
  "linkUrl": "https://example.com/jobs",
  "media": [],
  "mediaFit": "pad",
  "thread": [],
  "options": {},
  "scheduledFor": null,
  "queuePlatformSetId": null,
  "source": "api",
  "createdBy": "4e8b2d6f-1a3c-4f7e-9d5b-8c2a6e1f3b90",
  "metadata": null,
  "platformPosts": [
    {
      "platform": "facebook",
      "accountId": "8d3b6f1a-2c9e-4a7d-b5f3-1e6a9c2d7b30",
      "platformSetId": "0b6e4d2a-9c3f-4e1b-8a7d-5f2c1e9b3d40",
      "status": "published",
      "platformPostId": "108234567890123_901234567890126",
      "publishedUrl": "https://www.facebook.com/108234567890123/posts/901234567890126",
      "text": null,
      "error": null,
      "notice": null,
      "warnings": [],
      "attempts": 1,
      "nextAttemptAt": null,
      "firstComment": null,
      "mediaTransforms": null,
      "thread": null,
      "createdAt": "2026-10-06T09:00:00.000Z",
      "updatedAt": "2026-10-06T09:00:04.000Z"
    },
    {
      "platform": "facebook",
      "accountId": "2f8c4a6e-9b1d-4e3a-a7c5-6d2f8b4e1a90",
      "platformSetId": "9a4f2c7e-1d3b-4a6e-8c5f-2b7d9e1a3c50",
      "status": "published",
      "platformPostId": "108234567890123_901234567890127",
      "publishedUrl": "https://www.facebook.com/108234567890123/posts/901234567890127",
      "text": null,
      "error": null,
      "notice": null,
      "warnings": [],
      "attempts": 1,
      "nextAttemptAt": null,
      "firstComment": null,
      "mediaTransforms": null,
      "thread": null,
      "createdAt": "2026-10-06T09:00:00.000Z",
      "updatedAt": "2026-10-06T09:00:04.000Z"
    }
  ],
  "createdAt": "2026-10-06T09:00:00.000Z",
  "updatedAt": "2026-10-06T09:00:04.000Z"
}

A post that fails on one platform keeps the error there:

Post with a failed platform
{
  "id": "7f1c2a9e-4b1d-4c55-9a0e-2f6d8b3c1a10",
  "status": "failed",
  "targets": [
    {
      "platformSetId": "0b6e4d2a-9c3f-4e1b-8a7d-5f2c1e9b3d40",
      "platforms": [
        "youtube"
      ]
    }
  ],
  "platforms": [
    "youtube"
  ],
  "text": "Behind the scenes #buildinpublic",
  "firstComment": null,
  "linkUrl": null,
  "media": [
    {
      "url": "https://cdn.example.com/launch.mp4",
      "type": "video",
      "mimeType": "video/mp4",
      "sizeBytes": 18200000,
      "width": 1080,
      "height": 1920,
      "durationSeconds": 21,
      "altText": null,
      "thumbnailUrl": null
    }
  ],
  "mediaFit": "pad",
  "thread": [],
  "options": {},
  "scheduledFor": null,
  "queuePlatformSetId": null,
  "source": "mcp",
  "createdBy": "4e8b2d6f-1a3c-4f7e-9d5b-8c2a6e1f3b90",
  "metadata": null,
  "platformPosts": [
    {
      "platform": "youtube",
      "accountId": "8d3b6f1e-2c4a-4e7b-9f5d-1a6c8e3b2d70",
      "platformSetId": "0b6e4d2a-9c3f-4e1b-8a7d-5f2c1e9b3d40",
      "status": "failed",
      "platformPostId": null,
      "publishedUrl": null,
      "text": null,
      "error": {
        "code": "VIDEO_PROCESSING_FAILED",
        "message": "YouTube could not process the video",
        "retryable": false,
        "platformCode": null,
        "platformSubcode": null
      },
      "notice": null,
      "warnings": [],
      "attempts": 1,
      "nextAttemptAt": null,
      "firstComment": null,
      "mediaTransforms": null,
      "thread": null,
      "createdAt": "2026-10-06T09:00:00.000Z",
      "updatedAt": "2026-10-06T09:00:04.000Z"
    }
  ],
  "createdAt": "2026-10-06T09:00:00.000Z",
  "updatedAt": "2026-10-06T09:00:04.000Z"
}

A post waiting for an automatic retry after a rate limit:

Post waiting for a retry
{
  "id": "7f1c2a9e-4b1d-4c55-9a0e-2f6d8b3c1a10",
  "status": "posting",
  "targets": [
    {
      "platformSetId": "0b6e4d2a-9c3f-4e1b-8a7d-5f2c1e9b3d40",
      "platforms": [
        "instagram"
      ]
    }
  ],
  "platforms": [
    "instagram"
  ],
  "text": "New drop at 9am",
  "firstComment": null,
  "linkUrl": null,
  "media": [
    {
      "url": "https://cdn.example.com/launch.mp4",
      "type": "video",
      "mimeType": "video/mp4",
      "sizeBytes": 18200000,
      "width": 1080,
      "height": 1920,
      "durationSeconds": 21,
      "altText": null,
      "thumbnailUrl": null
    }
  ],
  "mediaFit": "pad",
  "thread": [],
  "options": {},
  "scheduledFor": "2026-10-06T09:00:00.000Z",
  "queuePlatformSetId": null,
  "source": "api",
  "createdBy": "4e8b2d6f-1a3c-4f7e-9d5b-8c2a6e1f3b90",
  "metadata": null,
  "platformPosts": [
    {
      "platform": "instagram",
      "accountId": "c41d8e2f-6a3b-4f9c-b1e5-7d2a9c4e6f80",
      "platformSetId": "0b6e4d2a-9c3f-4e1b-8a7d-5f2c1e9b3d40",
      "status": "pending",
      "platformPostId": null,
      "publishedUrl": null,
      "text": null,
      "error": {
        "code": "RATE_LIMITED",
        "message": "Instagram rate limit reached: Application request limit reached",
        "retryable": true,
        "platformCode": 4,
        "platformSubcode": null
      },
      "notice": null,
      "warnings": [],
      "attempts": 2,
      "nextAttemptAt": "2026-10-06T09:02:04.000Z",
      "firstComment": null,
      "mediaTransforms": null,
      "thread": null,
      "createdAt": "2026-10-06T09:00:00.000Z",
      "updatedAt": "2026-10-06T09:00:04.000Z"
    }
  ],
  "createdAt": "2026-10-06T09:00:00.000Z",
  "updatedAt": "2026-10-06T09:00:04.000Z"
}

A thread on X, Bluesky and Threads. options.bluesky.thread replaces the whole thread on Bluesky, so it repeats the first two items and gives a shorter last one:

POST /api/posts
{
  "targets": [
    {
      "platformSetId": "0b6e4d2a-9c3f-4e1b-8a7d-5f2c1e9b3d40",
      "platforms": [
        "twitter",
        "bluesky",
        "threads"
      ]
    }
  ],
  "text": "We rebuilt our publishing engine. A thread on what changed 🧵",
  "thread": [
    {
      "text": "1/ Every post now goes out through one queue per account.",
      "media": [
        {
          "url": "https://cdn.example.com/queue.png",
          "type": "image",
          "altText": "Diagram of the per-account queue"
        }
      ]
    },
    {
      "text": "2/ A failed publish retries by itself, with backoff."
    },
    {
      "text": "3/ Docs: https://ampost.io/docs"
    }
  ],
  "options": {
    "bluesky": {
      "thread": [
        {
          "text": "1/ Every post now goes out through one queue per account.",
          "media": [
            {
              "url": "https://cdn.example.com/queue.png",
              "type": "image",
              "altText": "Diagram of the per-account queue"
            }
          ]
        },
        {
          "text": "2/ A failed publish retries by itself, with backoff."
        },
        {
          "text": "3/ Docs: ampost.io/docs"
        }
      ]
    }
  },
  "publishNow": true
}

A thread that stopped at its third item; retrying the account continues from there:

Post with a stopped thread
{
  "id": "7f1c2a9e-4b1d-4c55-9a0e-2f6d8b3c1a10",
  "status": "failed",
  "targets": [
    {
      "platformSetId": "0b6e4d2a-9c3f-4e1b-8a7d-5f2c1e9b3d40",
      "platforms": [
        "twitter"
      ]
    }
  ],
  "platforms": [
    "twitter"
  ],
  "text": "We rebuilt our publishing engine. A thread on what changed 🧵",
  "firstComment": null,
  "linkUrl": null,
  "media": [],
  "mediaFit": "pad",
  "thread": [
    {
      "text": "1/ Every post now goes out through one queue per account.",
      "media": [
        {
          "url": "https://cdn.example.com/queue.png",
          "type": "image",
          "mimeType": "image/png",
          "sizeBytes": null,
          "width": null,
          "height": null,
          "durationSeconds": null,
          "altText": "Diagram of the per-account queue",
          "thumbnailUrl": null
        }
      ]
    },
    {
      "text": "2/ A failed publish retries by itself, with backoff.",
      "media": []
    },
    {
      "text": "3/ Docs: https://ampost.io/docs",
      "media": []
    }
  ],
  "options": {},
  "scheduledFor": null,
  "queuePlatformSetId": null,
  "source": "api",
  "createdBy": "4e8b2d6f-1a3c-4f7e-9d5b-8c2a6e1f3b90",
  "metadata": null,
  "platformPosts": [
    {
      "platform": "twitter",
      "accountId": "9a4e2c7b-3d1f-4b8a-9c6e-5f2a8d1b7c40",
      "platformSetId": "0b6e4d2a-9c3f-4e1b-8a7d-5f2c1e9b3d40",
      "status": "failed",
      "platformPostId": "1843000000000000001",
      "publishedUrl": "https://x.com/ampost_io/status/1843000000000000001",
      "text": null,
      "error": {
        "code": "VALIDATION_FAILED",
        "message": "thread[2] failed: X rejected the post: duplicate content",
        "retryable": false,
        "platformCode": null,
        "platformSubcode": null
      },
      "notice": null,
      "warnings": [],
      "attempts": 1,
      "nextAttemptAt": null,
      "firstComment": null,
      "mediaTransforms": null,
      "thread": [
        {
          "status": "published",
          "platformPostId": "1843000000000000002",
          "publishedUrl": "https://x.com/ampost_io/status/1843000000000000002",
          "error": null,
          "updatedAt": "2026-10-06T09:00:04.000Z"
        },
        {
          "status": "published",
          "platformPostId": "1843000000000000003",
          "publishedUrl": "https://x.com/ampost_io/status/1843000000000000003",
          "error": null,
          "updatedAt": "2026-10-06T09:00:04.000Z"
        },
        {
          "status": "failed",
          "platformPostId": null,
          "publishedUrl": null,
          "error": {
            "code": "VALIDATION_FAILED",
            "message": "X rejected the post: duplicate content",
            "retryable": false,
            "platformCode": null,
            "platformSubcode": null
          },
          "updatedAt": "2026-10-06T09:00:04.000Z"
        }
      ],
      "createdAt": "2026-10-06T09:00:00.000Z",
      "updatedAt": "2026-10-06T09:00:04.000Z"
    }
  ],
  "createdAt": "2026-10-06T09:00:00.000Z",
  "updatedAt": "2026-10-06T09:00:04.000Z"
}

Endpoints