Skip to main content

Error Handling

All requests return error and error_info fields when an argument is missing or incorrect, or when a problem occurs during processing.

warning

Most API errors return HTTP 200 with error details in the response body. The exceptions are:

  • http_unauthorized — HTTP 401
  • http_max_requests — HTTP 429

The error_info.id field is the reliable error identifier across all endpoints.

ErrorInfo object

The error_info object is present in error responses across all endpoints with the following fields:

id string

Programmatic error identifier. Use this for error handling in your code. Examples: image_no_content, conversion_error.

message string

Human-readable error message describing what went wrong.

detail object (optional)

Additional context (varies by error).

Example response with image_no_content error
{
"error": "Image has no content",
"error_info": {
"id": "image_no_content",
"message": "Image has no content"
}
}

Error categories

Retryable errors

Transient errors that may succeed on retry with exponential backoff.

http_max_requests HTTP 429
Endpoints: All

Your account has exceeded its monthly page or image quota, or you are sending too many requests per minute.
Wait before retrying, or upgrade your plan for higher limits.

Detail fieldDescription
limit_nameWhich limit was hit
limit_valueThe limit threshold
countCurrent usage count
Example response with http_max_requests error
{
"error": "Too many requests",
"error_info": {
"id": "http_max_requests",
"message": "Too many requests",
"limit_name": "page_monthly_limit",
"limit_value": 5000,
"count": 5001
}
}
sys_exception
Endpoints: All

Something went wrong on our servers while processing your request. This is not caused by your input.
Retry the same request after a brief delay — these are typically transient.

connection_closed
Endpoints: All

Your HTTP client closed the connection before the server finished sending the response.
This usually happens when a client-side timeout fires before OCR completes.
Increase your client timeout or use smaller images for faster processing.

Authentication errors

Returned when credentials are invalid or the account is not active.

http_unauthorized HTTP 401
Endpoints: All

The app_id or app_key header is missing, empty, or does not match any active account.
Double-check that both headers are present and correctly spelled. See Authentication.

unauthorized_token_request
Endpoints: v3/text, v3/latex, v3/strokes

The app_token is invalid, expired, or was used to call a batch/async endpoint that requires full app_id/app_key credentials.
App tokens are only valid for synchronous image endpoints. See App Tokens.

account_disabled HTTP 401
Endpoints: All

Your Mathpix account has been disabled by an administrator.
Contact support@mathpix.com to resolve.

expired_license HTTP 401
Endpoints: All

Your on-premises license key has expired.
Contact your Mathpix account representative to renew.

Request validation errors

Returned when the request body or parameters are malformed or out of range.

json_syntax
Endpoints: All

The request body is not valid JSON.

sys_request_too_large
Endpoints: All

The request body exceeds the maximum allowed size:

  • Image endpoints — 5 MB
  • Strokes — 512 KB

See Limits & Quotas for all size limits.

image_missing
Endpoints: v3/text, v3/latex, v3/batch

The request body does not contain a src field (for image URL or base64 data).
Either include src in the JSON body or send the image via multipart form-data.

file_missing
Endpoints: v3/text, v3/latex, v3/pdf

A multipart form-data request was sent but no file was attached.
Ensure the file field is populated in your multipart upload.

strokes_missing
Endpoints: v3/strokes

The request body does not contain a strokes field.
This endpoint requires handwriting stroke data as an array of stroke objects, each with x and y coordinate arrays.

strokes_syntax_error
Endpoints: v3/strokes

The strokes data could not be parsed.
Each stroke object must contain x and y arrays of equal length representing pen coordinates.

opts_value_out_of_range
Endpoints: All

A numeric parameter was set to a value outside its allowed range.
Refer to the endpoint documentation for valid ranges.

Detail fieldDescription
nameThe parameter name
valueThe value that was provided
opts_number_required
Endpoints: v3/text, v3/latex

A parameter that must be a number received a non-numeric value.

Detail fieldDescription
nameThe parameter name
valueThe value that was provided

Example

beam_size must be an integer when n_best is set.

opts_boolean_required
Endpoints: All

A parameter that must be a boolean received an invalid value. Accepted values (case-insensitive):

ValueMaps to
true, 1, "true"true
false, 0, "false"false

Values like "yes" or -1 are rejected.

Detail fieldDescription
nameThe parameter name
valueThe value that was provided
opts_string_required
Endpoints: All

A parameter that must be a string received a different type (e.g. a number or object).

Detail fieldDescription
nameThe parameter name
valueThe value that was provided
opts_object_required
Endpoints: All

A parameter that must be an object received a different type (e.g. a string or array).

Detail fieldDescription
nameThe parameter name
valueThe value that was provided
opts_expected_array
Endpoints: v3/text, v3/latex

A parameter that must be an array received a different type.

Detail fieldDescription
optionThe parameter name
typeThe actual type received
opts_string_array_required
Endpoints: v3/text, v3/latex

A parameter that must be an array of strings received an array containing non-string values, or a non-array type entirely.

Detail fieldDescription
tagsThe invalid value provided
opts_array_length_mismatch
Endpoints: v3/latex

An array parameter has the wrong number of elements.

Detail fieldDescription
optionThe parameter name
lengthThe expected length

