Errors

The Postkub API error envelope, every error code, and how to recover from each one.

Updated

Open in ClaudeOpen in ChatGPT
On this page

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 (currentRevision on a revision conflict, retryAfterMs on a rate-limit response, per-field validation errors on a VALIDATION_ERROR). null when there is nothing extra.
  • retryable - when true, 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 the Idempotency-Key header, the X-Request-Id header, or a requestId body field; otherwise null. Use it with request lookup after a lost response.

HTTP status codes

StatusMeaning
400Request is invalid (validation, bad cursor, mixed credentials)
401Authentication required or the key is invalid, revoked, or expired
403Authenticated but not allowed (scope, action, lane, or state)
404Record not found or invisible to you; uniform for inaccessible records
409Conflict (idempotency, revision, lock, or domain state)
413Payload too large
422Semantic rejection: the request parsed but Postkub (or the platform) cannot accept it
428Precondition missing (expectedRevision)
429Rate limit or capacity cap reached
500Unexpected internal failure; details are never exposed
502The upstream social provider rejected the call
503Temporarily unavailable (limiter, maintenance, paused publishing)
504The 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

CodeHTTPMeaningWhat to do
UNAUTHORIZED401No valid credentials on a protected routeAuthenticate; see Authentication
INVALID_TOKEN401Malformed Authorization header or unknown API keyCheck the Bearer <API_KEY> format and the key value
KEY_REVOKED401The key has been revokedStop using it; issue a new key
KEY_EXPIRED401The key passed its expiresAtIssue a new key
AMBIGUOUS_CREDENTIALS400Both a session cookie and an Authorization header were sentSend exactly one credential type
LEGACY_KEY_UNSUPPORTED403Legacy agent key on v1 routesIssue a current scoped key
KEY_LANE_FORBIDDEN403An API key reached an owner-only lane (owner administration, media upload gateway)External keys cannot access these; use the documented key routes
ACCOUNT_SUSPENDED403The workspace owner account is suspendedContact Postkub support
FORBIDDEN403Workspace or owner state makes the key invalid (for example, workspace ownership changed)Re-issue the key from the current owner
PERMISSION_DENIED403The key lacks the action or the brand/account is out of its scopeSee the scopes table in Authentication

Request, pagination, and concurrency

CodeHTTPMeaningWhat to do
VALIDATION_ERROR400Invalid header or body; details carries per-field errorsFix the fields named in details
INVALID_CURSOR400Malformed cursor, or the cursor does not match this endpoint, scope, or filtersStart a fresh list without cursor; see Pagination
NOT_FOUND404Record missing or invisible to the callerNever resubmit a mutation with a new key because of a 404; see Idempotency
CONFLICT409Generic domain conflictRead the message; usually a state precondition
REVISION_REQUIRED428expectedRevision missing on an updateAdd the current revision
REVISION_CONFLICT409Stored revision newer than expectedRevision; details.currentRevision has the current oneRe-read, merge, resend with a new idempotency key
IDEMPOTENCY_CONFLICT409Same key reused with a different path, operation, or payloadNew UUID for the new mutation
UNSUPPORTED_STATE409The record is in a state that does not permit the operationCheck the record's status first

Media and platform rules (hosted URLs and assets)

CodeHTTPMeaningWhat to do
INVALID_MEDIA422Media reference or value is unusable (for example, cover offset outside the verified video duration)Check the media item against Hosted Media rules
MEDIA_SHAPE_UNSUPPORTED422Media shape does not fit the intent (for example, a video post requires exactly one media item)Adjust the media set
MEDIA_KIND_MISMATCH422mediaKind does not match the attached assetsDeclare the kind that matches the assets
MEDIA_NOT_READY422An attached asset has not finished verificationWait, or re-upload in the web app
PLATFORM_NOT_SUPPORTED422The target platform does not support this format or cover typeCheck GET /api/v1/accounts/{id}/capabilities
PROVIDER_CAPABILITY_UNAVAILABLE422The capability is not qualified for this account's providerUse an account where the capability is available
IMAGE_UNSUPPORTED_FOR_PLATFORM422The target platform does not support image postsCheck capabilities; publish video or remove images
IMAGE_COUNT_EXCEEDS_PLATFORM_LIMIT422Too many image items for the target platform; details.limit names the capReduce the image count
IMAGE_EXCEEDS_PLATFORM_LIMIT422A verified image's byte size exceeds the platform publish limit; details.limitBytes names the ceilingResize the image and re-upload in the web app
TEXT_EXCEEDS_PLATFORM_LIMIT422Text exceeds the platform's limit for that surfaceShorten the text for that target
VIDEO_EXCEEDS_PLATFORM_DURATION_LIMIT422Video duration exceeds the platform limitTrim the video

Messages about hosted media URLs that fail URL policy arrive as VALIDATION_ERROR entries prefixed with INVALID_MEDIA_URL.

Publishing and scheduling

