Error codes

Branch on the code, show the message, keep the request id.

Every API error uses one envelope. code is stable and safe to branch on; message is for people and may change; details is optional structured context. Every response carries x-request-id; include it when you contact support.

Retrying

  • Retry 429 after Retry-After, and 503 with exponential backoff.
  • Do not retry other 4xx without changing the request.
  • Uploads that fail during processing do not return an HTTP error: the session's status becomes failed with an error_code (see the upload flow).
  • In the SDKs these arrive as Img2siteError (server) and Img2siteUploadError (browser) with the same status, code and details.

Error envelope

HTTP/1.1 413 Payload Too Large
x-request-id: 0f6c…

{
  "error": {
    "code": "file_too_large",
    "message": "…",
    "details": { "max_bytes": 100000000 }
  }
}

API errors

API error codes
StatusCodeMeaning
400invalid_requestThe body or query failed validation (unknown fields are refused). details says which field.
400invalid_jsonThe body is not valid JSON.
400invalid_cursorA pagination cursor was altered or truncated. Restart from the first page.
400invalid_file_slugfile_slug must match ^[a-z0-9][a-z0-9._-]{0,127}$.
400invalid_transform_chainThe chain does not parse or names an unknown preset; details.reason says why.
400watermark_preset_not_foundA watermark preset named in a chain or setting does not exist in this project.
400transform_chain_not_allowedMinting a signed URL on a public project with a chain outside allowed_transform_chains.
400invalid_rangeUsage from must be before to.
401unauthorizedMissing, unknown or revoked credential.
403forbiddenThe API key lacks the scope this operation needs.
403browser_session_requiredThis route is for dashboard sessions only (keys, settings, billing, audit).
403project_suspendedThe project is suspended.
403project_suspended_by_staffOnly img2site staff can reactivate this project.
403storage_quota_exceededThe upload would exceed the project's storage limit.
403raw_download_disabledA raw signed URL was requested but the project has raw downloads off.
404not_foundThe resource does not exist or belongs to another project or organization.
404file_not_found / upload_not_foundNo such file or upload session in this project.
409project_existsThe project slug is taken.
409api_key_quota_exceededThe project already has 100 active API keys.
409file_not_readyThe file is not ready (for example blocked).
409signing_key_missingThe project has no active signing key; rotate one.
409default_watermark_in_useThe preset is the project's default watermark; change the default first.
409recipe_name_takenAnother recipe of the project has this name.
413payload_too_largeThe request body is over the route's limit (64 KiB for most writes).
429rate_limitedToo many requests or failed authentications; wait for Retry-After seconds.
503auth_unavailable / storage_unavailableA dependency is briefly unavailable. Retry with backoff.

Upload errors

Upload endpoint error codes
StatusCodeMeaning
400unsupported_content_typecontent_type is not one of the supported image types.
400invalid_part_size / parts_requiredMultipart parts are smaller than 5 MiB, or complete was called without the part list.
400invalid_partsThe multipart part list is not every part 1..N once with a non-empty ETag, names parts not uploaded, has a part other than the last under 5 MiB, or does not add up to size_bytes. The upload is left as it was; send the full list.
400multipart_complete_failedThe storage backend refused to assemble the parts (for example a wrong ETag); details.reason.
400body_length_mismatchThe proxy PUT sent fewer bytes than size_bytes.
401invalid_signature / signature_expiredThe proxy PUT URL was altered, or is past its exp (the session's 15 minutes). Create a new session.
409ingest_object_missingComplete was called before the bytes arrived.
409ingest_size_mismatchThe stored object is not size_bytes long.
409upload_not_pendingThe session is already past the step you called.
411length_requiredThe proxy PUT has no Content-Length.
413file_too_largesize_bytes is over the upload limit (details.max_bytes).
415content_type_mismatchThe proxy PUT's Content-Type differs from the session's.
422sha256_mismatchThe bytes do not match the declared sha256.

Delivery errors

Delivery hosts answer 404 not_found for anything they cannot serve and 403 with project_suspended, quota_exceeded, file_blocked, signature_required, invalid_signature, signature_expired, unknown_kid or transform_chain_not_allowed. The delivery guide lists them in the order they are checked. Use a placeholder image when a delivery URL fails.