Start free trial

API

API errors

Every API error has the same JSON shape with a stable code. The list of status codes and error codes, and how to handle each one.

On this page

Errors use one shape:

{
  "error": {
    "code": "not_found",
    "message": "Workspace not found.",
    "details": null
  }
}

Handle errors by code, and by details.reason when the code is conflict. The message is for people. Server errors carry a request id in details.requestId, and every answer has an X-Request-Id header.

Status codes and codes

StatusCodeWhat it meansWhat to do
400validation_errorThe input is not valid. details lists the fields.Fix the request.
400idempotency_key_requiredA call that spends credits needs an Idempotency-Key header.Add the header.
400linkedin_not_connectedThe workspace has no working LinkedIn connection, or it needs to be renewed.Connect LinkedIn in the app.
401api_key_requiredNo x-api-key header.Send the key.
401api_key_invalidThe key is unknown, revoked or expired, or its creator left the organization.Create a new key.
402subscription_requiredThe trial ended or there is no live subscription.Fix the plan in the app.
402insufficient_creditsThere are not enough credits for the call. Nothing is charged.Wait for the monthly reset or add credits.
403plan_limitYour plan does not include the API, or a daily cap was reached.Wait for the cap to reset or change the plan.
403forbiddenThe key's role cannot do this.Use a key from someone with the right role.
404not_foundThe id does not exist, or the key cannot reach it.Check the id and the workspace.
409idempotency_conflictThe same key was used with a different body.Use a new key for a new request.
409post_lockedThe post cannot be changed now, for example while it is publishing. details.reason says why.Try again later.
409conflictdetails.reason is request_in_progress (a request with this key is still running) or already_done (the change was already made). Other reasons exist, such as item_moved.For request_in_progress, wait and retry with the same key. For already_done, there is nothing to do.
422post_too_longThe text is longer than LinkedIn allows.Shorten the post.
429rate_limitedToo many requests. See Retry-After.Wait and retry. See Rate limits.
503A dependency is down. Nothing was started.Retry with the same Idempotency-Key.

Idempotency

Send an Idempotency-Key on every call that spends credits. A retry with the same key and body returns the first answer and is never charged twice. The same key with another body returns idempotency_conflict. Answers are kept for a day.

Questions

Which part of an error should my code rely on?

The code. Messages are written for people and can change. Codes are stable.

What should I do with a 5xx answer?

Retry with the same Idempotency-Key. The answer includes a request id in details, and the same id is in the X-Request-Id header. Send it to support if the problem continues.

  • API overview: Create drafts, schedule posts, build carousels and infographics from your own tools with a REST API and an API key. Base URL, conventions and a first request.
  • API rate limits: How many API requests a key and a workspace can make each minute, the headers that show what is left, and how to back off when you get a 429.
  • API authentication: How API keys work. Send a key in the x-api-key header. Create, name and revoke keys in Settings. Keys are shown once, so keep them on your server.

Last updated