CodeHTTPMeaningWhat to do
INVALID_SCHEDULE422Schedule tuple is not a valid local-time/instant pair for that timezoneFollow the schedule grammar in Scheduling
SCHEDULE_IN_PAST422The requested fire time is already pastPick a future time
SCHEDULE_RESOLUTION_MISMATCH422fireAtUtc does not match the resolved local timeSend the resolved fireAtUtc
SCHEDULE_TIMEZONE_CHANGED422The account timezone changed since the schedule was builtRe-resolve against the current timezone
NO_AVAILABLE_SLOT422No free weekly queue slot for the selected accountChoose an explicit time or free a slot
TARGET_BRAND_CONFLICT409A saved target no longer belongs to the post's brandRebuild the target list
PUBLICATION_ALREADY_ACCEPTED409The target already has accepted workRead its status; use the explicit replacement controls
REPLACEMENT_REQUIRES_ACCEPTED_WORK409Replacement requested but nothing accepted to replacePublish or schedule normally
RECONCILIATION_REQUIRED409Started or finished work cannot be replacedWait for the outcome, then use cancel/retry
ACCOUNT_UNAVAILABLE409A selected account needs reconnectionAsk the owner to reconnect it
PROVIDER_AUTH_EXPIRED409Stored provider credentials expiredOwner reconnects the account
PROVIDER_ADMISSION_DISABLED403An operator disabled new operations for this providerWait or use a different provider
SLOT_RESERVATION_CONFLICT409Another request reserved the same slot; retryable: trueRe-schedule; the slot is now taken
TARGETLESS_DRAFT_OWNER_ONLY403A draft with no target accounts requires an owner sessionKeys must select at least one account
PUBLICATION_CAPACITY_EXCEEDED429Daily publication capacity for the selected UTC day is exhaustedRetry the next day or a later day
ACCOUNT_QUEUE_LIMIT_EXCEEDED429The account's active queue reached the fair-use cap; details.socialAccountId names itLet the queue drain before adding more
PLATFORM_DAILY_LIMIT_EXCEEDED429The platform's per-account daily cap is exhaustedTry again the next UTC day
PUBLISHING_PAUSED503Publishing is paused platform-wide; retryable: trueRetry the same request later

Inbox (comments, threads, replies)

CodeHTTPMeaningWhat to do
ACCOUNT_NOT_ACTIVE422The comment's account is not activeOwner reconnects the account
LIKE_CAPABILITY_UNAVAILABLE422Comment likes are not supported for this provider (session-only feature)Skip liking on this account
CREDENTIAL_UNAVAILABLE409The channel has no usable credentialOwner reconnects the channel
CREDENTIAL_EXPIRED409The channel credential expiredOwner reconnects the channel
ACCESS_TOKEN_EXPIRED409The provider access token expiredOwner reconnects the channel
PROVIDER_TIMEOUT504The provider call timed out; the like may or may not have appliedRetry is safe for likes
PROVIDER_REQUEST_FAILED502The provider rejected the requestCheck the account state; do not blind-retry
CREDENTIAL_UNREADABLE500Stored credential could not be decryptedContact Postkub support

Availability, rate limiting, and server failures

CodeHTTPMeaningWhat to do
RATE_LIMITED429The API key exceeded its request rate; details.retryAfterMs says when to retryWait the indicated time, then repeat the same request
KEY_ADMISSION_LIMITED429Too many key-verification attempts from your address or key prefixWait; check that clients are not sending garbage keys
RATE_LIMIT_UNAVAILABLE503The rate limiter itself is unavailable; retryable: trueRetry shortly with the same request
KEY_LOOKUP_CAPACITY503Key lookup is overloaded; retryable: trueRetry shortly
SERVICE_UNAVAILABLE503A backing service is temporarily down; retryable: trueRetry with backoff
LOCK_TIMEOUT409A concurrent request holds the row lock; retryable: trueRetry the same key after a short delay
DATABASE_TIMEOUT503The request timed out server-side; retryable: trueRetry the same key
INTERNAL_ERROR500Unexpected failure; details stay server-sideRetry the same key; if it persists, contact support with requestId
INSIGHT_SNAPSHOT_INVALID500A stored insight snapshot is invalidRetry later; contact support if it persists
MAINTENANCE_MODE503Scheduled 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_LIMITED carries details.retryAfterMs (milliseconds until the fixed one-minute window resets). Sleep that long before repeating.
  • During maintenance, the 503 MAINTENANCE_MODE response carries a Retry-After: 300 header.
  • No RateLimit or RateLimit-Policy headers are returned today; see Rate limits for how admission works and what the CLI reports.

Debugging checklist

  1. Branch on error.code, not on the message string. Messages are for humans and may change.
  2. Log the full envelope, including requestId, before you react to it.
  3. For 400 codes, read details - validation errors name the failing fields.
  4. For 409 REVISION_CONFLICT, take details.currentRevision, re-read the record, and merge; do not blind-increment.
  5. For any 429 or retryable 503, wait the indicated time and repeat the identical request with the same Idempotency-Key.
  6. For 403 PERMISSION_DENIED, compare the required action with your key's scopes (GET /api/v1/me).
  7. For anything else on a mutation, recover through request lookup instead of resubmitting with a new key; see Idempotency and recovery.