Reference
Errors
Status codes, stable error codes and retries.
Every error response has the same JSON body:
{ "code": "JOB_NOT_FOUND", "message": "Job not found or access denied.", "request_id": "req_8f2c1a"}| Field | Meaning |
|---|---|
code |
Stable, machine-readable error code. Branch on this, never on message. |
message |
Human-readable description, safe to show to your users. |
request_id |
Identifier of the request. Quote it when you contact support. |
Status codes
Section titled “Status codes”| Status | When |
|---|---|
400 |
The request is malformed, a required field is missing or the file cannot be read. |
401 |
The API key is missing or invalid. |
403 |
The key has no access to this resource. |
404 |
The job or resource does not exist. |
409 |
The resource is in the wrong state, or you do not have enough credits. |
410 |
The result has expired. |
413 |
The upload is too large. |
422 |
A value is invalid. |
429 |
Too many requests. Retry with backoff. |
5xx |
Something failed on our side. Retry with backoff. |
Retries
Section titled “Retries”Retry 408, 429 and 5xx responses with exponential backoff. Do not retry other 4xx
responses unchanged: they fail the same way again.
In the SDKs
Section titled “In the SDKs”A failed request raises a typed error that carries the code, message and request_id. The SDKs
retry 408, 429 and 5xx responses twice and time out after 60 seconds; both can be changed.
from byteit.core.api_error import ApiErrorfrom byteit.errors import NotFoundError
try: client.jobs.get(id="3f9a1c2e-5b7d-4e8f-9a0b-1c2d3e4f5a6b")except NotFoundError: ...except ApiError as error: print(error.status_code, error.body)import { ByteIt, ByteItError } from "@byteit/sdk";
try { await client.jobs.get({ id: "3f9a1c2e-5b7d-4e8f-9a0b-1c2d3e4f5a6b" });} catch (err) { if (err instanceof ByteIt.NotFoundError) { // ... } else if (err instanceof ByteItError) { console.log(err.statusCode, err.body); }}try{ await client.Jobs.GetAsync(new GetJobsRequest { Id = "3f9a1c2e-5b7d-4e8f-9a0b-1c2d3e4f5a6b" });}catch (NotFoundError){ // ...}catch (ByteItClientApiException e){ Console.WriteLine($"{e.StatusCode}: {e.Body}");}Error codes
Section titled “Error codes”Codes are only added in minor versions. A code is renamed or removed only in a new major version, so you can branch on them safely.
Authentication
UNAUTHORIZED401FORBIDDEN403
Request
MISSING_REQUIRED_FIELD400INVALID_VALUE422
Files
PDF_PASSWORD_PROTECTED400PDF_NOT_VALID400PDF_TRUNCATED400PDF_CORRUPTED400IMAGE_CORRUPTED400UNSUPPORTED_FILE_TYPE400FILE_TOO_LARGE413UNSUPPORTED_OFFICE_TYPE400UNSUPPORTED_SPREADSHEET400NO_TEXT_EXTRACTED400RTF_NOT_VALID400ARCHIVE_INVALID400ARCHIVE_EMPTY400
Jobs
JOB_NOT_FOUND404RESULT_EXPIRED410
Extraction
EXTRACT_JOB_NOT_FOUND404
State
STATE_CONFLICT409JOB_ALREADY_FINALIZED409
Credits
REFUND_DESTINATION_MISSING400INSUFFICIENT_CREDITS409
Processing
EMPTY_MODEL_RESPONSE500MALFORMED_MODEL_RESPONSE500MODEL_PROCESSING_ERROR500UPSTREAM_ERROR502
General
INTERNAL_SERVER_ERROR500SERVICE_UNAVAILABLE503RESOURCE_NOT_FOUND404