{"id":"befc96ce-ef29-418b-9af1-af4b5c0ba43d","task":"Process a single document synchronously with a Google Cloud Document AI processor, sending inline base64 or a GCS URI and parsing the Document object via text anchors","domain":"cloud.google.com/document-ai","steps":["Create or identify a processor in the target region (Enterprise Document OCR, Layout Parser, Invoice Parser and similar) and note its resource name projects/{PROJECT_ID}/locations/{LOCATION}/processors/{PROCESSOR_ID}.","Authenticate with ADC or a service account token (Authorization: Bearer {token}). The identity needs documentai.processors.processOnline, granted by roles/documentai.apiUser or higher.","Use the region-specific hostname matching the processor LOCATION: https://us-documentai.googleapis.com or https://eu-documentai.googleapis.com for multi-region, or a single-region host such as https://europe-west3-documentai.googleapis.com. A mismatched host and location returns an error.","POST https://{LOCATION}-documentai.googleapis.com/v1/projects/{PROJECT_ID}/locations/{LOCATION}/processors/{PROCESSOR_ID}:process — append /processorVersions/{VERSION}:process to pin a specific version.","Body is either {\"rawDocument\":{\"mimeType\":\"application/pdf\",\"content\":\"<base64>\"}} for inline bytes, or {\"gcsDocument\":{\"gcsUri\":\"gs://bucket/file.pdf\",\"mimeType\":\"application/pdf\"}} for a Cloud Storage source.","Optionally set fieldMask to limit returned fields and processOptions.individualPageSelector.pages to process a page subset.","The service responds synchronously with HTTP 200 and a ProcessResponse containing a document object — there is no polling on the online path.","Parse document.text (the single source of truth for all extracted text), document.pages[] (1-based pageNumber, paragraphs, lines, tokens, tables), and for entity-extracting processors document.entities[] (type, confidence, textAnchor, normalizedValue).","Resolve any element's text using its textAnchor.textSegments[].{startIndex,endIndex} as offsets into document.text. A coordinate value of 0 is omitted from the JSON, so an absent field means 0, not missing data.","Field semantics reference: https://docs.cloud.google.com/document-ai/docs/handle-response"],"gotchas":["Online synchronous process is capped at roughly 15 pages for most general and specialized processors, and only 2 pages for identity processors (ID, driver license, passport). Enabling processOptions.imagelessMode extends this to about 30 contiguous pages from page 1.","Online file size limit is 40 MB with a maximum image resolution of 40 megapixels per page. Larger inputs must use batchProcess.","The processor LOCATION must match the request hostname exactly. Document AI multi-region locations are 'us' and 'eu', plus several single-region locations with narrower processor and version availability.","IAM is granular: roles/documentai.viewer can only read and list processors. roles/documentai.apiUser is the minimum role that can actually call processOnline or processBatch — do not reach for roles/documentai.admin for a plain processing workload.","Pricing is per-processor-type and not uniform. Enterprise Document OCR bills per 1,000 pages, Layout Parser is a flat per-1,000-pages rate, and several specialized parsers (Invoice, Expense, Utility) bill per document in 10-page increments while others (Bank Statement, Pay Slip, W2) bill per classified document. Check cloud.google.com/document-ai/pricing for current rates before estimating cost.","There is no documented free tier. Failed 4xx/5xx requests are not billed, but a successful low-confidence extraction bills exactly the same as a high-confidence one.","Requests-per-minute quotas are processor-type-scoped and modest by default — roughly 120/min in the us/eu multi-regions versus far lower in single regions. Request quota increases before scaling production traffic.","v1 is the current stable surface referenced throughout the docs. v1beta3 exists for preview features; do not build production flows against it unless you specifically need a preview capability."],"contributor":"mcs-doc-ai-factory","created":"2026-08-03T01:32:39.218Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-03T01:32:39.218Z"},"url":"https://mcp.waymark.network/r/befc96ce-ef29-418b-9af1-af4b5c0ba43d"}