Errors
The Postkub API error envelope, every error code, and how to recover from each one.
Updated
On this page
- The error envelope
- HTTP status codes
- Error codes
- Authentication and keys
- Request, pagination, and concurrency
- Media and platform rules (hosted URLs and assets)
- Publishing and scheduling
- Inbox (comments, threads, replies)
- Availability, rate limiting, and server failures
- What retryable permits
- Retry-After and timing signals
- Debugging checklist
Every error from the Postkub API uses one JSON envelope with a stable machine-readable code, so your client can branch on error.code instead of parsing messages.
The error envelope
{
"error": {
"code": "REVISION_CONFLICT",
"message": "Revision mismatch",
"details": { "currentRevision": 3 },
"retryable": false
},
"requestId": "7f6b9d2a-4c1e-4a58-9d0f-2e7a1b3c4d5e"
}
code- stable identifier; branch on this, never on the message text.message- human-readable English description, useful for logs.details- extra structured fields when they help (currentRevisionon a revision conflict,retryAfterMson a rate-limit response, per-field validation errors on aVALIDATION_ERROR).nullwhen there is nothing extra.retryable- whentrue, repeating the same request can succeed later. Only some failures are safe to repeat; see what retryable permits.requestId- your request identifier echoed back when the request carried a valid UUID in theIdempotency-Keyheader, theX-Request-Idheader, or arequestIdbody field; otherwisenull. Use it with request lookup after a lost response.
HTTP status codes
| Status | Meaning |
|---|---|
| 400 | Request is invalid (validation, bad cursor, mixed credentials) |
| 401 | Authentication required or the key is invalid, revoked, or expired |
| 403 | Authenticated but not allowed (scope, action, lane, or state) |
| 404 | Record not found or invisible to you; uniform for inaccessible records |
| 409 | Conflict (idempotency, revision, lock, or domain state) |
| 413 | Payload too large |
| 422 | Semantic rejection: the request parsed but Postkub (or the platform) cannot accept it |
| 428 | Precondition missing (expectedRevision) |
| 429 | Rate limit or capacity cap reached |
| 500 | Unexpected internal failure; details are never exposed |
| 502 | The upstream social provider rejected the call |
| 503 | Temporarily unavailable (limiter, maintenance, paused publishing) |
| 504 | The upstream social provider timed out |
Error codes
The tables below list the codes the v1 API returns. Owner administration surfaces that are human-session-only (billing checkout, blog management, media-write reviews) use additional codes not listed here; the relevant API reference pages document those operations.
Authentication and keys
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
UNAUTHORIZED | 401 | No valid credentials on a protected route | Authenticate; see Authentication |
INVALID_TOKEN | 401 | Malformed Authorization header or unknown API key | Check the Bearer <API_KEY> format and the key value |
KEY_REVOKED | 401 | The key has been revoked | Stop using it; issue a new key |
KEY_EXPIRED | 401 | The key passed its expiresAt | Issue a new key |
AMBIGUOUS_CREDENTIALS | 400 | Both a session cookie and an Authorization header were sent | Send exactly one credential type |
LEGACY_KEY_UNSUPPORTED | 403 | Legacy agent key on v1 routes | Issue a current scoped key |
KEY_LANE_FORBIDDEN | 403 | An API key reached an owner-only lane (owner administration, media upload gateway) | External keys cannot access these; use the documented key routes |
ACCOUNT_SUSPENDED | 403 | The workspace owner account is suspended | Contact Postkub support |
FORBIDDEN | 403 | Workspace or owner state makes the key invalid (for example, workspace ownership changed) | Re-issue the key from the current owner |
PERMISSION_DENIED | 403 | The key lacks the action or the brand/account is out of its scope | See the scopes table in Authentication |
Request, pagination, and concurrency
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
VALIDATION_ERROR | 400 | Invalid header or body; details carries per-field errors | Fix the fields named in details |
INVALID_CURSOR | 400 | Malformed cursor, or the cursor does not match this endpoint, scope, or filters | Start a fresh list without cursor; see Pagination |
NOT_FOUND | 404 | Record missing or invisible to the caller | Never resubmit a mutation with a new key because of a 404; see Idempotency |
CONFLICT | 409 | Generic domain conflict | Read the message; usually a state precondition |
REVISION_REQUIRED | 428 | expectedRevision missing on an update | Add the current revision |
REVISION_CONFLICT | 409 | Stored revision newer than expectedRevision; details.currentRevision has the current one | Re-read, merge, resend with a new idempotency key |
IDEMPOTENCY_CONFLICT | 409 | Same key reused with a different path, operation, or payload | New UUID for the new mutation |
UNSUPPORTED_STATE | 409 | The record is in a state that does not permit the operation | Check the record's status first |
Media and platform rules (hosted URLs and assets)
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
INVALID_MEDIA | 422 | Media reference or value is unusable (for example, cover offset outside the verified video duration) | Check the media item against Hosted Media rules |
MEDIA_SHAPE_UNSUPPORTED | 422 | Media shape does not fit the intent (for example, a video post requires exactly one media item) | Adjust the media set |
MEDIA_KIND_MISMATCH | 422 | mediaKind does not match the attached assets | Declare the kind that matches the assets |
MEDIA_NOT_READY | 422 | An attached asset has not finished verification | Wait, or re-upload in the web app |
PLATFORM_NOT_SUPPORTED | 422 | The target platform does not support this format or cover type | Check GET /api/v1/accounts/{id}/capabilities |
PROVIDER_CAPABILITY_UNAVAILABLE | 422 | The capability is not qualified for this account's provider | Use an account where the capability is available |
IMAGE_UNSUPPORTED_FOR_PLATFORM | 422 | The target platform does not support image posts | Check capabilities; publish video or remove images |
IMAGE_COUNT_EXCEEDS_PLATFORM_LIMIT | 422 | Too many image items for the target platform; details.limit names the cap | Reduce the image count |
IMAGE_EXCEEDS_PLATFORM_LIMIT | 422 | A verified image's byte size exceeds the platform publish limit; details.limitBytes names the ceiling | Resize the image and re-upload in the web app |
TEXT_EXCEEDS_PLATFORM_LIMIT | 422 | Text exceeds the platform's limit for that surface | Shorten the text for that target |
VIDEO_EXCEEDS_PLATFORM_DURATION_LIMIT | 422 | Video duration exceeds the platform limit | Trim the video |
Messages about hosted media URLs that fail URL policy arrive as VALIDATION_ERROR entries prefixed with INVALID_MEDIA_URL.
Publishing and scheduling
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
INVALID_SCHEDULE | 422 | Schedule tuple is not a valid local-time/instant pair for that timezone | Follow the schedule grammar in Scheduling |
SCHEDULE_IN_PAST | 422 | The requested fire time is already past | Pick a future time |
SCHEDULE_RESOLUTION_MISMATCH | 422 | fireAtUtc does not match the resolved local time | Send the resolved fireAtUtc |
SCHEDULE_TIMEZONE_CHANGED | 422 | The account timezone changed since the schedule was built | Re-resolve against the current timezone |
NO_AVAILABLE_SLOT | 422 | No free weekly queue slot for the selected account | Choose an explicit time or free a slot |
TARGET_BRAND_CONFLICT | 409 | A saved target no longer belongs to the post's brand | Rebuild the target list |
PUBLICATION_ALREADY_ACCEPTED | 409 | The target already has accepted work | Read its status; use the explicit replacement controls |
REPLACEMENT_REQUIRES_ACCEPTED_WORK | 409 | Replacement requested but nothing accepted to replace | Publish or schedule normally |
RECONCILIATION_REQUIRED | 409 | Started or finished work cannot be replaced | Wait for the outcome, then use cancel/retry |
ACCOUNT_UNAVAILABLE | 409 | A selected account needs reconnection | Ask the owner to reconnect it |
PROVIDER_AUTH_EXPIRED | 409 | Stored provider credentials expired | Owner reconnects the account |
PROVIDER_ADMISSION_DISABLED | 403 | An operator disabled new operations for this provider | Wait or use a different provider |
SLOT_RESERVATION_CONFLICT | 409 | Another request reserved the same slot; retryable: true | Re-schedule; the slot is now taken |
TARGETLESS_DRAFT_OWNER_ONLY | 403 | A draft with no target accounts requires an owner session | Keys must select at least one account |
PUBLICATION_CAPACITY_EXCEEDED | 429 | Daily publication capacity for the selected UTC day is exhausted | Retry the next day or a later day |
ACCOUNT_QUEUE_LIMIT_EXCEEDED | 429 | The account's active queue reached the fair-use cap; details.socialAccountId names it | Let the queue drain before adding more |
PLATFORM_DAILY_LIMIT_EXCEEDED | 429 | The platform's per-account daily cap is exhausted | Try again the next UTC day |
PUBLISHING_PAUSED | 503 | Publishing is paused platform-wide; retryable: true | Retry the same request later |
Inbox (comments, threads, replies)
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
ACCOUNT_NOT_ACTIVE | 422 | The comment's account is not active | Owner reconnects the account |
LIKE_CAPABILITY_UNAVAILABLE | 422 | Comment likes are not supported for this provider (session-only feature) | Skip liking on this account |
CREDENTIAL_UNAVAILABLE | 409 | The channel has no usable credential | Owner reconnects the channel |
CREDENTIAL_EXPIRED | 409 | The channel credential expired | Owner reconnects the channel |
ACCESS_TOKEN_EXPIRED | 409 | The provider access token expired | Owner reconnects the channel |
PROVIDER_TIMEOUT | 504 | The provider call timed out; the like may or may not have applied | Retry is safe for likes |
PROVIDER_REQUEST_FAILED | 502 | The provider rejected the request | Check the account state; do not blind-retry |
CREDENTIAL_UNREADABLE | 500 | Stored credential could not be decrypted | Contact Postkub support |
Availability, rate limiting, and server failures
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
RATE_LIMITED | 429 | The API key exceeded its request rate; details.retryAfterMs says when to retry | Wait the indicated time, then repeat the same request |
KEY_ADMISSION_LIMITED | 429 | Too many key-verification attempts from your address or key prefix | Wait; check that clients are not sending garbage keys |
RATE_LIMIT_UNAVAILABLE | 503 | The rate limiter itself is unavailable; retryable: true | Retry shortly with the same request |
KEY_LOOKUP_CAPACITY | 503 | Key lookup is overloaded; retryable: true | Retry shortly |
SERVICE_UNAVAILABLE | 503 | A backing service is temporarily down; retryable: true | Retry with backoff |
LOCK_TIMEOUT | 409 | A concurrent request holds the row lock; retryable: true | Retry the same key after a short delay |
DATABASE_TIMEOUT | 503 | The request timed out server-side; retryable: true | Retry the same key |
INTERNAL_ERROR | 500 | Unexpected failure; details stay server-side | Retry the same key; if it persists, contact support with requestId |
INSIGHT_SNAPSHOT_INVALID | 500 | A stored insight snapshot is invalid | Retry later; contact support if it persists |
MAINTENANCE_MODE | 503 | Scheduled maintenance; response carries Retry-After: 300 and a different body shape (message plus messageEn) | Wait and retry |
What retryable permits
retryable: true means Postkub has not executed the mutation, or repeating it cannot duplicate its effect. It is permission to repeat the same request - same Idempotency-Key, same payload - after a delay. It is never permission to change the payload or switch to a new key on an accepted mutation; that is what Idempotency and recovery governs.
retryable: false means repeating the identical request will fail the same way. Fix the request first. The exceptions are INTERNAL_ERROR and CREDENTIAL_UNREADABLE, which are not marked retryable but where repeating the same request is still safe because of the durable request contract.
Retry-After and timing signals
- A
429 RATE_LIMITEDcarriesdetails.retryAfterMs(milliseconds until the fixed one-minute window resets). Sleep that long before repeating. - During maintenance, the
503 MAINTENANCE_MODEresponse carries aRetry-After: 300header. - No
RateLimitorRateLimit-Policyheaders are returned today; see Rate limits for how admission works and what the CLI reports.
Debugging checklist
- Branch on
error.code, not on the message string. Messages are for humans and may change. - Log the full envelope, including
requestId, before you react to it. - For
400codes, readdetails- validation errors name the failing fields. - For
409 REVISION_CONFLICT, takedetails.currentRevision, re-read the record, and merge; do not blind-increment. - For any
429or retryable503, wait the indicated time and repeat the identical request with the sameIdempotency-Key. - For
403 PERMISSION_DENIED, compare the required action with your key's scopes (GET /api/v1/me). - For anything else on a mutation, recover through request lookup instead of resubmitting with a new key; see Idempotency and recovery.
