Query Image Results
Search and list results from previous v3/text, v3/pdf, v3/strokes, and v3/latex requests.
GET v3/ocr-results
GET api.mathpix.com/v3/ocr-results
The search request must be authenticated the same way OCR requests are. See Authorization.
Requests with the improve_mathpix metadata field set to false will not appear in the search results.
This endpoint will only work with API keys created after July 5th, 2020.
Example
- cURL
- Python
- JavaScript / TypeScript
- Go
- Java
# Example: Query image OCR results with pagination, tag filters, and handwriting detection
curl -X GET -H 'app_key: APP_KEY' \
'https://api.mathpix.com/v3/ocr-results?from_date=2021-07-02T18%3A48%3A25.769285%2B00%3A00&page=1&per_page=10&tags=test_tag2&tags=test_tag3&is_handwritten=True'
# Example: Query image OCR results with pagination, tag filters, and handwriting detection
import requests
url = "https://api.mathpix.com/v3/ocr-results"
headers = {
"app_key": "APP_KEY",
}
params = {
"from_date": "2021-07-02T18:48:25.769285+00:00",
"page": 1,
"per_page": 10,
"tags": ["test_tag2", "test_tag3"],
"is_handwritten": True,
}
response = requests.get(url, headers=headers, params=params, timeout=30)
print(response.json())
// Example: Query image OCR results with pagination, tag filters, and handwriting detection
const params = new URLSearchParams({
from_date: "2021-07-02T18:48:25.769285+00:00",
page: "1",
per_page: "10",
is_handwritten: "True",
});
params.append("tags", "test_tag2");
params.append("tags", "test_tag3");
const response = await fetch(
`https://api.mathpix.com/v3/ocr-results?${params}`,
{
headers: {
app_key: "APP_KEY",
},
}
);
const result = await response.json();
console.log(JSON.stringify(result, null, 2));
// Example: Query image OCR results with pagination, tag filters, and handwriting detection
req, _ := http.NewRequest("GET",
"https://api.mathpix.com/v3/ocr-results?from_date=2021-07-02T18%3A48%3A25.769285%2B00%3A00&page=1&per_page=10&tags=test_tag2&tags=test_tag3&is_handwritten=True",
nil)
req.Header.Set("app_key", "APP_KEY")
resp, _ := http.DefaultClient.Do(req)
defer resp.Body.Close()
result, _ := io.ReadAll(resp.Body)
fmt.Println(string(result))
// Example: Query image OCR results with pagination, tag filters, and handwriting detection
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.mathpix.com/v3/ocr-results?from_date=2021-07-02T18%3A48%3A25.769285%2B00%3A00&page=1&per_page=10&tags=test_tag2&tags=test_tag3&is_handwritten=True"))
.header("app_key", "APP_KEY")
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
{
"ocr_results": [
{
"timestamp": "2021-07-02T18:48:46.080Z",
"endpoint": "/v3/text",
"request_args": {
"tags": ["test_tag2", "test_tag3"],
"formats": ["text"]
},
"result": {
"text": "\\( 12+5 x-8=12 x-10 \\)",
"confidence": 1,
"is_printed": false,
"request_id": "a4301400-f66b-9821-d35c-babea8a26992",
"is_handwritten": true,
"confidence_rate": 1,
"auto_rotate_degrees": 0,
"auto_rotate_confidence": 0.0027393347044402105,
"version": "SuperNet-109p4"
},
"detections": {
"contains_algorithm": false,
"contains_chemistry": false,
"contains_diagram": false,
"is_handwritten": true,
"is_printed": false,
"contains_table": false,
"contains_triangle": false
},
"image_id": "a4301400-f66b-9821-d35c-babea8a26992"
}
]
}
Request Parameters
page First page of results to return (max page 10000)
per_page Number of results to return
from_date starting (included) ISO datetime
to_date ending (excluded) ISO datetime
app_id results for the given app_id
text result.text contains the given string
text_display result.text_display contains the given string
latex_styled result.latex_styled contains the given string
tags an array of tag strings
is_printed All results that contain printed text/math are included
is_handwritten All results that contain handwritten text/math are included
contains_table All results that contain a table are included
contains_chemistry All results that contain chemistry diagrams are included
contains_diagram All results that contain diagrams are included
contains_triangle All results that contain triangles are included
contains_algorithm All results that contain algorithms are included
Response body
ocr_results List of OcrResult objects
Type definitions
OcrResult object
timestamp ISO timestamp of recorded result information
endpoint API endpoint used for upload (e.g. /v3/text, /v3/strokes)
image_id Unique identifier for the image result
duration Difference between timestamp and when request was received. May not be present in all responses.
request_args Request body arguments
result Result body for request
detections An object of detections for each request