Example

math_delims must be exactly [begin, end] — a two-element array.

opts_property_required
Endpoints: v3/text, v3/latex

An object parameter is missing one or more required properties.

Detail fieldDescription
parameterThe object parameter name
propertiesThe properties that were provided
requiredAll required properties

Example

A Region object requires the properties top_left_x, top_left_y, width, and height.

opts_property_invalid
Endpoints: v3/text, v3/latex

An object parameter contains properties that are not recognized.

Detail fieldDescription
parameterThe object parameter name
propertiesThe unrecognized properties
requiredThe allowed properties
opts_unknown_format
Endpoints: v3/text, v3/latex

The formats array contains a value that is not a recognized output format.
See Conversion Formats for the list of valid format names.

Detail fieldDescription
formatsThe unrecognized format value
opts_unknown_ocr
Endpoints: v3/latex

The ocr array contains a value that is not a recognized OCR engine option.
Check the v3/latex endpoint documentation for valid values.

Detail fieldDescription
ocrThe unrecognized OCR value
opts_unknown_ocr_behavior
Endpoints: v3/batch

The ocr_behavior parameter only accepts the following values:

  • "latex"
  • "text"

Any other value is rejected.

opts_unknown_alphabets_allowed
Endpoints: v3/text, v3/latex, v3/batch, v3/pdf

The AlphabetsAllowed object contains a key that is not a recognized alphabet code.
See DetectedAlphabet for valid keys (e.g. en, ru, zh).

opts_unknown_data_option
Endpoints: v3/text

The DataOptions object contains a key that is not a recognized data option.
Remove unrecognized keys from the object.

opts_bad_data_options
Endpoints: v3/text

The DataOptions parameter must be an object, but received a different type (e.g. a string or array).

opts_bad_callback
Endpoints: v3/text, v3/latex, v3/batch

The Callback configuration is invalid. Common causes:

  • post is not a valid URL string
  • reply is not an object
  • reply contains the reserved key batch_id
Detail fieldDescription
postThe invalid post URL
replyThe invalid reply object
batch_idPresent if reply contains reserved key
opts_section_numbering
Endpoints: v3/pdf

More than one section numbering flag is set to true. Only one of the following can be enabled per request:

  • auto_number_sections
  • remove_section_numbering
  • preserve_section_numbering
opts_unknown_timespan
Endpoints: v3/ocr-usage

The timespan query parameter contains an unrecognized value.
Check the v3/ocr-usage endpoint documentation for valid timespan values.

Processing errors

Returned when the input is valid but the content could not be processed.

image_download_error
Endpoints: v3/text, v3/latex, v3/batch

The server could not download the image from the URL you provided. This happens when:

  • The URL is unreachable or returns a non-image response
  • The download takes longer than 15 seconds
  • The remote file exceeds 10 MB

Verify the URL is publicly accessible and returns an image.

image_decode_error
Endpoints: v3/text, v3/latex, v3/batch, v3/pdf

The image data could not be decoded. The file may be corrupt, truncated, or in an unsupported format.
See Supported Formats for accepted image types.

image_no_content
Endpoints: v3/text, v3/latex, v3/batch

The image was successfully received but the OCR engine found no recognizable text, math, or diagrams.
This can happen with blank images, images with only decorative elements, or very low-resolution content.

image_not_supported
Endpoints: v3/text, v3/latex, v3/batch

The image content type is not supported by the OCR engine.
See Supported Formats for accepted image types.

image_max_size
Endpoints: v3/text, v3/latex, v3/batch

The image dimensions or file size exceed the processing limit.
Resize or compress the image and retry.

strokes_no_content
Endpoints: v3/strokes

The stroke data was received but the recognition engine could not identify any text or math from the handwriting.
This can happen when strokes are too short, scattered, or do not form recognizable characters.

math_confidence
Endpoints: v3/text, v3/latex, v3/batch

The OCR engine recognized content but the confidence score is below the minimum threshold.
The image may be too blurry, low-resolution, or contain ambiguous content. Try a higher-quality image.

math_syntax
Endpoints: v3/text, v3/latex, v3/batch

The OCR engine recognized characters but could not assemble them into syntactically valid math.
This can happen with unusual notation or heavily overlapping symbols.

pdf_encrypted
Endpoints: v3/pdf

The PDF is password-protected or encrypted and cannot be read.
Remove the encryption before uploading, or provide an unprotected copy.

pdf_missing
Endpoints: v3/pdf

The request body does not contain a url field and no file was uploaded.
Either include a url pointing to the PDF, or upload the file via multipart form-data.

pdf_unknown_id
Endpoints: v3/pdf

The pdf_id does not match any existing document.
The ID may have expired (results are retained for a limited time), or it may be a typo.
Check that you are using the pdf_id returned by the original POST request.

pdf_page_limit_exceeded
Endpoints: v3/pdf

The PDF has more pages than your account's per-document limit allows.
Split the document into smaller parts using page_ranges, or contact support to increase your limit.

batch_unknown_id
Endpoints: v3/batch

The batch_id does not match any existing batch.
The ID may have expired, or it may be a typo.
Check that you are using the batch_id returned by the original POST request.