For the complete documentation index, see llms.txt. This page is also available as Markdown.

OCR

Ocr

post

Extracts text from files using OCR.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body
documentany ofRequired

Document to run OCR on.

or
document_annotation_promptstring · nullableOptional

Optional prompt to guide the model in extracting structured output from the entire document. A document_annotation_format must be provided.

extract_footerbooleanOptional

Whether to extract the footer of the document.

Default: false
extract_headerbooleanOptional

Whether to extract the header of the document.

Default: false
image_limitinteger · nullableOptional

Max images to extract

image_min_sizeinteger · nullableOptional

Minimum height and width of image to extract

include_image_base64boolean · nullableOptional

Include image URLs in response

modelstring · nullableOptional

The model to use for the OCR.

pagesinteger[] · nullableOptional

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.

table_formatstring · enum · nullableOptional

Format for table extraction: 'markdown' (default) or 'html'.

Possible values:
Other propertiesanyOptional
Responses
200

Successful Response

application/json
modelstringRequired
document_annotationany of · nullableOptionalDefault: ~?~unset~?~sentinel~?~
stringOptional
or
nullOptional
or
object · UnsetOptional
idstringRequired

The ID of the OCR request.

post/v1/ocr
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?