OCR
Document to run OCR on.
Optional prompt to guide the model in extracting structured output from the entire document. A document_annotation_format must be provided.
Whether to extract the footer of the document.
falseWhether to extract the header of the document.
falseMax images to extract
Minimum height and width of image to extract
Include image URLs in response
The model to use for the OCR.
Specific pages to process. Accepts a list of integers or a string of comma-separated numbers and ranges (e.g. '0,1,2' or '0-5' or '0,2-4'). Page numbers start from 0.
Format for table extraction: 'markdown' (default) or 'html'.
Successful Response
~?~unset~?~sentinel~?~The ID of the OCR request.
Model not found.
Wrong model type.
Model is too busy, please try again later.
POST /v1/ocr HTTP/1.1
Host: albert.api.etalab.gouv.fr
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 815
{
"bbox_annotation_format": {
"type": "text",
"json_schema": {
"name": "text",
"schema": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"strict": false,
"description": "text",
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"document": {
"document_name": "text",
"document_url": "text",
"type": "document_url",
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"document_annotation_format": {
"type": "text",
"json_schema": {
"name": "text",
"schema": {
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"strict": false,
"description": "text",
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"document_annotation_prompt": "text",
"extract_footer": false,
"extract_header": false,
"image_limit": 1,
"image_min_size": 1,
"include_image_base64": true,
"model": "text",
"pages": [
1
],
"table_format": "markdown",
"ANY_ADDITIONAL_PROPERTY": "anything"
}{
"pages": [
{
"index": 1,
"markdown": "text",
"images": [
{
"id": "text",
"top_left_x": 1,
"top_left_y": 1,
"bottom_right_x": 1,
"bottom_right_y": 1,
"image_base64": "~?~unset~?~sentinel~?~",
"image_annotation": "~?~unset~?~sentinel~?~"
}
],
"dimensions": {
"dpi": 1,
"height": 1,
"width": 1
},
"tables": [
{
"id": "text",
"content": "text",
"format": "markdown"
}
],
"hyperlinks": [
"text"
],
"header": "~?~unset~?~sentinel~?~",
"footer": "~?~unset~?~sentinel~?~"
}
],
"model": "text",
"usage_info": {
"pages_processed": 1,
"doc_size_bytes": "~?~unset~?~sentinel~?~"
},
"document_annotation": "~?~unset~?~sentinel~?~",
"id": "text",
"usage": {
"prompt_tokens": 0,
"completion_tokens": 0,
"total_tokens": 0,
"cost": 0,
"impacts": {
"kWh": 0,
"kgCO2eq": 0,
"ANY_ADDITIONAL_PROPERTY": "anything"
},
"requests": 0,
"ANY_ADDITIONAL_PROPERTY": "anything"
}
}Last updated
Was this helpful?