Skip to main content

Process Stroke Data

Process handwriting stroke coordinates directly, without needing to generate an image first. Supports the same options as image processing but with lower latency.

Send stroke data

Send stroke data to the v3/strokes endpoint. Strokes are represented as arrays of x and y coordinates, where each sub-array is one continuous stroke.

info

The request body has a double-nested strokes key:

  • The outer strokes is the API parameter name
  • The inner strokes contains the coordinate data (x and y arrays)

The example below sends four strokes that form the handwritten expression 3x23x^2:

Visualization of the four strokes in the example request. Each polyline is one continuous stroke rendered from the x and y coordinate arrays.
{
"strokes": {
"strokes": {
"x": [
[131,131,130,130,131,133,136,146,151,158,161,162,162,162,162,159,155,147,142,137,136,138,143,160,171,190,197,202,202,202,201,194,189,177,170,158,153,150,148],
[231,231,233,235,239,248,252,260,264,273,277,280,282,283],
[273,272,271,270,267,262,257,249,243,240,237,235,234,234,233,233],
[296,296,297,299,300,301,301,302,303,304,305,306,306,305,304,298,294,286,283,281,281,282,284,284,285,287,290,293,294,299,301,308,309,314,315,316]
],
"y": [
[213,213,212,211,210,208,207,206,206,209,212,217,220,227,230,234,236,238,239,239,239,239,239,239,241,247,252,259,261,264,266,269,270,271,271,271,270,269,268],
[231,231,232,235,238,246,249,257,261,267,270,272,273,274],
[230,230,230,231,234,240,246,258,268,273,277,281,281,283,283,284],
[192,192,191,189,188,187,187,187,188,188,190,193,195,198,200,205,208,213,215,215,215,214,214,214,214,216,218,220,221,223,223,223,223,221,221,220]
]
}
}
}
Example response
{
"request_id": "cea6b8e4-0ab4-550a-c467-ce2eb00430be",
"is_printed": false,
"is_handwritten": true,
"auto_rotate_confidence": 0.0020149118193977245,
"auto_rotate_degrees": 0,
"confidence": 1,
"confidence_rate": 1,
"latex_styled": "3 x^{2}",
"text": "\\( 3 x^{2} \\)",
"version": "SuperNet-109p4"
}

In the example response, the latex_styled field renders as:

3x23 x^{2}

Live stroke sessions

For live digital ink with updating results (e.g., in a mobile app), use app tokens with stroke sessions:

  1. Get an app_token with strokes_session_id from your server:
POST /v3/app-tokens
{
"include_strokes_session_id": true,
"expires": 300
}
  1. Use the app_token and strokes_session_id in client requests to v3/strokes.

Live stroke sessions are billed differently from standalone requests — see pricing. You are billed the first time strokes are sent for a session, not when requesting the token.

Next steps