Pages in API reference
Accounts
Use the account endpoints to start a browser-assisted connection or discover connected publishing accounts before creating and debugging posts.
The list returns active accounts by default. Pass status=revoked for disconnected accounts or status=all for both; a platform set's accountCount is the default list's total for that set. Getting an account by id also returns revoked accounts. Reconnect an account with the hosted flow below and its accountId; it keeps its id.
DELETE /api/accounts/{accountId} disconnects an account: it deletes the stored tokens and asks the platform to revoke Ampost's access where it can: Facebook, LinkedIn, TikTok, X, YouTube and Discord (the channel webhook is deleted). providerRevoked says whether the platform confirmed it; when it is false, providerAccessSettings says where the user removes Ampost in the platform itself. Instagram and Threads have no revoke endpoint, so the user removes Ampost in Instagram: Settings, Website permissions, Apps and websites, or in Threads: Settings, Account, Website permissions. Pinterest revokes no user tokens: the user removes Ampost in Pinterest: Settings, Security and logins, Apps. Telegram and Bluesky run on the user's own bot and app password: the user removes the bot or deletes the app password. A second call returns the account unchanged. Deleting a platform set does the same for its accounts.
health says whether an account can publish and why not: canPost, needsReconnect and issues[] with a code such as ACCOUNT_REVOKED, TOKEN_EXPIRED or MISSING_SCOPE:w_member_social, a severity and a message. Ampost renews logins by itself (Instagram and Threads 30 days before they expire, refresh tokens on use), so an issue means only a reconnect helps. It shows up 7 days before the login lapses, together with the account.needs_reconnect webhook.
analytics says whether Ampost collects analytics for the account. X bills every read, so X analytics stay off until the user turns them on with PATCH /api/accounts/{accountId}/analytics (Max and Scale; reads count against the plan's X units). Other platforms need no opt-in; Discord has no analytics.
platformMetadata holds public details captured at connect time, a fixed list per platform: the Facebook Page id and name, the LinkedIn display name, locale and Company Page posting flag, the Instagram and Threads display name and the Instagram account type, the X and Bluesky display name, the Telegram chat title, type and bot, the Discord server and channel, the YouTube channel title and handle, the Pinterest default board, and for TikTok the creator's allowed privacy levels, disabled comment/duet/stitch flags and maximum video duration; use those to pick options.tiktok.
A Pinterest Pin needs a board. GET /api/accounts/{accountId}/boards lists the account's boards and its defaultBoardId; PATCH /api/accounts/{accountId}/board sets the default with boardId, or creates a board with newBoardName. A connect picks the board by itself only when the account has exactly one; until a default is set the account has the BOARD_NOT_SELECTED health warning and each post must set options.pinterest.boardId.
Browser-assisted hosted flow
Create a short-lived request, show its one-time connectUrl to the user, and ask them to open it in a browser. The hosted Ampost page handles confirmation, provider consent, and Facebook Page selection. Poll the status resource every 2–5 seconds until it becomes connected (its accountId is then the new account), failed, or expired. A request expires after ten minutes. A new request for the same platform and set replaces a pending one, also one the user opened but did not finish, which then fails with SUPERSEDED; a user who cancels or declines consent gives USER_CANCELLED.
The page tells the user that another Ampost account (yours, by email) asks to post as them, and lets them report the request. Free accounts can create 10 requests a day, and paid accounts 30 a day in their first 7 days; over that you get 429 RATE_LIMITED with retryAfterSeconds.
Pass accountId to reconnect an existing account: an active one gets fresh tokens and permissions, a revoked one is reactivated. For a new connection, expectedUsername or expectedPlatformAccountId pins the account. If the user signs in to another account, the request fails with ACCOUNT_MISMATCH and nothing changes. On Free, an account connected in another Ampost workspace (or disconnected from one less than 30 days ago) fails with SOCIAL_ACCOUNT_IN_USE.
Show the complete URL once, but never log, analyze, transform, or repeat its fragment after that handoff. Do not ask users to paste the fragment back, or ask for access tokens, OAuth codes, passwords, state values, or Facebook Page tokens. The create response is the only API response containing the URL; status responses contain only safe state and error information.
There are no separate profiles: to group accounts, for example per client, use platform sets. There is no headless connection either: the user always authorizes in a browser.
Embed account connection in your app
To bring the user back to your own app, pass redirectUrl and optionally state when you create the request, then send the user's browser to connectUrl (a link or a redirect; Ampost's pages cannot be framed). The confirmation page shows your host. When the connection ends, Ampost's result page says the user is leaving Ampost for your host and links to your URL; the user clicks to go back (no automatic redirect, so ampost.io never forwards a visitor to a site they did not see). This works for every platform: OAuth consent, the Telegram and Bluesky credential form, and Facebook Page selection.
{
"platform": "instagram",
"redirectUrl": "https://app.example.com/accounts/connected?x=1",
"state": "session-8f2c"
}Your query parameters stay, and Ampost adds:
https://app.example.com/accounts/connected?x=1&status=connected&connectRequestId=…&platform=instagram&accountId=…&state=session-8f2c
https://app.example.com/accounts/connected?x=1&status=failed&connectRequestId=…&platform=instagram&error=USER_CANCELLED&state=session-8f2cstatus:connected,failedorexpired.accountIdwhen connected;errorotherwise, the same code aserror.codeof the status resource (USER_CANCELLEDwhen the user cancels or declines consent).state: your value, unchanged. Use it to find the session, or as a CSRF check.
The redirect carries no tokens, and anyone can type these parameters into a URL, so confirm the outcome with GET /api/accounts/connect/{connectRequestId} before you act on it. Only the browser that went through the flow gets the link; a request that is still pending, or waiting for a Facebook Page choice, stays on Ampost's page, and so does a link that is already expired or used when opened.
redirectUrl must be an absolute https URL (http only for localhost), at most 2048 characters, without a user name or password. state is at most 512 characters and needs redirectUrl. Ampost stores both with the request and never takes a redirect from a callback URL.
Endpoints
- POSTConnect a social account
/api/accounts/connect - GETGet a connection request
/api/accounts/connect/:connectRequestId - GETList social accounts
/api/accounts - GETGet a connected account
/api/accounts/:accountId - DELETEDisconnect an account
/api/accounts/:accountId - PATCHTurn X analytics on or off
/api/accounts/:accountId/analytics