Get started
API errors
The error shape, and every status and error code the PostChamp API returns, with what each means and what to do.
Every error has the same JSON shape:
{
"error" : {
"code" : "not_found" ,
"message" : "Workspace not found." ,
"details" : null
}
}
{
"error": {
"code": "not_found",
"message": "Workspace not found.",
"details": null
}
}codeis stable. Branch on it. When the code isconflictorpost_locked, also readdetails.reason.messageis written for people and can change. Show it, but do not match on it.detailsis optional and depends on the code. Validation errors list fields indetails.issues.X-Request-Idis on every answer. Server errors (5xx) also carry it asdetails.requestId. Send it to support if a problem continues.
{
"error" : {
"code" : "validation_error" ,
"message" : "Some fields are not valid." ,
"details" : {
"issues" : [
{ "path" : "versions" , "message" : "Too big: expected number to be <=3" },
{ "path" : "prompt" , "message" : "Describe the post or add a source." }
]
}
}
}
{
"error": {
"code": "validation_error",
"message": "Some fields are not valid.",
"details": {
"issues": [
{ "path": "versions", "message": "Too big: expected number to be <=3" },
{ "path": "prompt", "message": "Describe the post or add a source." }
]
}
}
}Retry rules
| Status | Retry? |
|---|---|
| 400, 401, 402, 403, 404, 413, 422 | No. Fix the request, key, plan or credits first. |
| 409 | Depends on the code. request_in_progress: wait and retry with the same key. Others: read the state, then decide. |
| 429 | Yes, after Retry-After seconds. |
| 500, 502, 503 | Yes, with backoff. For calls that spend credits, use the same Idempotency-Key. |
A failed call is never charged. See Idempotency and Rate limits.
Authentication and plan
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 401 | api_key_required | No x-api-key header. | Send the key. |
| 401 | api_key_invalid | The key is unknown, revoked or expired, or its creator left the organization. | Create a new key in Settings. |
| 402 | subscription_required | The trial ended or there is no live subscription. details.reason is trial_expired, canceled or none. | Fix the plan in the app. |
| 402 | insufficient_credits | Not enough credits. details has needed, balance and action. Nothing is charged. | Wait for the monthly reset or add credits. Check GET /credits. |
| 403 | plan_limit | The plan has no API access (details.feature), or a plan or daily cap was reached (details.limit, max, used, resetsAt). | Change the plan, or wait for the cap to reset. |
| 403 | forbidden | The key’s creator has a role that cannot do this. For scheduling with approvals on, details.reason is approval_required. | Use a key from someone with the right role, or approve the post first. |
| 404 | not_found | The id does not exist, the key’s scope does not include the workspace, or the creator is a client reviewer. Never 403 for scope. | Check the id, the workspace and the key’s scope. |
Request problems
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 400 | validation_error | The body, query or path is not valid. details.issues lists path and message. | Fix the fields. Unknown fields in strict bodies are rejected. |
| 400 | http_400 | The body is not valid JSON, or the content type is not JSON. | Send valid JSON with Content-Type: application/json. |
| 400 | idempotency_key_required | A call that spends credits has no Idempotency-Key. | Add the header. |
| 400 | invalid_cursor | The cursor is not one this API returned. | Use nextCursor unchanged. |
| 400 | invalid_limit | limit is out of range. | Use a whole number in range. |
| 413 | http_413 | The request body is over 1 MB. | Send less. |
Posts and scheduling
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 422 | post_too_long | The text is over 3,000 characters. details has max and charCount. | Shorten the post. |
| 409 | post_locked | The post cannot be edited now. details.reason is pending_approval, approved, approved_via_review, publishing, published or cancelled. | Wait, recall the approval in the app, or edit another post. |
| 409 | not_deletable | The post cannot be deleted in its state. | Cancel its schedule first. |
| 409 | conflict (reason: "published") | A published post cannot be deleted through the API. | Delete it on LinkedIn. |
| 400 | linkedin_not_connected | The workspace has no usable LinkedIn account, or it must be reconnected. details.reconnectPath is /settings/linkedin. | Connect or reconnect LinkedIn in the app. |
| 400 | scheduled_too_soon | The time is under a minute away. details.minLeadSeconds is 60. | Pick a later time. |
| 400 | scheduled_too_far | The time is more than two years ahead. | Pick an earlier time. |
| 400 | invalid_time | The date or time cannot be read. | Use ISO 8601 scheduledAt, or localDateTime as YYYY-MM-DDTHH:mm. |
| 400 | post_invalid | The post breaks a publishing rule. details.issues lists them. | Fix the post, then schedule again. |
| 400 | first_comment_too_long | The first comment is over the limit (details.max). | Shorten it. |
| 409 | already_scheduled | The post is already scheduled. | Cancel the schedule first, or leave it. |
| 409 | not_scheduled | The post is not scheduled (cancel-schedule). details.status is its state. | Nothing to cancel. |
| 409 | post_in_review | The post is in review. | Schedule it after approval. |
| 409 | not_schedulable | The post’s state cannot be scheduled. details.status says which. | Check the post’s status. |
| 409 | post_changed | The post changed while it was being scheduled, or expect.scheduleVersion was stale. | Read the post, then try again. |
Generation, carousels and infographics
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 409 | idempotency_conflict | The Idempotency-Key was used with a different request. details.reason is idempotency_key_reused. | Use a new key for a new request. |
| 409 | conflict (reason: "request_in_progress") | A request with this key is still running. | Wait, then retry with the same key. |
| 409 | conflict (reason: "already_done") | This charged request or change was already made. | Read the carousel or infographic. |
| 409 | carousel_in_progress | A carousel is already being drawn in the organization. | Wait for the job to finish. |
| 409 | carousel_locked | The carousel is on a post waiting for approval. | Wait for the review. |
| 409 | conflict (reason: "carousel_changed") | The carousel changed since expectedRevision. | Read it and plan the change again. |
| 409 | conflict (reason: "carousel_not_ready") | The carousel is not built yet. | Wait for the job. |
| 409 | conflict (reason: "infographic_in_progress") | The infographic is still being made. | Wait for its job. |
| 409 | conflict (reason: "infographic_not_ready") | The infographic has no finished version to edit. | Wait for the first version. |
| 422 | prompt_too_long | The infographic prompt or post text is too long (details.max). | Shorten it. |
| 400 | prompt_too_long | A carousel slide text or instruction is too long (details.max). | Shorten it. |
| 400 | prompt_empty | Nothing to build from: a carousel with no prompt and no slides, an empty slide, or an infographic with no prompt. | Add text. |
| 400 | min_slides, max_slides | The slides list has too few or too many items. | Send 2 to the allowed maximum. |
| 400 | slide_not_found | A slideId is not in this carousel. | Read the carousel for current ids. |
| 400 | slide_removed | A slide is removed and changed in the same request. | Remove it in one change, edit it in another. |
| 400 | duplicate_redraw | A slide is redrawn twice in one change. | Redraw each slide once. |
| 400 | too_many_references | More than 3 reference pictures in an edit. | Send up to 3. |
| 400 | template_unknown | The infographic templateKey is not one of the styles. | Use a documented key. |
| 400 | too_many_kb_items | Too many knowledge base items. | Send fewer. |
| 400 | instruction_empty | An infographic edit has no instruction. | Describe the change. |
| 400 | references_unsupported | The exact-text infographic mode takes no reference pictures. | Remove referenceObjectIds, or use renderMode: "ai_image". |
| 502 | writing_failed | The model could not write the post. Not charged. | Retry with the same key. |
| 502 | ai_timeout, ai_bad_output, ai_rate_limited, ai_busy | The AI service timed out, answered badly or is busy. Not charged. | Retry after a short wait. |
A failed carousel or infographic job reports its reason in the job’s message (for example “We couldn’t plan the slides. You weren’t charged. Try again.”). The credit hold is released. See Jobs and streaming.
Content styles
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 400 | too_many_examples | More than 5 examples in one call. | Send up to 5 per call. |
| 400 | style_examples_full | The style has its maximum of examples. | Remove one first. |
| 400 | preset_not_archivable | Built-in styles cannot be archived. | Archive only your own styles. |
| 409 | conflict (reason: "style_limit") | You reached the custom style limit. | Archive a style. |
| 409 | conflict (reason: "style_archived") | The style is archived. | Use another style. |
| 409 | conflict (reason: "item_moved") | The example list changed since you read it. | Read the style again and send the new key. |
| 409 | conflict (reason: "request_in_progress") | The style is being changed at the same time. | Retry. |
Limits and server errors
| Status | Code | Meaning | What to do |
|---|---|---|---|
| 429 | rate_limited | Too many requests, or too many open streams. Retry-After and details.retryAfterSeconds say how long. | Wait, then retry. |
| 499 | client_closed_request | The client closed the connection first. | Nothing; the run was cancelled. |
| 500 | internal_error | Something failed on our side. details.requestId is set. | Retry with backoff, then contact support with the id. |
| 502 | external_error | A service PostChamp depends on failed. | Retry with backoff. |
| 503 | service_unavailable | A dependency such as the idempotency store is down. Nothing was started. | Retry with the same key. |
Key management endpoints (
/api/v1/api-keys) are session-only and not part of the public API. Their too_many_api_keys error (422) appears when an organization has 50 live keys.- Retry without double charges.
- Handle 429.