VALIDPDF417

Error codes

Every status the API returns and what to do about it.

StatusBodyAction
200Image bytesNone
400bad jsonFix the request body
401unauthorizedCheck the bearer token
402payment_required + buy_urlNo live plan and no credits: buy from the link
403forbiddenAccount suspended — contact support
404unknown jurisdictionUse a 2-letter US state or DC
422validation failed + detailsRead details, fix each
429rate limitedBack off per Retry-After
500internalRetry once, then report
503busy + Retry-After: 1Database busy: retry with backoff. The write lock is held by another request

422 detail format

Validation returns every failure at once so a form can highlight all of them in one pass.

json
{
  "error": "validation failed",
  "details": [
    "DAK does not match ^[0-9]{5}([0-9]{4})?$",
    "DBC must be one of ['1', '2', '9']"
  ]
}

Why 422 is not a 400

A 400 means the request could not be read: malformed JSON, wrong content type, an empty body. A 422 means the request was read and the values did not satisfy the rules. The distinction matters because the fixes are different. Re-sending a 400 with the same body is pointless, and re-sending a 422 without changing a field is equally pointless, but a 422 tells you exactly which field to change in details.

Unknown element IDs are also 422. Sending dl instead of DAQ is read as an unknown element, not as a synonym, because the element registry is closed. That strictness is deliberate: silently dropping an unrecognised key would produce a symbol missing a value the caller believed was included.

Retry policy

Retry 500 and 503 with exponential backoff starting at 1s, capped at 30s, three attempts. A 402 is not retryable: it means no live plan and no credits, so retrying will not help until the account is topped up. The same applies to every other 4xx — the request will fail identically.

429 Honour Retry-After exactly. Hammering through a 429 extends the window.

Reporting

Send the request ID from the X-Request-Id response header to @VALIDPDF417. Without it the incident cannot be traced.

Include the state, the error correction level and the decoded payload. Those three let the request be reproduced without the original key, which is what makes an incident fixable rather than merely reportable. Never paste a full key into the message: the prefix is enough to identify it.

Generate barcode now