API rate limits and error codes
Rate limits
OmniSocials enforces a per-API-key rate limit of 100 requests per minute on every endpoint. Limits reset on a rolling 60 second window.
Every authenticated response includes these headers describing your current budget:
| Header | Meaning |
|---|---|
X-RateLimit-Limit | The ceiling for this key. Currently 100. |
X-RateLimit-Remaining | Requests left in the current window. |
X-RateLimit-Reset | Unix timestamp when the oldest request in the window leaves it, which frees a request. |
RateLimit-Policy | The same policy in the syntax of the IETF draft RateLimit header fields for HTTP (draft 12): "default";q=100;w=60, 100 requests (q) per 60 seconds (w). |
RateLimit | The current state in the same syntax, for example "default";a=42;w=17: a requests are left, and within the next w seconds you can make no more than that. |
The X-RateLimit-* headers stay as they are. The IETF draft is not an RFC yet, so the names of its parameters may still change; we follow the latest draft.
When the limit is exceeded, the API returns 429 Too Many Requests with a Retry-After header (seconds) and a retry_after value in the body. Back off for that long, then retry. On a 429, RateLimit shows a=0 and w equal to Retry-After.
JSON
Rate limits are enforced per key, not per workspace. Splitting heavy workloads across multiple keys is a valid scaling strategy.
HTTP status codes
| Status | Meaning |
|---|---|
200 | Success |
201 | Resource created |
204 | Success with no body (typically deletions) |
400 | Validation error. See error.details for the field(s) that failed. |
401 | Missing or invalid API key: unauthorized (no Authorization: Bearer header or no key in it) or invalid_api_key (the key is unknown, revoked or expired, or the person who created it left the workspace or no longer holds Manage API keys, see When a key stops working; create a new one at app.omnisocials.com/settings/api, Settings → API). The answer carries a WWW-Authenticate: Bearer header that points to the API metadata, with error="invalid_token" when a key was sent and refused. |
402 | Insufficient credits (e.g. x_credits_insufficient on an X link post; error.details carries credits_required, credits_balance, and credits_reserved), or insufficient_credits on Update now of an X post |
403 | Valid key, but missing the scope required for this endpoint (insufficient_scope; the WWW-Authenticate header names the scope), or the key's owner lacks the role for it in this workspace (insufficient_permission; the analytics overview, account numbers, tag comparison, Update now and GET /posts/recent-platform need View analytics). On POST /media/upload-by-token: access_revoked, the access the upload URL was made with has ended |
404 | Resource not found |
409 | Conflict: the media item is still used by a post (media_in_use), the organisation already has 100 webhooks (webhook_limit_reached), the same inbox reply was already sent (duplicate_reply), an automation already covers the post, an X automation cannot turn on while X DMs are off (x_dms_off), or Update now on a post with no published X tweet (refresh_not_available). On posts: step_changed, review_required, post_publishing, retry_in_progress, media_processing, idempotency_in_progress and idempotency_key_reused, see Conflicts on posts. Publishing a post that is already published returns 400 with already_published |
429 | Rate limit exceeded (rate_limit_exceeded). Also refresh_limit: Update now ran 5 times on this post today (UTC); that one clears the next UTC day, not after Retry-After |
500 | Internal error. Retry with exponential backoff. |
502 | refresh_failed: X did not answer an Update now. Nothing was charged; try again in a few minutes. |
503 | Temporary outage or scheduled maintenance. On media uploads: storage_unavailable, see below. On POST /media/upload-from-url with a file over 100 MB: processing_unavailable, the file could not be queued for processing (its media item is marked failed); send the same request again in a minute. On upload-from-url and media_urls: downloads_busy, no download slot came free within 20 seconds (Retry-After: 30; nothing was stored). On POST /media/upload-by-token: service_unavailable, the access check could not run (the upload URL stays valid). Send the same request again after Retry-After. |
Storage outages
When our storage provider is down, an upload cannot be stored. Every route that stores media then returns 503 with the code storage_unavailable, a Retry-After header (seconds), and the same value as retry_after in the body:
JSON
This applies to POST /media/upload, /media/upload-from-base64, /media/upload-from-url, the presigned upload URL, and media_urls on post create and update. Nothing is wrong with your request and nothing was stored: no media item and no post. Wait for Retry-After, then send the same request again. A presigned upload URL stays valid for the retry until it expires.
Conflicts on posts
These 409 answers mean the post is in a state where the request would do harm. Nothing was changed.
| Code | Where | What to do |
|---|---|---|
step_changed | POST /posts/:id/approve, /reject with step_order | The review is on another step than the one you sent (somebody decided since you read it, or your earlier call already went through). error.current_step_order is the step it is on now. Read GET /posts/:id/approval again before you decide. See Approval workflows. |
review_required | PATCH /posts/:id that would schedule the post, POST /posts/:id/publish | Changes were requested on the post in its approval workflow (approval_status: "rejected"). It is scheduled or published only after a new review: create it again with approval_workflow_id. Saving it as a draft works. |
post_publishing | PATCH /posts/:id, DELETE /posts/:id | The post is being published right now (status posting), or a retry publishes one of its channels. Poll GET /posts/:id until the status is published, warning or failed, then send the request again. A PATCH that sends only tags still works. |
retry_in_progress | POST /posts/:id/retry | Another retry of the post runs (a second request, the dashboard or the automatic retry). Poll GET /posts/:id and retry once the post is failed or warning again. |
media_processing | POST /posts/create, /posts/create-and-publish, PATCH /posts/:id | A media id in media, media_ids or a thread part is still being processed (a large video is checked and converted after upload). Wait until GET /media/:id says ready, then send the same request again. A file whose processing failed answers 400 invalid_media: upload it again. |
idempotency_in_progress | POST /posts/create, /posts/create-and-publish, /posts/:id/publish with an Idempotency-Key | The first request with this key still runs. Wait Retry-After seconds and send the same request with the same key: you then get its answer. See Idempotency keys. |
idempotency_key_reused | The same endpoints | The key was used for a request with another body or path. Use a new key for a new request. |
JSON
Error body shape
Every 4xx and 5xx response of the REST API follows the same shape, also an invalid JSON body (400 invalid_json) and a body that is too large (413 payload_too_large: a JSON body can be 1 MB at most, 10 MB on POST /media/upload-from-base64):
JSON
codeis a stable machine-readable identifier. Use this for branching logic. Field-level validation usesvalidation_error. An answer without a more precise code uses one per status:bad_request(400),unauthorized(401),forbidden(403),not_found(404),conflict(409),rate_limited(429),internal_error(500),service_unavailable(503).messageis a human-readable explanation and may change between versions.detailsis optional and code-specific. On field-level validation errors it is an array of{ field, message }objects; other codes attach their own shapes (for example,x_credits_insufficientcarries credit balances, and media-limit errors carry per-platform file details). There is no top-levelerror.field.
Retry strategy
Retry 429, 500, 502, 503, and 504 with exponential backoff. Do not retry 400, 401, 403, 404, or 409 without first fixing the underlying request. The exceptions are post_publishing, retry_in_progress, media_processing and idempotency_in_progress: wait for the post, the file or the first request as described in Conflicts on posts, then send the same request again.
To retry a create or a publish after a timeout or a 5xx without posting twice, send an Idempotency-Key.
A reasonable default is three attempts with delays of 1s, 2s, and 4s. Cap total wait time at 30 seconds.