CloudBrum
CloudBrum · Cloud decision-support platform
Google Cloud AI and machine learning

Document AICreatedLast reviewedReading time~17 minLevelBeginner to advanced

Google Cloud · AI and machine learning · Document processors

Document AI processes documents through a processor that you create in a Google Cloud project and location. The processor type defines the task: OCR, invoice parsing or custom extraction, for example. An Invoice Parser returns entities such as amounts and supplier details, while an OCR processor focuses on document text. Decide on the required output first; the API endpoint and the processor version are part of that decision, not interchangeable connection settings.

On this page (17 sections)

    Mind map: Document AI at a glance

    Document AI mind map Document AI at a glance: Select a task: Enterprise OCR, Invoice Parser, Custom extraction; Create a processor: Project and location, Processor type, Tested version; Send documents: Online for small inputs, Batch through Storage, Operation status; Read results: Document text, Entities and normalization, Page layout references; Measure errors: Required entity checks, Supplier samples, Reviewer corrections; IAM and residency: Short-lived credentials, Regional endpoint, Bucket access scope; Cost controls: Pages by processor, Avoid duplicate calls, Count review time; Integration: Schema mapping, Versioned results, Idempotent writes. Google Cloud Document AI at a glance A processor, its location and its version define the extraction you run CloudBrum Cloud decision-support platform CloudBrum Enterprise OCR Invoice Parser Custom extraction Select a task Project and location Processor type Tested version Create a processor Online for small inputs Batch through Storage Operation status Send documents Document text Entities and normalization Page layout references Read results Required entity checks Supplier samples Reviewer corrections Measure errors Short-lived credentials Regional endpoint Bucket access scope IAM and residency Pages by processor Avoid duplicate calls Count review time Cost controls Schema mapping Versioned results Idempotent writes Integration Document AI17-point analysis CloudBrum· 17-point cloud service analysis cloudbrum.com
    CloudBrum Document AI at a glance · 17-point analysis Select a task Enterprise OCR Invoice Parser Custom extraction Create a processor Project and location Processor type Tested version Send documents Online for small inputs Batch through Storage Operation status Read results Document text Entities and normalization Page layout references Measure errors Required entity checks Supplier samples Reviewer corrections IAM and residency Short-lived credentials Regional endpoint Bucket access scope Cost controls Pages by processor Avoid duplicate calls Count review time Integration Schema mapping Versioned results Idempotent writes CloudBrum · cloudbrum.com

    Free to share. The downloaded image includes the CloudBrum link.

    Key features (summary)

    • Processors are task-specific resourcesChoose an OCR processor when you need text, or a supported pretrained parser when you need named entities from a particular document category. Changing a processor type is a design choice, not a flag that turns any OCR output into invoice fields.
    • Pretrained document parsingInvoice Parser can return header and line-item information. Inspect its supported entities and languages for the version you select; a processor being available in your project does not establish that it handles every supplier document.
    • Custom extraction and classificationCustom processors let teams target their own fields or document classes. Some processor versions support different customization methods, so compare the version documentation before committing to a labeling or training workflow.
    • Document structure accompanies textA result can include pages, layout anchors and extracted entities alongside the document text. Keeping those references gives the application a way to show where an answer came from rather than only displaying a detached value.
    • Online and batch processingOnline processing returns a result within the request. Batch processing runs as an operation with Cloud Storage inputs and outputs. A completed operation still needs a check of each input document’s status.
    • Location and IAM are explicitThe processor resource includes its location, and client requests use the matching endpoint. Call permission, service-agent storage access and the application’s output-reading permission are separate parts of a batch design.

    Basic concepts

    Processor and processor version
    A processor is a project resource for one processing task. Its versions identify the underlying model choices. Record the version used for an evaluation, and pin an approved version when reproducibility matters.
    Document and entities
    The response contains a Document object. A pretrained extractor may populate entities with types, mention text and normalized values; an OCR result is not expected to produce the same business entities.
    Text anchors
    Layout and entity references can point into document text through spans. Use the SDK’s documented conventions when resolving spans, and retain page locations for review rather than guessing positions from a flattened export.
    Normalized values
    An entity may have a typed normalized value, such as a date or money amount. Check that the expected normalized property actually exists; a missing currency is an unresolved data problem, not a reason to assume a default.
    Online versus batch limits
    The accepted size and page count depend on the processor and processing mode. Read the current quota and processor-version tables; there is no single page limit that describes every Document AI call.
    Endpoint location
    For a processor in us, use the US endpoint; for eu, use the EU endpoint. Google also lists selected single-region options, including Mumbai, but support is limited by processor and version.

    How to create & configure it

    Build a versioned invoice-processing request

    1. Write an entity contractChoose the invoice fields that a downstream record must contain, and describe how missing or conflicting totals are handled. Keep sample labels for those fields outside the test documents themselves.
    2. Choose a processor and supported locationInspect Invoice Parser’s language list and available versions. Create the processor in the intended location, then create input/output buckets there or in a compatible approved location for a later batch flow.
    3. Authorize only the needed workEnable the Document AI API and grant the calling identity the documented processing role. For batch processing, separately grant the service agent access to the relevant source and output prefixes.
    4. Run a small representative PDFPoint the client at the endpoint matching the resource location. The example invokes Invoice Parser online; use its actual processor ID and record the version used for the test.
    5. Map entities into a reviewable recordMatch entities by type, preserve mentions and page references, and validate normalized money and date fields. Ambiguous repeated totals belong in review rather than being resolved by whichever entity appeared last.
    6. Add batch processing and controlled releasesFor larger workloads, persist the operation name and inspect every per-document result. Read all output shards, associate them with their inputs and keep the final write idempotent. Re-evaluate before changing the default processor version.

    A batch output prefix is a collection of results, not a promise of one JSON file per submitted PDF. Code that downloads only the first object can lose pages or even associate one document’s output with another input.

    Common issues after configuration

    SymptomLikely causeWhat to check / fix
    A processor exists but the call cannot find itThe resource location and endpoint differ, or an ID from another project was usedCompare the full resource name with the client endpoint. A US processor is not available by sending the same name to an EU endpoint.
    The request is deniedThe caller lacks processing permission or batch storage access is incompleteTest the identity actually used by the worker. Distinguish the processing role from permissions needed by the service agent to read and write Cloud Storage objects.
    A PDF exceeds the accepted limitThe processor, version or online mode has a lower cap than the file requiresCheck the selected processor’s current tables and use the supported batch path when appropriate. Do not quote another processor’s limits as a guarantee for this one.
    A batch operation completes with missing documentsThe application checked only overall operation completionInspect the per-document statuses and output destinations. Retain failures with the original input reference, and retry only work whose state is understood.
    Amounts change after an upgradeThe default version or application entity mapping changedCompare version identifiers and the same labeled sample. Keep normalized values and raw mentions together so a model change can be separated from a conversion bug.
    Text is present but no invoice entities appearAn OCR processor was used instead of a document parser, or extraction found no usable entityCheck the processor type and response before attempting to map fields. Empty entities are not equivalent to a zero-value invoice.

    Use cases: when and where to use it

    Good fit

    • Invoice intake where a known pretrained parser covers the required language and fields.
    • Large document queues that can be processed through Cloud Storage-backed batches.
    • A project needs an explicit processor/version boundary for its extraction pipeline.
    • Custom extraction has enough labeled evaluation data and a clear business definition for each field.

    Consider something else

    • All that is needed is reliable text already embedded in a PDF: compare a normal PDF parser first.
    • A mixed media request needs general generative interpretation: compare the appropriate Gemini workflow separately.
    • An on-premises-only process cannot transmit its documents to a managed cloud API.
    • A document is being used for identity or payment approval: parsing its contents does not establish authenticity or authority.

    Pros: why consider it?

    Why teams choose it

    • Processor resources make it possible to separate different document tasks and their evaluation results.
    • Pretrained parsers can supply entity names and normalized values instead of leaving every field to string matching.
    • Batch output can fit an existing Cloud Storage ingestion and result-processing flow.
    • Google publishes processor/version availability tables, which provide a concrete basis for a regional design review.

    Trade-offs to weigh

    • Different processors have different limits, schemas and version lifecycles to manage.
    • A result-consuming application must handle entities, missing values and batch output structure.
    • Routing everything to the newest default model can silently change an established field mapping.
    • The service charge is only part of the cost when supplier formats produce substantial review work.

    Common threats, vulnerabilities & risks

    RiskSeverityWhy it mattersMitigation
    A wrong entity is posted to another systemHighSeveral numbers on a document may look like the intended total, even when OCR is readable.Check entity type, currency and arithmetic; use a controlled approval step before the record affects money.
    A processing location does not meet the data policyHighEndpoint and processor selection determine where the service runs, while batch storage adds another location boundary.Review the processor version and each storage location against policy before data is submitted.
    Output objects are mistaken for a complete batchMediumOne operation may produce multiple objects and document-level failures.Reconcile every input with its status and output shards before marking the intake batch complete.
    A changed default invalidates evaluation evidenceMediumA previous accuracy sample may describe a different model version.Record the tested processor version and run a fixed release sample before switching production traffic.
    Service-agent permissions are too broadHighA processor workflow can expose more documents than the application intended to submit.Scope storage access to the required buckets or prefixes and audit who can read exported results.
    Parsed text becomes trusted agent instructionsMediumThe original document can contain hostile instructions alongside legitimate business content.Keep extraction output as untrusted data and restrict any downstream agent’s tools and approval authority.

    Performance optimisation

    • Measure the delay to a validated entity record, including storage and output reading for batch jobs.
    • Use the endpoint for the processor location rather than relying on a global client default.
    • Throttle the number of active batch operations and document requests according to the actual project quotas.
    • Select a processor built for the required task instead of applying several unrelated parsers to every file.
    • Keep the request source readable and use a measured preparation step rather than repeatedly resending a poor scan.
    • Cache a completed result only with its input identity, processor version and processing options.

    Reduce monthly cost

    A processor-level budget helps explain which extraction task generated the bill. Pair that view with the number of usable records and the reviewer time needed to produce them.

    • Forecast pages by processor type and version, including failed experiments and retries where billed.
    • Compare online and batch terms on the pricing page instead of assuming batching is always cheaper.
    • Avoid repeated processing after a worker restart by recording the operation or completed result against the input.
    • Add Cloud Storage operations, retained JSON, orchestration and network charges to the forecast.
    • Report accepted records and reviewer time beside raw page counts; both influence the real cost of the workflow.
    • Retire unused custom versions and training artifacts in line with the team’s retention and reproducibility requirements.

    An OCR page rate is not an estimate for an invoice parser or a custom generative extractor. Use the price of the processor you will actually call and the volume tier that applies to its pages.

    Security optimisation

    • Use Application Default Credentials with a workload identity where possible; do not distribute service-account key files as application configuration.
    • Grant the application the needed processing role, and grant storage access separately for batch input/output.
    • Confirm processor and version support before depending on regional residency, VPC Service Controls or customer-managed encryption.
    • Keep source documents, raw text and entity exports behind appropriate Cloud Storage and application access controls.
    • Prevent extracted text from appearing in standard request logs, tracing attributes or public error messages.
    • Delete expired inputs and exports across the full workflow, including review copies and backups subject to legal retention.

    Governance & compliance

    Guardrails

    • Record the processor resource, model version, approved location and business owner.
    • Define a schema and acceptance tests before mapping a new entity type into a production record.
    • Review access granted to both the worker identity and the Document AI service agent.

    Operating checks

    • Reconcile submitted inputs with completed, failed and unresolved document results.
    • Track correction rates and missing entities by supplier and document class.
    • Monitor the quota, operation backlog and page spend for each active processor.

    Google states that customer data is not used to train its Document AI models. That statement does not define your application’s access policy or retention period. Confirm the current security documentation and the controls supported by the particular processor version you choose.

    Reduce carbon footprint

    • Avoid rerunning unchanged documents solely because their output reader failed; recover the stored result where possible.
    • Prefer existing structured input over converting it to an image and recognizing it again.
    • Set an output retention schedule so abandoned batch exports do not accumulate indefinitely.
    • Report carbon estimates at a defensible boundary. A project-wide estimate does not reveal the emissions of a particular invoice processor call.

    Pricing

    Purchase options

    OCR and layout Task-specific page rates

    Enterprise OCR and layout-oriented processing have pricing distinct from specialized business-document parsing.

    Pretrained parsers By parser and volume

    Invoice and other pretrained processors have their own page terms. Consult the current processor/version availability before estimating usage.

    Custom processors Training, hosting or processing terms

    The selected custom processor and model generation determine the charges. Include development and retained custom versions in the budget review.

    Online and batch Check both pricing paths

    Read the pricing page for the selected task and workload. Batch mode is an operation model, not a universal discount promise.

    What you actually pay for

    • Processed pages under the chosen processor’s current pricing rules.
    • Applicable custom training, deployment or version-related charges.
    • Cloud Storage for sources and outputs, API operations and surrounding workflow compute.
    • Manual verification and remediation for documents that do not yield a usable record.

    Check Google's Document AI pricing page against the exact processor and expected volume. Processor-specific billing rules differ, so this article does not present one rate as the price of all document extraction.

    Important code references

    This example uses a small synthetic PDF with an Invoice Parser. The CLI and Terraform tabs create the processor; Python calls it through a matching regional endpoint and saves the Document JSON. C# checks total_amount candidates in that export. Set up the calling identity separately. For a large-document batch, add Cloud Storage input/output permissions and explicit per-document reconciliation rather than stretching the online example beyond its limits.

    # Run with an identity allowed to enable the API and create processors.
    DOC_PROJECT=replace-with-your-project
    DOC_LOCATION=us
    # Google Cloud ADC for local SDK development is a separate sign-in from gcloud.
    gcloud services enable documentai.googleapis.com --project "$DOC_PROJECT"
    curl --fail-with-body --silent --show-error \
      -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      -H "Content-Type: application/json" \
      "https://${DOC_LOCATION}-documentai.googleapis.com/v1/projects/${DOC_PROJECT}/locations/${DOC_LOCATION}/processors" \
      --data '{"type":"INVOICE_PROCESSOR","displayName":"invoice-intake-demo"}'
    # Keep the returned processor resource name. Don't repeat this POST to retry analysis.
    # For local Python development, configure ADC with gcloud auth application-default login.
    # In production use the workload identity and a scoped Document AI processing role.
    terraform {
      required_providers {
        google = { source = "hashicorp/google", version = "~> 6.0" }
      }
    }
    variable "project_id" { type = string }
    provider "google" { project = var.project_id }
    resource "google_project_service" "documentai" {
      project            = var.project_id
      service            = "documentai.googleapis.com"
      disable_on_destroy = false
    }
    resource "google_document_ai_processor" "invoice" {
      project      = var.project_id
      location     = "us"
      display_name = "invoice-intake-demo"
      type         = "INVOICE_PROCESSOR"
      depends_on   = [google_project_service.documentai]
    }
    output "processor_name" { value = google_document_ai_processor.invoice.name }
    # Grant the existing worker roles/documentai.apiUser at the narrowest supported scope.
    # Storage/service-agent permissions are extra requirements for a batch workflow.
    # Choose an available processor version/location combination before production.
    # pip install google-cloud-documentai
    import json
    import sys
    from decimal import Decimal
    from google.api_core.client_options import ClientOptions
    from google.cloud import documentai_v1 as documentai
    
    
    def total_candidate(document, min_confidence=0.95):
        totals = [e for e in document.entities if e.type_ == "total_amount"]
        if len(totals) != 1:
            return None, ["expected_one_total_amount"]
        entity = totals[0]
        money = entity.normalized_value.money_value
        reasons = []
        if not money.currency_code:
            reasons.append("missing_normalized_currency")
        if entity.confidence < min_confidence:
            reasons.append("review_entity_confidence")
        amount = Decimal(money.units) + Decimal(money.nanos) / Decimal(1_000_000_000)
        # A candidate still needs line-item, supplier and accounting checks.
        return (amount, money.currency_code), reasons
    
    
    def process_invoice(client, processor_name, pdf_bytes):
        request = documentai.ProcessRequest(
            name=processor_name,
            raw_document=documentai.RawDocument(content=pdf_bytes, mime_type="application/pdf"),
        )
        return client.process_document(request=request, timeout=180).document
    
    
    if __name__ == "__main__":
        # python invoice.py PROJECT LOCATION PROCESSOR_ID invoice.pdf result.json [VERSION_ID]
        project, location, processor_id, input_path, output_path = sys.argv[1:6]
        client = documentai.DocumentProcessorServiceClient(
            client_options=ClientOptions(api_endpoint=f"{location}-documentai.googleapis.com")
        )
        name = client.processor_path(project, location, processor_id)
        if len(sys.argv) > 6:
            name += "/processorVersions/" + sys.argv[6]
        with open(input_path, "rb") as source:
            document = process_invoice(client, name, source.read())
        with open(output_path, "x", encoding="utf-8") as target:
            target.write(documentai.Document.to_json(document, preserving_proto_field_name=False))
        candidate, reasons = total_candidate(document)
        print("Review checks: " + (", ".join(reasons) if reasons else "continue business validation"))
        # Do not print raw text or values. The example 0.95 threshold needs calibration.
    // .NET console app: dotnet run -- result.json
    // Reads Document JSON from the Python tab; no cloud credentials are used here.
    using System.Globalization;
    using System.Text.Json;
    
    using var json = JsonDocument.Parse(File.ReadAllText(args[0]));
    var matches = new List<JsonElement>();
    if (json.RootElement.TryGetProperty("entities", out var entities))
        foreach (var e in entities.EnumerateArray())
            if (e.TryGetProperty("type", out var type) && type.GetString() == "total_amount")
                matches.Add(e);
    if (matches.Count != 1)
    {
        Console.WriteLine("Review: expected one total_amount entity.");
        return;
    }
    var entity = matches[0];
    if (!entity.TryGetProperty("normalizedValue", out var normalized) ||
        !normalized.TryGetProperty("moneyValue", out var money) ||
        !money.TryGetProperty("currencyCode", out var currency) ||
        string.IsNullOrWhiteSpace(currency.GetString()))
    {
        Console.WriteLine("Review: normalized money/currency is missing.");
        return;
    }
    // JSON int64 units can be strings. Decimal arithmetic avoids binary float rounding.
    var units = money.TryGetProperty("units", out var u)
        ? decimal.Parse(u.ToString(), CultureInfo.InvariantCulture) : 0m;
    var nanos = money.TryGetProperty("nanos", out var n) ? n.GetDecimal() : 0m;
    var amount = units + nanos / 1_000_000_000m;
    var needsReview = !entity.TryGetProperty("confidence", out var c) || c.GetDouble() < 0.95;
    Console.WriteLine(needsReview
        ? "Review the total confidence; validate the record before use."
        : "Candidate present; continue remaining business checks.");
    // Never infer approval from confidence alone; don't log the extracted amount.

    Best videos to explore

    Google links this introduction from its official Document AI product page. It is a product overview rather than a promise that every processor supports the same features or Regions. The embedded player loads only when selected.

    What is Document AI?Official · Google Cloud · Beginner · Watch on YouTube

    Interview questions

    BasicWhat is Google Cloud Document AI?

    It is a document-processing service organized around processors in a project and location. OCR, pretrained parsers and custom processing tasks can return text, layout and structured entities for an application to use.

    BasicHow is a processor different from a processor version?

    The processor is your resource for a processing task. A version identifies a model choice available to it. Record the version behind an evaluation and test changes before switching the production default.

    BasicShould I choose OCR or Invoice Parser?

    Choose OCR when the required output is document text and layout. Choose Invoice Parser when its supported invoice entities and languages match the task. An OCR response with empty business entities is not a failed attempt to run an invoice parser.

    IntermediateWhy must the endpoint match the processor location?

    The processor name includes a location and belongs to that service boundary. Configure the client endpoint for the same location, such as us-documentai.googleapis.com for a US processor, instead of assuming a resource name can be used at any endpoint.

    IntermediateCan I process documents in Mumbai or another single region?

    Google lists selected single-region locations, including Mumbai, with limited processor support. Check the current processor/version table and regional documentation for the exact task before choosing a location for residency reasons.

    IntermediateWhen should I use batch processing?

    Use the supported batch path when the workload or document limits call for Cloud Storage-backed processing. Save the operation name, inspect each document status and read all of its output shards; overall operation completion does not settle every input.

    IntermediateWhat does a normalized money value mean?

    It is a typed representation associated with an extracted entity, such as currency plus units and nanos. Verify the expected type and currency are present, retain the source mention and apply business checks before importing it.

    IntermediateDoes a high confidence score replace human review?

    No. Set review rules from errors measured on your documents, missing-field behavior and the impact of a wrong value. A confidence threshold is only one part of an acceptance policy, not a general correctness guarantee.

    AdvancedDoes Google use my documents to train Document AI models?

    The current Document AI security documentation says customer data is not used to train its models. Your application still needs appropriate access, retention and residency controls. Confirm the current terms and the selected processor configuration for regulated data.

    AdvancedHow do I prevent duplicate processing after a worker restart?

    Persist the input identity, processor/version, operation or completed result before advancing the workflow. Recover known work instead of blindly submitting it again, and make the downstream record write idempotent too.

    AdvancedHow should I estimate Document AI costs?

    Use the rates and billing rules for the actual processors and volumes, then add storage, workflow infrastructure and review labor. An OCR price does not describe Invoice Parser or all custom extraction models.

    AdvancedHow do Textract and Azure Document Intelligence compare?

    Amazon Textract and Azure Document Intelligence address overlapping extraction needs through different APIs and result schemas. Compare required fields, language support, document limits and correction work on the same held-out documents before choosing.

    Similar or alternative services on other clouds

    CapabilityAWSAzureGoogle Cloud
    ServiceAmazon TextractAzure Document IntelligenceGoogle Cloud Document AI
    Task boundaryCore operation and feature setAzure model selection in an analyze requestLocation-bound processor and version
    Invoice extractionAnalyzeExpense resultsprebuilt-invoice typed fieldsParser-specific entities with typed money normalization
    Large inputsS3 asynchronous jobs and paginated BlocksLong-running analysis and model/tier limitsCloud Storage batches, statuses and output shards
    CustomizationCustom Queries adaptersCustom extraction and classification modelsSupported custom processors and version-specific tuning
    Selection testMeasure errors and total review effortApply the same field contract to unseen inputsInclude processor/version and location in the evaluation record

    Document files and batch results commonly live in Cloud Storage. A short orchestrating step can run in Cloud Run functions, while the extraction processor remains a separate service resource. Cloud Vision API is useful for other image-analysis and OCR tasks, but its response is not a substitute for an Invoice Parser schema.

    Did you find this article helpful?

    Your answer helps us improve this page for the next reader.

    Sources and further reading

    CloudBrum wrote this page in its own words, using the provider’s public documentation listed below as the reference. Features, limits, names and prices change, so confirm anything that matters on the provider’s own pages before you decide.