> ## Documentation Index
> Fetch the complete documentation index at: https://docs.noxus.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Document AI

> Connect a Document AI OCR processor to read text and layout from documents

Google Document AI reads scanned and digital documents and returns every word and line with its position on the page and a confidence score. Noxus uses it as an **OCR provider**: document extraction fills your fields with the language model, and the boxes that show a reviewer where each value is printed come from Document AI.

The processing runs in **your own Google Cloud project**, in the region you choose, and Google bills that project directly.

## What you need

* A Google Cloud project with billing enabled.
* An **Enterprise Document OCR** processor in that project. Other processor types, such as Invoice Parser or Custom Extractor, are refused, because they do not return line-level positions.
* A service account key from the same project that can use the processor.

## Set it up

<Steps>
  <Step title="Enable the Document AI API">
    In [Google Cloud Console](https://console.cloud.google.com), open **APIs & Services → Library**, search for **Cloud Document AI API**, and click **Enable**.
  </Step>

  <Step title="Create an OCR processor">
    Open **Document AI → Processor gallery**, choose **Enterprise Document OCR**, and create it. Pick the region that matches your data residency: **eu** or **us**. One OCR processor per region is enough; Noxus finds it by itself.
  </Step>

  <Step title="Create a service account and key">
    Open **IAM & Admin → Service Accounts**, create a service account for Noxus, and grant it the **Document AI Viewer** role (`roles/documentai.viewer`) on the project. Noxus needs this role to find and check the processor, and to send documents to it. Then open **Keys → Add Key → Create new key → JSON** and download the key file.
  </Step>

  <Step title="Connect it in Noxus">
    Open **Workspace control → Connections**, click **Add connection**, and choose **Google Document AI**. Choose the **Location** of the processor and paste the whole key file into **Service account JSON**. Noxus reads the project from the key.

    Leave **OCR processor ID** empty unless the project has several OCR processors in that location. In that case, copy the ID of the one to use from the processor's details page in the Document AI console.

    Noxus checks the processor when you save. On success the status is **Active**, and the connection's **Metadata** tab shows the project, the processor that was used with its ID and version, and the service account's email. The key itself is never shown again.
  </Step>
</Steps>

## When the connection is Invalid

The status shows **Invalid**, and the connection's **Metadata** tab shows the reason:

| Reason | What to do |
| :- | :- |
| Service account JSON is not valid JSON | Paste the whole key file, including the braces. |
| Service account JSON must contain client\_email, private\_key and project\_id | Use a service account key file, not another JSON file. |
| No enabled Enterprise Document OCR processor in ... | Create an Enterprise Document OCR processor in that project and location, or check the location. |
| Several Enterprise Document OCR processors in ... | Enter the ID of the one to use in **OCR processor ID**. The message lists the IDs. |
| Processor ... was not found | Check the processor ID, and that the location matches the processor's region. The processor must be in the key's project. |
| Processor type is ...; an Enterprise Document OCR processor is required | Create an Enterprise Document OCR processor and use its ID. |
| Processor is disabled, not enabled | Enable the processor in the Document AI console. |
| The service account needs the Document AI Viewer role in this project | Grant the service account the Document AI Viewer role on the project. |

## Limits

* Google reads at most **15 pages** per request, so Noxus sends longer PDFs in parts of 15 pages. Each part can be up to **40 MB**.
* Pricing follows Google's Document AI OCR price list and is charged to your project.
