canonical: https://jentic.com/apis/googleapis.com/documentai

# Google Cloud Document AI API

Google Cloud Document AI parses structured information from unstructured and semi-structured documents using Google's pretrained processors for forms, invoices, receipts, contracts, and identity documents. The API supports synchronous processing for single documents and batch processing for large volumes, with optional human-in-the-loop review for low-confidence extractions. Custom processors can be deployed, undeployed, evaluated, and trained against project-specific document types. Operations are scoped under projects, locations, and processors with full lifecycle management for processor versions.

## For AI agents

Extract structured fields, tables, and entities from PDFs, scans, and images using Google's pretrained or custom Document AI processors with optional human review.

## Scope

Does not handle document storage, document signing, or generating new documents - use for extracting structured fields from existing documents only.

## Capabilities

- Process a single document synchronously through a Document AI processor and receive extracted entities, tables, and form fields
- Submit batch document processing jobs across Cloud Storage inputs and poll long-running operations until completion
- Deploy, undeploy, enable, or disable processor versions to control which model serves production traffic
- Trigger human review on low-confidence extractions via reviewDocument and retrieve the reviewer-corrected output
- List available processor types per location and create processors for invoices, receipts, contracts, or custom schemas
- Evaluate a processor version against a labelled dataset and retrieve precision, recall, and F1 metrics

## Use cases

### Invoice Data Extraction at Scale

Accounts payable teams use Cloud Document AI to extract supplier name, invoice number, line items, tax, and totals from incoming PDF and image invoices, replacing manual keying. The Invoice processor handles multi-page documents, multi-currency totals, and tabular line-item parsing in one synchronous call, with batchProcess for nightly runs over Cloud Storage. Typical end-to-end automation, including downstream ERP posting, takes a few weeks rather than building OCR pipelines from scratch.

Example prompt: Call POST /v1/{processor}:process on the Invoice processor with a base64-encoded PDF and return the extracted total amount and line items as JSON.

### ID and Form Verification for Onboarding

Fintech and marketplace onboarding flows route uploaded identity documents and signed forms through Document AI to extract names, dates of birth, document numbers, and signature blocks. Low-confidence extractions are routed to human reviewers via reviewDocument, with the corrected output returned for downstream KYC. This replaces brittle template-based OCR and reduces manual review queues by routing only ambiguous fields to humans.

Example prompt: Process a passport image with the ID processor, and if confidence on the document number is below 0.9, submit a reviewDocument request and poll until the human-corrected output is returned.

### Custom Processor Training for Domain Documents

Teams with proprietary document types (loan applications, medical claims, leases) train custom Document AI processors on labelled examples and evaluate accuracy against held-out sets. The API supports creating processor versions, evaluating them with metrics endpoints, and deploying the best-performing version to production. Initial training and evaluation can be wired into an MLOps pipeline in a few days.

Example prompt: Train a new processor version against the labelled dataset in gs://my-bucket/labels, evaluate it, and if the F1 exceeds 0.92, call deploy on the new version.

### Agent-Driven Document Workflows via Jentic

AI agents that need to reason over uploaded documents call Cloud Document AI through Jentic to extract structured data before answering questions or taking actions. The agent searches for the right processor operation by intent, loads the request schema, and submits the document, all without browsing Google Cloud documentation or hard-coding endpoint paths.

Example prompt: Search Jentic for 'extract fields from a document', load the documentai process operation schema, and execute it against an uploaded contract PDF.

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| POST | /v1/{+name}:batchProcess | Submit batch document processing across Cloud Storage inputs |
| POST | /v1/{+name}:deploy | Deploy a processor version to serve production traffic |
| POST | /v1/{+name}:disable | Disable a processor without deleting it |
| POST | /v1/{+humanReviewConfig}:reviewDocument | Send a document for human review |
| GET | /v1/{+name} | Get a processor, processor version, or operation by name |
| POST | /v1/{+name}:cancel | Cancel an in-flight long-running operation |

## Key resources

- **Processors** — Create, list, get, delete, enable, and disable processors that extract structured data from documents
- **Processor Versions** — Train, evaluate, deploy, and undeploy specific versions of a processor
- **Processor Types** — List the catalogue of available pretrained processor types per location
- **Documents** — Process documents synchronously, submit batches, and request human review
- **Operations** — Poll long-running batch and training operations and cancel in-flight jobs

## Why Jentic

- **Setup:** Wiring the Document AI API by hand means standing up Google OAuth2 with the right scopes, targeting documentai.googleapis.com, and building the resource-path calls yourself for processors and field extraction. Through Jentic you install once, import the Document AI API from the API Directory, store the OAuth credential once, and your agent calls it.
- **Permission scoping:** Document AI puts the resource name in the URL path (/v1/{+name}, /v1/{+humanReviewConfig}), so a rule can pin your agent to one processor: it can batch process documents and read the processor there and nothing else. You choose the operations it may call, so state-changing ones like deploy or disable are not included unless you add them.
- **Credential handling:** Your Google OAuth credential for Document AI is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'extract fields from an invoice' or 'batch process documents with a processor', and Jentic returns the matching Document AI operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **Cloud Storage API** — Stores input documents and batch output JSON for Document AI
- **Cloud KMS API** — Manages encryption keys for documents at rest
- **Vertex AI API** — General-purpose ML platform for custom vision and text models

## FAQ

### What authentication does the Cloud Document AI API use?

Document AI uses Google OAuth 2.0 with the cloud-platform scope. Tokens are obtained from a service account or end-user OAuth flow and passed in the Authorization header as a Bearer token. Through Jentic, the service account JSON is stored encrypted in the credential vault and never enters the agent context.

### Can I run a custom document parser on the Cloud Document AI API?

Yes. Create a processor of a custom type, train a processor version against labelled examples, and call deploy on the version that wins evaluation. The same /v1/{+name}:process endpoint serves custom and pretrained processors.

### What are the rate limits for the Cloud Document AI API?

Default quotas are 600 process requests per minute per processor and a per-project page-processing quota that varies by region. Quotas can be increased from the Cloud Console quotas page. Batch operations consume the same page-level quota over the course of the job.

### How do I batch-process invoices with Cloud Document AI through Jentic?

Search Jentic for 'batch process documents', load the schema for POST /v1/{+name}:batchProcess, and execute it with a Cloud Storage input prefix and output bucket. Jentic returns the long-running operation name; poll the operations.get endpoint for completion.

### Is the Cloud Document AI API free?

No. Pricing is per-page and varies by processor type. The first 1,000 pages per month for some processors are free. See https://cloud.google.com/document-ai/pricing for current rates.

### How do I trigger human review for a low-confidence document?

Call POST /v1/{+humanReviewConfig}:reviewDocument with the inline document or Cloud Storage URI. The endpoint returns a long-running operation; when it resolves, the human-corrected document JSON is available at the operation response.

### Can I limit what my agent is allowed to do with the Cloud Document AI API?

Yes. Because Cloud Document AI puts the resource name in the URL path, such as /v1/{+name} and /v1/{+humanReviewConfig}, your self-hosted Jentic One instance lets you write rules that pin the agent to a single processor so it can batch process documents and read that processor and nothing else. You decide which operations it may call, so state-changing calls like deploy or disable stay out of reach unless you explicitly add them. Credentials are injected at execution time by your own instance and are never exposed to the agent.
