Process Equations (deprecated)
warning
Deprecated - use v3/text instead.
Legacy endpoint for processing equation images. Returns recognized LaTeX in multiple output formats.
POST v3/latex
POST api.mathpix.com/v3/latex
Process a single equation image and return recognized LaTeX in multiple output formats. Accepts an image URL or file upload. Use v3/text instead for new integrations.
Example
- cURL
- Python
- JavaScript / TypeScript
- Go
- Java
curl -X POST https://api.mathpix.com/v3/latex \
-H 'app_id: APP_ID' \
-H 'app_key: APP_KEY' \
-H 'Content-Type: application/json' \
--data '{"src": "https://cdn.mathpix.com/examples/equation.jpg", "formats": ["latex_simplified", "text"]}'
import requests
r = requests.post("https://api.mathpix.com/v3/latex",
json={
"src": "https://cdn.mathpix.com/examples/equation.jpg",
"formats": ["latex_simplified", "text"]
},
headers={
"app_id": "APP_ID",
"app_key": "APP_KEY",
"Content-type": "application/json"
}
)
print(r.json())
const response = await fetch("https://api.mathpix.com/v3/latex", {
method: "POST",
headers: {
app_id: "APP_ID",
app_key: "APP_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
src: "https://cdn.mathpix.com/examples/equation.jpg",
formats: ["latex_simplified", "text"],
}),
});
const result = await response.json();
console.log(result);
body := bytes.NewBufferString(`{
"src": "https://cdn.mathpix.com/examples/equation.jpg",
"formats": ["latex_simplified", "text"]
}`)
req, _ := http.NewRequest("POST", "https://api.mathpix.com/v3/latex", body)
req.Header.Set("app_id", "APP_ID")
req.Header.Set("app_key", "APP_KEY")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
HttpClient client = HttpClient.newHttpClient();
String body = """
{
"src": "https://cdn.mathpix.com/examples/equation.jpg",
"formats": ["latex_simplified", "text"]
}
""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.mathpix.com/v3/latex"))
.header("app_id", "APP_ID")
.header("app_key", "APP_KEY")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());