> For the complete documentation index, see [/llms.txt](/llms.txt).

> Source: /api/parse/document-ocr

# Document OCR API

OpenAPI spec: `./openapi/openapi-document-digitization-ocr.yaml`

- `POST /document-digitization`

<br />

## Response

**Functionality overview**

- **Data hierarchy:** The API currently supports the hierarchy of document, page, and words.
- **Unknown characters:** Characters that the model detects but cannot recognize are considered "unknown characters" and are marked by the character `�`.
- **Response time:** Files with less than 30 words take approximately two seconds. Longer documents can take up to tens of seconds.
- **Timeout:** There is a server-side 3 minute timeout for all requests.

**Return values**

<table><tbody><tr><td><strong>apiVersion</strong> string<br />
A string representing the version of the API being used. A bump in the major version indicates a backward-incompatible update, while a minor version increase signifies a backward-compatible update.</td></tr><tr><td><strong>confidence</strong> float<br />
A float value between 0 and 1, representing the overall confidence score for the entire document. A higher value indicates greater confidence in the accuracy of the document's content.</td></tr><tr><td><strong>mimeType</strong> string<br />
The MIME type of the input file (e.g., "multipart/form-data").</td></tr><tr><td><strong>modelVersion</strong> string<br />
A string representing the version of the model being used.</td></tr><tr><td><strong>numBilledPages</strong> integer<br />
The total count of pages in the input file that have been processed and are chargeable.</td></tr><tr><td><strong>pages</strong> list<br />
A list of page objects containing information about the words on each page and the overall confidence for the page.</td></tr><tr><td><strong>pages\[].confidence</strong> float<br />
A float value between 0 and 1, representing the overall confidence score for the entire page. A higher value indicates greater confidence in the accuracy of the page's content.</td></tr><tr><td><strong>pages\[].height</strong> integer<br />
The height of the page in pixels.</td></tr><tr><td><strong>pages\[].width</strong> integer<br />
The width of the page in pixels.</td></tr><tr><td><strong>pages\[].text</strong> string<br />
A string representing the text of the entire page, typically created by concatenating the individual words' serialized texts.</td></tr><tr><td><strong>pages\[].words</strong> list<br />
A list of word objects within a page, each containing information about the word's text, confidence score, and bounding box.</td></tr><tr><td><strong>pages\[].words\[].text</strong> string<br />
A string representing the text of the word.</td></tr><tr><td><strong>pages\[].words\[].confidence</strong> float<br />
A float value between 0 and 1, representing the confidence score for the word's detection and recognition. A higher value indicates greater confidence in the accuracy of the word.</td></tr><tr><td><strong>\*.id</strong> integer<br />
The unique identifier for an object.</td></tr><tr><td><strong>\*.boundingBox</strong> object<br />
An object containing information about the bounding box of a word, defined by the vertices of the box.</td></tr><tr><td><strong>\*.vertices</strong> list<br />
A list of vertices (x, y coordinates) that define the corners of the bounding box.</td></tr><tr><td><strong>\*.x</strong> integer<br />
The x-coordinate of a vertex in the bounding box.</td></tr><tr><td><strong>\*.y</strong> integer<br />
The y-coordinate of a vertex in the bounding box.</td></tr><tr><td><strong>stored</strong> boolean<br />
A boolean indicating whether the input was stored. If <code>true</code>, the data has been stored. If <code>false</code> the data has been discarded instantly.</td></tr><tr><td><strong>text</strong> string<br />
A string representing the text of the entire document, typically created by concatenating the pages' serialized texts.</td></tr><tr><td><strong>metadata</strong> object<br />
An object containing metadata about a document, such as page size and page numbers.</td></tr></tbody></table>

## Example

### Request

<figure>

![Printed text reading 'Print the words hello, world' used as the input image](/assets/images/docs/hello.png)

<figcaption>hello.png</figcaption>

</figure>

_Request/response examples: document-ocr / request_

### Response

_Example: document-ocr / response-200 / default_