POST v3/strokes
POST api.mathpix.com/v3/strokes
Process handwriting stroke coordinates directly, without generating an image first. Accepts the same options as v3/text for output formatting. Results in faster response times and smaller request payloads compared to sending rendered images.
The LaTeX of the recognized handwriting is returned inside inline delimiters \( ... \) and block mode delimiters \[ .... \]. Lines are separated with \n newline characters.
See the strokes processing guide for step-by-step examples.
Request limit: 512 KB JSON body (smaller than other endpoints). See Limits & Quotas for details.
Request parameters
The stroke data format uses arrays of x and y coordinates, where each sub-array represents one stroke:
{
"strokes": {
"strokes": {
"x": [[x1_stroke1, x2_stroke1, ...], [x1_stroke2, ...]],
"y": [[y1_stroke1, y2_stroke1, ...], [y1_stroke2, ...]]
}
}
}
strokes Strokes in JSON with appropriate format
strokes_session_id Stroke session ID returned included by app token API call
All other request params from v3/text are supported.
strokes_session_id must be sent along with the app_token as an auth header, see app tokens. Strokes sessions (digital ink with live updating results) are billed differently from v3/strokes requests without intermediate results, see Mathpix OCR pricing.
Response body
request_id Request ID, for debugging purposes
text Recognized text format, if such is found
latex_styled Math LaTeX string, if the input is a single equation
confidence Estimated probability 100% correct
confidence_rate Estimated confidence of output quality
is_printed Whether printed content was detected
is_handwritten Whether handwritten content was detected
auto_rotate_confidence Confidence that the input needs rotation
auto_rotate_degrees Rotation angle applied
data List of Data objects
html Annotated HTML output
version Model version used for processing