Skip to content
Menu · Errors

API reference

Errors

The shape of a Composa API error, every status code it uses, and which errors are safe to retry.

A failed call answers with an HTTP status and a JSON body. error is a sentence meant for a person. code, when present, is stable and meant for your code:

json
{  "error": "Too many requests: this Team's plan allows 20 print calls a minute. Try again in 12 s.",  "code": "rate_limited",  "limit": 20}

Branch on status and code, never on the sentence. Quote the answer's x-request-id header to support.

Status codes

StatusCodeWhen
400The body cannot be read: malformed JSON, no template_id, or a format, quality, scale, width or pages the API cannot make. The sentence says which.
400invalid_datadata is not a JSON object.
400use_batchesitems_upload was sent to /v1/run. Send it to /v1/run/batches.
401The API key is missing, malformed or revoked.
402credits_exhaustedYour Team used the pages its plan includes this month. resetsAt says when they renew.
403template_not_allowedThe key has Template access and the template is not on its list.
403plan_requiredYour plan does not include this, like pinning a version. requiredPlan and upgradeUrl say where to go.
403feature_switched_offAn Admin switched the API off for your Team.
404The template, version or batch does not exist, or your key cannot reach it.
409The template has no published version. Publish it.
409batch_endedYou canceled a batch that had already ended.
413too_largeMore than one document sent to /v1/run, more than 50,000 items in a batch, a body over 50 MB, or a file over 25 MB as the answer. For the last, ask for "output": "url".
422no_usable_valueA field with the stop setting had no usable value. problems lists every one.
422deadline_exceededThe document did not print within the call's 50 seconds. Send it as a batch.
422out_of_memoryThe document needs more memory than a print is given. Send it as a batch, or ask for fewer pages.
422language is not one of the template's languages, or the document could not be printed.
429rate_limitedToo many calls a minute. Wait for Retry-After.
500Something broke on our side.
503busy, print_busy, print_unavailablePrinting has no room right now. Wait for Retry-After.

A 422 no_usable_value answer lists each field:

json
{  "error": "2 fields have no usable value, so nothing was printed: qty (not a number), full_name (not sent).",  "code": "no_usable_value",  "problems": [    { "field": "qty", "reason": "not_a_number", "message": "qty: not a number." },    { "field": "full_name", "reason": "missing", "message": "full_name: not sent." }  ]}

A reason is one of missing, null, empty, wrong_shape, not_a_number, not_a_colour, not_yes_no, not_a_picture, cannot_encode or no_result.

Retries

The API has no idempotency key, so repeating a print prints and counts it again.

  • Safe to retry: 429, and 503 with busy, print_busy or print_unavailable. Nothing was printed. Wait for the Retry-After header first.
  • Do not retry as is: any other 4xx. Fix the call.
  • Careful: after a timeout or a dropped connection, the document may have printed.

Within a batch, an item that fails carries its own error and code, and the other items still print.