Errors
Error formats of the simple API and of jobs and tasks, every error code with its HTTP status, and what to do about it.
Every error has a stable code. Use it in your code; the texts next to it are for people and can change.
Simple API (v1)#
Errors of /v1 requests use application/problem+json (RFC 9457):
{
"type": "https://switchfile.io/docs/api/v1#errors-unsupported-pair",
"title": "Unsupported pair",
"status": 422,
"code": "UNSUPPORTED_PAIR",
"detail": "Converting txt to mp4 is not supported."
}type links to the code on this page. Validation errors add errors with messages per field, for example {"to": ["Expected string"]}. Errors about one entry of a batch or archive add index, the position of that entry. QUOTA_EXCEEDED adds limit, scope and reset_at, see Limits.
Request errors#
| Status | Code | Meaning |
|---|---|---|
| 401 | UNAUTHENTICATED | The API key is missing or not valid |
| 402 | CREDITS_EXCEEDED | Today's free quota is used up and there are not enough credits |
| 403 | INVALID_SIGNATURE | A signed URL for an upload or a download is not valid |
| 403 | EXPIRED | A signed URL has expired |
| 403 | END_USER_NOT_ALLOWED | X-End-User was sent with a key that is not a service key |
| 404 | NOT_FOUND | The conversion, batch, upload or archive does not exist for this account, or it has expired |
| 409 | UPLOAD_INCOMPLETE | Nothing has been uploaded for this upload_id yet |
| 409 | INPUT_NOT_AVAILABLE | The input of the conversion in from is not ready yet or has failed |
| 409 | BATCH_NOT_FINISHED | The ZIP of a batch was requested before all its conversions are done |
| 409 | CONVERSION_NOT_FINISHED | A conversion for POST /v1/archives is still running or has failed, see index |
| 409 | IDEMPOTENCY_KEY_IN_USE | A request with this key is still running, see Idempotency |
| 411 | LENGTH_REQUIRED | The request has a body but no Content-Length |
| 413 | FILE_TOO_LARGE | The file is larger than allowed, see Limits |
| 413 | PAYLOAD_TOO_LARGE | A JSON body is larger than 1 MB |
| 415 | UNSUPPORTED_MEDIA_TYPE | Send JSON or multipart/form-data |
| 422 | INVALID_DATA | A field is missing or wrong, see errors |
| 422 | INVALID_URL | The URL is not a public http or https address |
| 422 | UNSUPPORTED_PAIR | This conversion is not supported, see Formats and options |
| 422 | PRESET_NOT_FOUND | There is no preset with this ID or name in your account |
| 422 | IDEMPOTENCY_KEY_REUSED | The key was used for a different request |
| 422 | UPLOAD_FAILED | The file sent to an upload URL could not be stored, send it again |
| 429 | RATE_LIMIT_EXCEEDED | Too many requests, wait for Retry-After seconds |
| 429 | QUOTA_EXCEEDED | A daily quota of a visitor is used up, see reset_at |
| 500 | INTERNAL_ERROR | Something went wrong on our side. Try again; if it keeps happening, contact us |
Conversion errors#
A request can succeed while the conversion fails later. Then the conversion has "status": "failed" and an error with code and message. With Accept: application/octet-stream and wait, the request itself returns the error as problem JSON.
| Code | Meaning |
|---|---|
CONVERSION_FAILED | The file could not be converted |
INVALID_INPUT | The input file could not be read. It may be damaged or not match its extension |
INVALID_OPTIONS | An option is not valid for this conversion. message names the allowed options |
PASSWORD_PROTECTED | The file needs a password to open. Send it in the password option |
UNSUPPORTED_PAIR | The downloaded file has a format that cannot be converted to the target |
TIMEOUT | The conversion took longer than the time limit |
FILE_TOO_LARGE | The downloaded or uploaded file is larger than allowed |
INVALID_URL | The URL points to an address that is not allowed |
DOWNLOAD_FAILED | The file could not be downloaded from the URL. message has the HTTP status if there was one |
CREDITS_EXCEEDED | The conversion needed more credits than were left |
CANCELLED | The conversion was cancelled |
EXPIRED | The conversion waited too long for its input |
INTERNAL_ERROR | Something went wrong on our side |
Failed conversions use no credits and do not count toward the free daily quota.
Jobs and tasks (v2)#
Errors of /v2 requests are JSON in the format of the CloudConvert API v2:
{
"message": "Task convert-1: output_format is required.",
"code": "INVALID_DATA",
"errors": {
"tasks.convert-1.output_format": ["output_format is required."]
}
}| Status | Code | Meaning |
|---|---|---|
| 401 | UNAUTHENTICATED | The API key is missing or not valid |
| 402 | CREDITS_EXCEEDED | Today's free quota is used up and there are not enough credits |
| 403 | INVALID_SIGNATURE, EXPIRED | A signed upload or download URL is not valid or has expired |
| 404 | NOT_FOUND | The object does not exist for this account, or it has expired |
| 411 | LENGTH_REQUIRED | The request has a body but no Content-Length |
| 413 | FILE_TOO_LARGE | The file or the request body is larger than allowed |
| 422 | INVALID_DATA | A field is missing or wrong, see errors |
| 429 | RATE_LIMIT_EXCEEDED | Too many requests, wait for Retry-After seconds |
| 500 | INTERNAL_ERROR | Something went wrong on our side |
Task errors#
A failed task has "status": "error" with code and message. If one task fails, the tasks that depend on it fail with INPUT_TASK_FAILED, and the job ends with error.
| Code | Meaning |
|---|---|
INVALID_INPUT | The input file could not be read, it may be damaged, or an archive contains unsafe paths |
INVALID_OPTIONS | An option has a value that is not allowed for this conversion |
INPUT_TOO_LARGE | The input goes over a limit, for example the page count or the unpacked size of an archive |
PASSWORD_PROTECTED | The PDF or archive needs a password to open |
DRM_PROTECTED | The ebook has copy protection |
UNSUPPORTED_PAIR | The input format cannot be converted to the target |
TIMEOUT | The task took longer than the time limit |
CANCELLED | The task was cancelled |
ENGINE_UNAVAILABLE | The conversion is not available right now. Try again later |
ENGINE_FAILED | The conversion failed |
INPUT_TASK_FAILED | A task this task depends on failed |
INVALID_URL, FORBIDDEN_URL | import/url: the URL is not valid or points to an address that is not allowed |
DOWNLOAD_FAILED | import/url: the file could not be downloaded |
FILE_TOO_LARGE | The imported file is larger than allowed |
CREDITS_EXCEEDED | The task needed more credits than were left |
WORKER_LOST | The task was interrupted too often. Retry it |
A failed task can be run again with POST /v2/tasks/{id}/retry.
What to retry#
| Situation | What to do |
|---|---|
429 | Wait for the seconds in Retry-After, then send the same request again |
500 or no answer | Send it again after a short pause. With an idempotency key, nothing is created twice |
409 IDEMPOTENCY_KEY_IN_USE | Wait one second and send it again |
Other 4xx | Do not retry unchanged. Fix the request first |
TIMEOUT, ENGINE_UNAVAILABLE, WORKER_LOST | Try the conversion again later |