Skip to content
Docs menu
Guides

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):

JSON
{
  "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#

StatusCodeMeaning
401UNAUTHENTICATED The API key is missing or not valid
402CREDITS_EXCEEDED Today's free quota is used up and there are not enough credits
403INVALID_SIGNATURE A signed URL for an upload or a download is not valid
403EXPIRED A signed URL has expired
403END_USER_NOT_ALLOWED X-End-User was sent with a key that is not a service key
404NOT_FOUND The conversion, batch, upload or archive does not exist for this account, or it has expired
409UPLOAD_INCOMPLETE Nothing has been uploaded for this upload_id yet
409INPUT_NOT_AVAILABLE The input of the conversion in from is not ready yet or has failed
409BATCH_NOT_FINISHED The ZIP of a batch was requested before all its conversions are done
409CONVERSION_NOT_FINISHED A conversion for POST /v1/archives is still running or has failed, see index
409IDEMPOTENCY_KEY_IN_USE A request with this key is still running, see Idempotency
411LENGTH_REQUIRED The request has a body but no Content-Length
413FILE_TOO_LARGE The file is larger than allowed, see Limits
413PAYLOAD_TOO_LARGE A JSON body is larger than 1 MB
415UNSUPPORTED_MEDIA_TYPE Send JSON or multipart/form-data
422INVALID_DATA A field is missing or wrong, see errors
422INVALID_URL The URL is not a public http or https address
422UNSUPPORTED_PAIR This conversion is not supported, see Formats and options
422PRESET_NOT_FOUND There is no preset with this ID or name in your account
422IDEMPOTENCY_KEY_REUSED The key was used for a different request
422UPLOAD_FAILED The file sent to an upload URL could not be stored, send it again
429RATE_LIMIT_EXCEEDED Too many requests, wait for Retry-After seconds
429QUOTA_EXCEEDED A daily quota of a visitor is used up, see reset_at
500INTERNAL_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.

CodeMeaning
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_PAIRThe downloaded file has a format that cannot be converted to the target
TIMEOUT The conversion took longer than the time limit
FILE_TOO_LARGEThe downloaded or uploaded file is larger than allowed
INVALID_URLThe 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_EXCEEDEDThe conversion needed more credits than were left
CANCELLED The conversion was cancelled
EXPIREDThe conversion waited too long for its input
INTERNAL_ERRORSomething 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:

JSON
{
  "message": "Task convert-1: output_format is required.",
  "code": "INVALID_DATA",
  "errors": {
    "tasks.convert-1.output_format": ["output_format is required."]
  }
}
StatusCodeMeaning
401UNAUTHENTICATEDThe API key is missing or not valid
402CREDITS_EXCEEDEDToday's free quota is used up and there are not enough credits
403INVALID_SIGNATURE, EXPIREDA signed upload or download URL is not valid or has expired
404NOT_FOUNDThe object does not exist for this account, or it has expired
411LENGTH_REQUIREDThe request has a body but no Content-Length
413FILE_TOO_LARGEThe file or the request body is larger than allowed
422INVALID_DATAA field is missing or wrong, see errors
429RATE_LIMIT_EXCEEDEDToo many requests, wait for Retry-After seconds
500INTERNAL_ERRORSomething 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.

CodeMeaning
INVALID_INPUTThe input file could not be read, it may be damaged, or an archive contains unsafe paths
INVALID_OPTIONSAn option has a value that is not allowed for this conversion
INPUT_TOO_LARGEThe input goes over a limit, for example the page count or the unpacked size of an archive
PASSWORD_PROTECTEDThe PDF or archive needs a password to open
DRM_PROTECTEDThe ebook has copy protection
UNSUPPORTED_PAIRThe input format cannot be converted to the target
TIMEOUTThe task took longer than the time limit
CANCELLEDThe task was cancelled
ENGINE_UNAVAILABLEThe conversion is not available right now. Try again later
ENGINE_FAILEDThe conversion failed
INPUT_TASK_FAILEDA task this task depends on failed
INVALID_URL, FORBIDDEN_URLimport/url: the URL is not valid or points to an address that is not allowed
DOWNLOAD_FAILEDimport/url: the file could not be downloaded
FILE_TOO_LARGEThe imported file is larger than allowed
CREDITS_EXCEEDEDThe task needed more credits than were left
WORKER_LOSTThe task was interrupted too often. Retry it

A failed task can be run again with POST /v2/tasks/{id}/retry.

What to retry#

SituationWhat to do
429Wait for the seconds in Retry-After, then send the same request again
500 or no answerSend it again after a short pause. With an idempotency key, nothing is created twice
409 IDEMPOTENCY_KEY_IN_USEWait one second and send it again
Other 4xxDo not retry unchanged. Fix the request first
TIMEOUT, ENGINE_UNAVAILABLE, WORKER_LOSTTry the conversion again later