error or a code, branch on that. message is written for people: you can show it to your user as it is.
Status codes
Error shapes
A message only
Most errors are amessage and nothing else:
403
500s say only "Server Error", never the details of what broke. Uploads have their own words: see Uploads.
Not found
Anything missing under/api/v1 answers 404 with exactly this body:
404
GET /posts/by-url/… or GET /posts/by-platform-post-id/… with no match, and a path that doesn’t exist. The answer is the same for “doesn’t exist” and “not yours”, so it never shows what’s in other workspaces.
- An id in the request body (
workspace_id,account_ids,media,parent_id, thepost_idof a comment) answers422on that field instead. See Validation. POST /media/download/urlanswers404with its own words and"code": "post_unavailable"when the social post is private, was removed, or doesn’t exist. See Answers with a code.
DELETE /posts/{id}, DELETE /accounts/{id}, DELETE /labels/{id} and DELETE /campaigns/{id} used to answer 422 with Invalid … ID. for an id the key can’t reach. They answer 404 now, like every other path.Validation
A field that’s missing or wrong answers422 with errors: one entry for each field, each with a list of messages. A field inside a list has a dotted name, such as accounts.0.id or urls.0.
422
GET /comments?per_page=500. message is the first error and, when there are more, says how many: (and 1 more error), (and 2 more errors). To show each problem next to its field, read errors.
Some 422s are about the item, not a field, and have only a message. For example, deleting a folder that isn’t empty:
422
Answers with an error code
These answers carryerror, a code that stays the same while the words around it may change. Branch on error, not on message.
The
ai_unavailable, ai_declined and ai_answer_too_long messages end by saying what happened to the credits: You weren't charged., or how many came back.
409
content_version out and an update always goes through, over any change made since. Update a post has the details.
Plan limit reached
Aplan_limit_reached answer has these fields:
Here, a key reaches a client’s workspace whose owner is on Free and has connected 2 accounts:
403
limit covers.
Answers with a code
A few routes usecode instead of error:
Get download links has every value.
Uploads
POST /media/upload/file and POST /media/upload/url answer:
The MCP server
MCP tools give the samemessage as the API, as a tool error (isError: true) instead of an HTTP status. There are a few differences:
- Validation errors come as one text with every message.
- Something missing says
Post not found or you do not have access.(with the thing’s name), orResource not found or you do not have access. - A plan limit states the limit and links the pricing page. It has no price and no
upgrade_url. A key withbilling:create, used by the workspace owner, gets a line offering a pay link withcreate-billing-linkin place of the pricing link. - The rate limit of 60 a minute is still an HTTP
429, not a tool error. See Rate limits. The limits on pay links, blog addresses read and invitations are tool errors with theirmessage.
OAuth delegation
OAuth delegation has its own errors. Starting a session (POST https://postsyncer.com/api/oauth/delegate/sessions) answers with success, code and message:
403
A missing or wrong
platform, callback_url or state answers the usual validation 422 instead: message and errors, with no success or code.
After the person signs in, an error comes back to your callback_url as the query parameters error, error_description and state. error is one of expired_request, invalid_state, provider_mismatch, unsupported_platform, redirect_failed, missing_platform_id, connection_failed, or the network’s own code, such as access_denied. Treat any callback with error as not connected, and start a new session.
Agent sign-up
POST /agent-signup/code and POST /agent-signup/verify answer with error and a plain message to pass on to the person. A wrong code also has tries_left.
422
A missing or wrong field answers the usual validation
422. Sign up from an AI agent has the limits.
Send it again
429: the request wasn’t run. WaitRetry-Afterseconds, then send it again as it is.503: nothing was done. WaitRetry-Afterseconds when the answer has it, or a minute when it doesn’t, then send it again as it is.409post_changed_elsewhere: read the post again first.500, or no answer at all: a read is safe to send again. A write may or may not have happened. ForPOST /posts, send anIdempotency-Keyheader: the same request with the same key returns the post it already made (200withIdempotency-Replayed: true) instead of making a second one. Without a key, list the posts (GET /posts) and check whether it’s there before you send it again.- Any other
4xx: the same request gets the same answer. Change it first.
Related
Rate limits
60 requests a minute, and how to wait out a
429.Plan limits
What Free includes, and what’s on paid plans.