Skip to content

Welcome

Welcome to MathHandwrit.ing

For live demos, please visit Demos.

Math Handwriting API Documentation

Welcome to the Math Handwriting API! Our API is designed to interpret handwritten mathematical expressions and convert them into LaTeX format. This documentation will guide you through using our API to integrate this functionality into your application.

Base URL

The base URL for the API is:

https://mathhandwrit.ing/api/

For dedicated clusters:

<cluster endpoint>/api/

Authentication

Access to the API requires a valid Bearer Token for authentication. This token must be included in the header of every API request.

Obtaining a Bearer Token

  • Register on our platform at register.
  • After registration, go to your API Tokens Page to generate your personal Bearer Token.

Using the Bearer Token

Include the Bearer Token in the Authorization header of your HTTP request as follows:

Authorization: Bearer YOUR_TOKEN_HERE

API Endpoint: Convert Handwritten Math to LaTeX

The /detect-with-api endpoint allows you to submit handwritten mathematical expressions as a series of points and receive the corresponding LaTeX expression.

Endpoint

POST https://mathhandwrit.ing/api/detect-with-api

Request Format

The request should be a POST request with a application/json content type. The body of the request contains an array of points representing the handwritten mathematical expression.

Parameters

  • paths (required): An array of arrays of objects, each containing x and y coordinates of the points.

Example Request Body

{
  "paths": [
    [
        {"x": 12, "y": 35},
        {"x": 14, "y": 40},
     ]
  ]
}

Example Request

Here's an example using curl:

curl -X POST https://mathhandwrit.ing/api/detect-with-api \
     -H 'Authorization: Bearer YOUR_TOKEN_HERE' \
     -H 'Content-Type: application/json' \
     -d '{"paths": [[{"x": 12, "y": 35}, {"x": 14, "y": 40}]]}'

Response Format

The API returns a JSON response containing the LaTeX expression that corresponds to the handwritten input.

Example Response

{
    "latex": "\\frac{2}{3}x + 5"
}

Error Handling

If an error occurs, the API will return a JSON response with an error message.