Skip to main content

Batch Processing

Process multiple equation images in a single request.

EndpointDescription
POST v3/batchSubmit a batch of image URLs
GET v3/batch/{batch_id}Retrieve batch results

See the batch processing guide for step-by-step examples.

POST v3/batch

POST api.mathpix.com/v3/batch

The request body may contain any v3/latex parameters except src, plus a urls parameter and optional callback.

warning

Only use the batch API when your workload is not latency sensitive! For immediate responses use single image endpoints.

Example

{
"urls": {
"inverted": "https://raw.githubusercontent.com/Mathpix/api-examples/master/images/inverted.jpg",
"algebra": "https://raw.githubusercontent.com/Mathpix/api-examples/master/images/algebra.jpg"
},
"formats": ["latex_simplified"]
}
Example response
{
"batch_id": 17
}

Request parameters

urls object

key-value for each image in the batch where the value may be a string url or an object containing a url and image-specific options such as region and formats.

ocr_behavior string (optional), default value is latex

"text" for processing like v3/text or "latex" for processing like v3/latex. Only these two values are accepted.

callback Callback (optional)

Description of where to send the batch results.

metadata object (optional)

Key-value object. Supports improve_mathpix for extra privacy controls.

When using ocr_behavior: "text", all v3/text params can be set at the top level or individually per URL.

Response body

batch_id number

Unique batch tracking ID

GET v3/batch/{batch_id}

GET api.mathpix.com/v3/batch/{batch_id}

Retrieve batch results. Wait approximately one second per five images before polling. The GET request must contain the same app_id and app_key headers as the POST.

Example

curl https://api.mathpix.com/v3/batch/BATCH_ID \
-H 'app_id: APP_ID' \
-H 'app_key: APP_KEY'
keys string[]

all the url keys present in the originating batch request

results object

an OCR result for each key that has been processed

Before completion, the results field may be empty or contain only some results.