Package google.cloud.documentai.v1beta3

Index

DocumentProcessorService

Service to call Document AI to process documents according to the processor's definition. Processors are built using state-of-the-art Google AI such as natural language, computer vision, and translation to extract structured information from unstructured or semi-structured documents.

BatchProcessDocuments

rpc BatchProcessDocuments(BatchProcessRequest) returns (Operation)

LRO endpoint to batch process many documents. The output is written to Cloud Storage as JSON in the [Document] format.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires one of the following IAM permissions on the name resource, depending on the resource type:

  • documentai.processors.processBatch
  • documentai.processorVersions.processBatch

For more information, see the IAM documentation.

CreateProcessor

rpc CreateProcessor(CreateProcessorRequest) returns (Processor)

Creates a processor from the ProcessorType provided. The processor will be at ENABLED state by default after its creation. Note that this method requires the documentai.processors.create permission on the project, which is highly privileged. A user or service account with this permission can create new processors that can interact with any gcs bucket in your project.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • documentai.processors.create

For more information, see the IAM documentation.

DeleteProcessor

rpc DeleteProcessor(DeleteProcessorRequest) returns (Operation)

Deletes the processor, unloads all deployed model artifacts if it was enabled and then deletes all artifacts associated with this processor.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.processors.delete

For more information, see the IAM documentation.

DeleteProcessorVersion

rpc DeleteProcessorVersion(DeleteProcessorVersionRequest) returns (Operation)

Deletes the processor version, all artifacts under the processor version will be deleted.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.processorVersions.delete

For more information, see the IAM documentation.

DeployProcessorVersion

rpc DeployProcessorVersion(DeployProcessorVersionRequest) returns (Operation)

Deploys the processor version.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.processorVersions.update

For more information, see the IAM documentation.

DisableProcessor

rpc DisableProcessor(DisableProcessorRequest) returns (Operation)

Disables a processor

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.processors.update

For more information, see the IAM documentation.

EnableProcessor

rpc EnableProcessor(EnableProcessorRequest) returns (Operation)

Enables a processor

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.processors.update

For more information, see the IAM documentation.

EvaluateProcessorVersion

rpc EvaluateProcessorVersion(EvaluateProcessorVersionRequest) returns (Operation)

Evaluates a ProcessorVersion against annotated documents, producing an Evaluation.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the processorVersion resource:

  • documentai.evaluations.create

For more information, see the IAM documentation.

FetchProcessorTypes

rpc FetchProcessorTypes(FetchProcessorTypesRequest) returns (FetchProcessorTypesResponse)

Fetches processor types. Note that we don't use ListProcessorTypes here, because it isn't paginated.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • documentai.processorTypes.list

For more information, see the IAM documentation.

GetEvaluation

rpc GetEvaluation(GetEvaluationRequest) returns (Evaluation)

Retrieves a specific evaluation.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.evaluations.get

For more information, see the IAM documentation.

GetProcessor

rpc GetProcessor(GetProcessorRequest) returns (Processor)

Gets a processor detail.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.processors.get

For more information, see the IAM documentation.

GetProcessorType

rpc GetProcessorType(GetProcessorTypeRequest) returns (ProcessorType)

Gets a processor type detail.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.processorTypes.get

For more information, see the IAM documentation.

GetProcessorVersion

rpc GetProcessorVersion(GetProcessorVersionRequest) returns (ProcessorVersion)

Gets a processor version detail.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.processorVersions.get

For more information, see the IAM documentation.

ImportProcessorVersion

rpc ImportProcessorVersion(ImportProcessorVersionRequest) returns (Operation)

Imports a processor version from source processor version.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • documentai.processorVersions.create

For more information, see the IAM documentation.

ListEvaluations

rpc ListEvaluations(ListEvaluationsRequest) returns (ListEvaluationsResponse)

Retrieves a set of evaluations for a given processor version.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • documentai.evaluations.list

For more information, see the IAM documentation.

ListProcessorTypes

rpc ListProcessorTypes(ListProcessorTypesRequest) returns (ListProcessorTypesResponse)

Lists the processor types that exist.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • documentai.processorTypes.list

For more information, see the IAM documentation.

ListProcessorVersions

rpc ListProcessorVersions(ListProcessorVersionsRequest) returns (ListProcessorVersionsResponse)

Lists all versions of a processor.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • documentai.processorVersions.list

For more information, see the IAM documentation.

ListProcessors

rpc ListProcessors(ListProcessorsRequest) returns (ListProcessorsResponse)

Lists all processors which belong to this project.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • documentai.processors.list

For more information, see the IAM documentation.

ProcessDocument

rpc ProcessDocument(ProcessRequest) returns (ProcessResponse)

Processes a single document.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires one of the following IAM permissions on the name resource, depending on the resource type:

  • documentai.processors.processOnline
  • documentai.processorVersions.processOnline

For more information, see the IAM documentation.

ReviewDocument

rpc ReviewDocument(ReviewDocumentRequest) returns (Operation)

Send a document for Human Review. The input document should be processed by the specified processor.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the humanReviewConfig resource:

  • documentai.humanReviewConfigs.review

For more information, see the IAM documentation.

SetDefaultProcessorVersion

rpc SetDefaultProcessorVersion(SetDefaultProcessorVersionRequest) returns (Operation)

Set the default (active) version of a Processor that will be used in ProcessDocument and BatchProcessDocuments.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the processor resource:

  • documentai.processors.update

For more information, see the IAM documentation.

TrainProcessorVersion

rpc TrainProcessorVersion(TrainProcessorVersionRequest) returns (Operation)

Trains a new processor version. Operation metadata is returned as TrainProcessorVersionMetadata.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the parent resource:

  • documentai.processorVersions.create

For more information, see the IAM documentation.

UndeployProcessorVersion

rpc UndeployProcessorVersion(UndeployProcessorVersionRequest) returns (Operation)

Undeploys the processor version.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.processorVersions.update

For more information, see the IAM documentation.

DocumentService

Service to call Cloud DocumentAI to manage document collection (dataset).

BatchDeleteDocuments

rpc BatchDeleteDocuments(BatchDeleteDocumentsRequest) returns (Operation)

Deletes a set of documents.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the dataset resource:

  • documentai.datasets.deleteDocuments

For more information, see the IAM documentation.

GetDatasetSchema

rpc GetDatasetSchema(GetDatasetSchemaRequest) returns (DatasetSchema)

Gets the DatasetSchema of a Dataset.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.datasetSchemas.get

For more information, see the IAM documentation.

GetDocument

rpc GetDocument(GetDocumentRequest) returns (GetDocumentResponse)

Returns relevant fields present in the requested document.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the dataset resource:

  • documentai.datasets.getDocuments

For more information, see the IAM documentation.

ImportDocuments

rpc ImportDocuments(ImportDocumentsRequest) returns (Operation)

Import documents into a dataset.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the dataset resource:

  • documentai.datasets.createDocuments

For more information, see the IAM documentation.

ListDocuments

rpc ListDocuments(ListDocumentsRequest) returns (ListDocumentsResponse)

Returns a list of documents present in the dataset.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the dataset resource:

  • documentai.datasets.listDocuments

For more information, see the IAM documentation.

UpdateDataset

rpc UpdateDataset(UpdateDatasetRequest) returns (Operation)

Updates metadata associated with a dataset. Note that this method requires the documentai.googleapis.com/datasets.update permission on the project, which is highly privileged. A user or service account with this permission can create new processors that can interact with any gcs bucket in your project.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.datasets.update

For more information, see the IAM documentation.

UpdateDatasetSchema

rpc UpdateDatasetSchema(UpdateDatasetSchemaRequest) returns (DatasetSchema)

Updates a DatasetSchema.

Authorization scopes

Requires the following OAuth scope:

  • https://www.googleapis.com/auth/cloud-platform

For more information, see the Authentication Overview.

IAM Permissions

Requires the following IAM permission on the name resource:

  • documentai.datasetSchemas.update

For more information, see the IAM documentation.

Barcode

Encodes the detailed information of a barcode.

Fields
format

string

Format of a barcode. The supported formats are:

  • CODE_128: Code 128 type.
  • CODE_39: Code 39 type.
  • CODE_93: Code 93 type.
  • CODABAR: Codabar type.
  • DATA_MATRIX: 2D Data Matrix type.
  • ITF: ITF type.
  • EAN_13: EAN-13 type.
  • EAN_8: EAN-8 type.
  • QR_CODE: 2D QR code type.
  • UPC_A: UPC-A type.
  • UPC_E: UPC-E type.
  • PDF417: PDF417 type.
  • AZTEC: 2D Aztec code type.
  • DATABAR: GS1 DataBar code type.
value_format

string

Value format describes the format of the value that a barcode encodes. The supported formats are:

  • CONTACT_INFO: Contact information.
  • EMAIL: Email address.
  • ISBN: ISBN identifier.
  • PHONE: Phone number.
  • PRODUCT: Product.
  • SMS: SMS message.
  • TEXT: Text string.
  • URL: URL address.
  • WIFI: Wifi information.
  • GEO: Geo-localization.
  • CALENDAR_EVENT: Calendar event.
  • DRIVER_LICENSE: Driver's license.
raw_value

string

Raw value encoded in the barcode. For example: 'MEBKM:TITLE:Google;URL:https://www.google.com;;'.

BatchDatasetDocuments

Dataset documents that the batch operation will be applied to.

Fields

Union field criteria.

criteria can be only one of the following:

individual_document_ids

IndividualDocumentIds

Document identifiers.

filter

string

A filter matching the documents. Follows the same format and restriction as [google.cloud.documentai.master.ListDocumentsRequest.filter].

IndividualDocumentIds

List of individual DocumentIds.

Fields
document_ids[]

DocumentId

Required. List of Document IDs indicating where the actual documents are stored.

BatchDeleteDocumentsMetadata

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

individual_batch_delete_statuses[]

IndividualBatchDeleteStatus

The list of response details of each document.

total_document_count

int32

Total number of documents deleting from dataset.

error_document_count

int32

Total number of documents that failed to be deleted in storage.

IndividualBatchDeleteStatus

The status of each individual document in the batch delete process.

Fields
document_id

DocumentId

The document id of the document.

status

Status

The status of deleting the document in storage.

BatchDeleteDocumentsRequest

Fields
dataset

string

Required. The dataset resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset

dataset_documents

BatchDatasetDocuments

Required. Dataset documents input. If given filter, all documents satisfying the filter will be deleted. If given documentIds, a maximum of 50 documents can be deleted in a batch. The request will be rejected if more than 50 document_ids are provided.

BatchDeleteDocumentsResponse

This type has no fields.

Response of the delete documents operation.

BatchDocumentsInputConfig

The common config to specify a set of documents used as input.

Fields
Union field source. Make sure that the caller of the API has storage.objects.get access to the buckets. The source can be only one of the following:
gcs_prefix

GcsPrefix

The set of documents that match the specified Cloud Storage gcs_prefix.

gcs_documents

GcsDocuments

The set of documents individually specified on Cloud Storage.

BatchProcessMetadata

The long-running operation metadata for BatchProcessDocuments.

Fields
state

State

The state of the current batch processing.

state_message

string

A message providing more details about the current state of processing. For example, the error message if the operation is failed.

create_time

Timestamp

The creation time of the operation.

update_time

Timestamp

The last update time of the operation.

individual_process_statuses[]

IndividualProcessStatus

The list of response details of each document.

IndividualProcessStatus

The status of a each individual document in the batch process.

Fields
input_gcs_source

string

The source of the document, same as the input_gcs_source field in the request when the batch process started.

status

Status

The status processing the document.

output_gcs_destination

string

The Cloud Storage output destination (in the request as DocumentOutputConfig.GcsOutputConfig.gcs_uri) of the processed document if it was successful, otherwise empty.

human_review_operation
(deprecated)

string

The name of the operation triggered by the processed document. If the human review process isn't triggered, this field will be empty. It has the same response type and metadata as the long-running operation returned by the ReviewDocument method.

human_review_status

HumanReviewStatus

The status of human review on the processed document.

State

Possible states of the batch processing operation.

Enums
STATE_UNSPECIFIED The default value. This value is used if the state is omitted.
WAITING Request operation is waiting for scheduling.
RUNNING Request is being processed.
SUCCEEDED The batch processing completed successfully.
CANCELLING The batch processing was being cancelled.
CANCELLED The batch processing was cancelled.
FAILED The batch processing has failed.

BatchProcessRequest

Request message for BatchProcessDocuments.

Fields
name

string

Required. The resource name of Processor or ProcessorVersion. Format: projects/{project}/locations/{location}/processors/{processor}, or projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}

Authorization requires one or more of the following IAM permissions on the specified resource name:

  • documentai.processors.processBatch
  • documentai.processorVersions.processBatch
input_configs[]
(deprecated)

BatchInputConfig

The input config for each single document in the batch process.

output_config
(deprecated)

BatchOutputConfig

The overall output config for batch process.

input_documents

BatchDocumentsInputConfig

The input documents for the BatchProcessDocuments method.

document_output_config

DocumentOutputConfig

The output configuration for the BatchProcessDocuments method.

skip_human_review

bool

Whether human review should be skipped for this request. Default to false.

process_options

ProcessOptions

Inference-time options for the process API

labels

map<string, string>

Optional. The labels with user-defined metadata for the request.

Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.

BatchInputConfig

The message for input config in batch process.

Fields
gcs_source

string

The Cloud Storage location as the source of the document.

mime_type

string

An IANA published media type (MIME type) of the input. If the input is a raw document, refer to supported file types for the list of media types. If the input is a Document, the type should be application/json.

BatchOutputConfig

The output configuration in the BatchProcessDocuments method.

Fields
gcs_destination

string

The output Cloud Storage directory to put the processed documents.

BatchProcessResponse

This type has no fields.

Response message for BatchProcessDocuments.

BoundingPoly

A bounding polygon for the detected image annotation.

Fields
vertices[]

Vertex

The bounding polygon vertices.

normalized_vertices[]

NormalizedVertex

The bounding polygon normalized vertices.

CommonOperationMetadata

The common metadata for long running operations.

Fields
state

State

The state of the operation.

state_message

string

A message providing more details about the current state of processing.

resource

string

A related resource to this operation.

create_time

Timestamp

The creation time of the operation.

update_time

Timestamp

The last update time of the operation.

State

State of the longrunning operation.

Enums
STATE_UNSPECIFIED Unspecified state.
RUNNING Operation is still running.
CANCELLING Operation is being cancelled.
SUCCEEDED Operation succeeded.
FAILED Operation failed.
CANCELLED Operation is cancelled.

CreateProcessorRequest

Request message for the CreateProcessor method. Notice this request is sent to a regionalized backend service. If the ProcessorType isn't available in that region, the creation fails.

Fields
parent

string

Required. The parent (project and location) under which to create the processor. Format: projects/{project}/locations/{location}

processor

Processor

Required. The processor to be created, requires Processor.type and Processor.display_name to be set. Also, the Processor.kms_key_name field must be set if the processor is under CMEK.

Authorization requires the following IAM permission on the specified resource processor:

  • documentai.processors.create

Dataset

A singleton resource under a Processor which configures a collection of documents.

Fields
name

string

Dataset resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset

state

State

Required. State of the dataset. Ignored when updating dataset.

satisfies_pzs

bool

Output only. Reserved for future use.

satisfies_pzi

bool

Output only. Reserved for future use.

Union field storage_source.

storage_source can be only one of the following:

gcs_managed_config

GCSManagedConfig

Optional. User-managed Cloud Storage dataset configuration. Use this configuration if the dataset documents are stored under a user-managed Cloud Storage location.

document_warehouse_config
(deprecated)

DocumentWarehouseConfig

Optional. Deprecated. Warehouse-based dataset configuration is not supported.

unmanaged_dataset_config

UnmanagedDatasetConfig

Optional. Unmanaged dataset configuration. Use this configuration if the dataset documents are managed by the document service internally (not user-managed).

Union field indexing_source.

indexing_source can be only one of the following:

spanner_indexing_config

SpannerIndexingConfig

Optional. A lightweight indexing source with low latency and high reliability, but lacking advanced features like CMEK and content-based search.

DocumentWarehouseConfig

Configuration specific to the Document AI Warehouse-based implementation.

Fields
collection

string

Output only. The collection in Document AI Warehouse associated with the dataset.

schema

string

Output only. The schema in Document AI Warehouse associated with the dataset.

GCSManagedConfig

Configuration specific to the Cloud Storage-based implementation.

Fields
gcs_prefix

GcsPrefix

Required. The Cloud Storage URI (a directory) where the documents belonging to the dataset must be stored.

SpannerIndexingConfig

This type has no fields.

Configuration specific to spanner-based indexing.

State

Different states of a dataset.

Enums
STATE_UNSPECIFIED Default unspecified enum, should not be used.
UNINITIALIZED Dataset has not been initialized.
INITIALIZING Dataset is being initialized.
INITIALIZED Dataset has been initialized.

UnmanagedDatasetConfig

This type has no fields.

Configuration specific to an unmanaged dataset.

DatasetSchema

Dataset Schema.

Fields
name

string

Dataset schema resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset/datasetSchema

document_schema

DocumentSchema

Optional. Schema of the dataset.

DatasetSplitType

Documents belonging to a dataset will be split into different groups referred to as splits: train, test.

Enums
DATASET_SPLIT_TYPE_UNSPECIFIED Default value if the enum is not set.
DATASET_SPLIT_TRAIN Identifies the train documents.
DATASET_SPLIT_TEST Identifies the test documents.
DATASET_SPLIT_UNASSIGNED Identifies the unassigned documents.

DeleteProcessorMetadata

The long-running operation metadata for the DeleteProcessor method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

DeleteProcessorRequest

Request message for the DeleteProcessor method.

Fields
name

string

Required. The processor resource name to be deleted.

Authorization requires the following IAM permission on the specified resource name:

  • documentai.processors.delete

DeleteProcessorVersionMetadata

The long-running operation metadata for the DeleteProcessorVersion method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

DeleteProcessorVersionRequest

Request message for the DeleteProcessorVersion method.

Fields
name

string

Required. The processor version resource name to be deleted.

Authorization requires the following IAM permission on the specified resource name:

  • documentai.processorVersions.delete

DeployProcessorVersionMetadata

The long-running operation metadata for the DeployProcessorVersion method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

DeployProcessorVersionRequest

Request message for the DeployProcessorVersion method.

Fields
name

string

Required. The processor version resource name to be deployed.

Authorization requires the following IAM permission on the specified resource name:

  • documentai.processorVersions.update

DeployProcessorVersionResponse

This type has no fields.

Response message for the DeployProcessorVersion method.

DisableProcessorMetadata

The long-running operation metadata for the DisableProcessor method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

DisableProcessorRequest

Request message for the DisableProcessor method.

Fields
name

string

Required. The processor resource name to be disabled.

Authorization requires the following IAM permission on the specified resource name:

  • documentai.processors.update

DisableProcessorResponse

This type has no fields.

Response message for the DisableProcessor method. Intentionally empty proto for adding fields in future.

Document

Document represents the canonical document resource in Document AI. It is an interchange format that provides insights into documents and allows for collaboration between users and Document AI to iterate and optimize for quality.

Fields
mime_type

string

An IANA published media type (MIME type).

text

string

Optional. UTF-8 encoded text in reading order from the document.

text_styles[]
(deprecated)

Style

Styles for the Document.text.

pages[]

Page

Visual page layout for the Document.

entities[]

Entity

A list of entities detected on Document.text. For document shards, entities in this list may cross shard boundaries.

entity_relations[]

EntityRelation

Placeholder. Relationship among Document.entities.

text_changes[]

TextChange

Placeholder. A list of text corrections made to Document.text. This is usually used for annotating corrections to OCR mistakes. Text changes for a given revision may not overlap with each other.

shard_info

ShardInfo

Information about the sharding if this document is sharded part of a larger document. If the document is not sharded, this message is not specified.

error

Status

Any error that occurred while processing this document.

revisions[]

Revision

Placeholder. Revision history of this document.

document_layout

DocumentLayout

Parsed layout of the document.

chunked_document

ChunkedDocument

Document chunked based on chunking config.

Union field source. Original source document from the user. source can be only one of the following:
uri

string

Optional. Currently supports Google Cloud Storage URI of the form gs://bucket_name/object_name. Object versioning is not supported. For more information, refer to Google Cloud Storage Request URIs.

content

bytes

Optional. Inline document content, represented as a stream of bytes. Note: As with all bytes fields, protobuffers use a pure binary representation, whereas JSON representations use base64.

ChunkedDocument

Represents the chunks that the document is divided into.

Fields
chunks[]

Chunk

List of chunks.

Chunk

Represents a chunk.

Fields
chunk_id

string

ID of the chunk.

source_block_ids[]

string

Unused.

content

string

Text content of the chunk.

page_span

ChunkPageSpan

Page span of the chunk.

page_headers[]

ChunkPageHeader

Page headers associated with the chunk.

page_footers[]

ChunkPageFooter

Page footers associated with the chunk.

ChunkPageFooter

Represents the page footer associated with the chunk.

Fields
text

string

Footer in text format.

page_span

ChunkPageSpan

Page span of the footer.

ChunkPageHeader

Represents the page header associated with the chunk.

Fields
text

string

Header in text format.

page_span

ChunkPageSpan

Page span of the header.

ChunkPageSpan

Represents where the chunk starts and ends in the document.

Fields
page_start

int32

Page where chunk starts in the document.

page_end

int32

Page where chunk ends in the document.

DocumentLayout

Represents the parsed layout of a document as a collection of blocks that the document is divided into.

Fields
blocks[]

DocumentLayoutBlock

List of blocks in the document.

DocumentLayoutBlock

Represents a block. A block could be one of the various types (text, table, list) supported.

Fields
block_id

string

ID of the block.

page_span

LayoutPageSpan

Page span of the block.

Union field block.

block can be only one of the following:

text_block

LayoutTextBlock

Block consisting of text content.

table_block

LayoutTableBlock

Block consisting of table content/structure.

list_block

LayoutListBlock

Block consisting of list content/structure.

LayoutListBlock

Represents a list type block.

Fields
list_entries[]

LayoutListEntry

List entries that constitute a list block.

type

string

Type of the list_entries (if exist). Available options are ordered and unordered.

LayoutListEntry

Represents an entry in the list.

Fields
blocks[]

DocumentLayoutBlock

A list entry is a list of blocks. Repeated blocks support further hierarchies and nested blocks.

LayoutPageSpan

Represents where the block starts and ends in the document.

Fields
page_start

int32

Page where block starts in the document.

page_end

int32

Page where block ends in the document.

LayoutTableBlock

Represents a table type block.

Fields
header_rows[]

LayoutTableRow

Header rows at the top of the table.

body_rows[]

LayoutTableRow

Body rows containing main table content.

caption

string

Table caption/title.

LayoutTableCell

Represents a cell in a table row.

Fields
blocks[]

DocumentLayoutBlock

A table cell is a list of blocks. Repeated blocks support further hierarchies and nested blocks.

row_span

int32

How many rows this cell spans.

col_span

int32

How many columns this cell spans.

LayoutTableRow

Represents a row in a table.

Fields
cells[]

LayoutTableCell

A table row is a list of table cells.

LayoutTextBlock

Represents a text type block.

Fields
text

string

Text content stored in the block.

type

string

Type of the text in the block. Available options are: paragraph, subtitle, heading-1, heading-2, heading-3, heading-4, heading-5, header, footer.

blocks[]

DocumentLayoutBlock

A text block could further have child blocks. Repeated blocks support further hierarchies and nested blocks.

Entity

An entity that could be a phrase in the text or a property that belongs to the document. It is a known entity type, such as a person, an organization, or location.

Fields
text_anchor

TextAnchor

Optional. Provenance of the entity. Text anchor indexing into the Document.text.

type

string

Required. Entity type from a schema e.g. Address.

mention_text

string

Optional. Text value of the entity e.g. 1600 Amphitheatre Pkwy.

mention_id

string

Optional. Deprecated. Use id field instead.

confidence

float

Optional. Confidence of detected Schema entity. Range [0, 1].

page_anchor

PageAnchor

Optional. Represents the provenance of this entity wrt. the location on the page where it was found.

id

string

Optional. Canonical id. This will be a unique value in the entity list for this document.

normalized_value

NormalizedValue

Optional. Normalized entity value. Absent if the extracted value could not be converted or the type (e.g. address) is not supported for certain parsers. This field is also only populated for certain supported document types.

properties[]

Entity

Optional. Entities can be nested to form a hierarchical data structure representing the content in the document.

provenance

Provenance

Optional. The history of this annotation.

redacted

bool

Optional. Whether the entity will be redacted for de-identification purposes.

NormalizedValue

Parsed and normalized entity value.

Fields
text

string

Optional. An optional field to store a normalized string. For some entity types, one of respective structured_value fields may also be populated. Also not all the types of structured_value will be normalized. For example, some processors may not generate float or integer normalized text by default.

Below are sample formats mapped to structured values.

  • Money/Currency type (money_value) is in the ISO 4217 text format.
  • Date type (date_value) is in the ISO 8601 text format.
  • Datetime type (datetime_value) is in the ISO 8601 text format.
Union field structured_value. An optional structured entity value. Must match entity type defined in schema if known. If this field is present, the text field could also be populated. structured_value can be only one of the following:
money_value

Money

Money value. See also: https://github.com/googleapis/googleapis/blob/master/google/type/money.proto

date_value

Date

Date value. Includes year, month, day. See also: https://github.com/googleapis/googleapis/blob/master/google/type/date.proto

datetime_value

DateTime

DateTime value. Includes date, time, and timezone. See also: https://github.com/googleapis/googleapis/blob/master/google/type/datetime.proto

address_value

PostalAddress

Postal address. See also: https://github.com/googleapis/googleapis/blob/master/google/type/postal_address.proto

boolean_value

bool

Boolean value. Can be used for entities with binary values, or for checkboxes.

integer_value

int32

Integer value.

float_value

float

Float value.

EntityRelation

Relationship between Entities.

Fields
subject_id

string

Subject entity id.

object_id

string

Object entity id.

relation

string

Relationship description.

Page

A page in a Document.

Fields
page_number

int32

1-based index for current Page in a parent Document. Useful when a page is taken out of a Document for individual processing.

image

Image

Rendered image for this page. This image is preprocessed to remove any skew, rotation, and distortions such that the annotation bounding boxes can be upright and axis-aligned.

transforms[]

Matrix

Transformation matrices that were applied to the original document image to produce Page.image.

dimension

Dimension

Physical dimension of the page.

layout

Layout

Layout for the page.

detected_languages[]

DetectedLanguage

A list of detected languages together with confidence.

blocks[]

Block

A list of visually detected text blocks on the page. A block has a set of lines (collected into paragraphs) that have a common line-spacing and orientation.

paragraphs[]

Paragraph

A list of visually detected text paragraphs on the page. A collection of lines that a human would perceive as a paragraph.

lines[]

Line

A list of visually detected text lines on the page. A collection of tokens that a human would perceive as a line.

tokens[]

Token

A list of visually detected tokens on the page.

visual_elements[]

VisualElement

A list of detected non-text visual elements e.g. checkbox, signature etc. on the page.

tables[]

Table

A list of visually detected tables on the page.

form_fields[]

FormField

A list of visually detected form fields on the page.

symbols[]

Symbol

A list of visually detected symbols on the page.

detected_barcodes[]

DetectedBarcode

A list of detected barcodes.

image_quality_scores

ImageQualityScores

Image quality scores.

provenance
(deprecated)

Provenance

The history of this page.

Block

A block has a set of lines (collected into paragraphs) that have a common line-spacing and orientation.

Fields
layout

Layout

Layout for Block.

detected_languages[]

DetectedLanguage

A list of detected languages together with confidence.

provenance
(deprecated)

Provenance

The history of this annotation.

DetectedBarcode

A detected barcode.

Fields
layout

Layout

Layout for DetectedBarcode.

barcode

Barcode

Detailed barcode information of the DetectedBarcode.

DetectedLanguage

Detected language for a structural component.

Fields
language_code

string

The BCP-47 language code, such as en-US or sr-Latn.

confidence

float

Confidence of detected language. Range [0, 1].

Dimension

Dimension for the page.

Fields
width

float

Page width.

height

float

Page height.

unit

string

Dimension unit.

FormField

A form field detected on the page.

Fields
field_name

Layout

Layout for the FormField name. e.g. Address, Email, Grand total, Phone number, etc.

field_value

Layout

Layout for the FormField value.

name_detected_languages[]

DetectedLanguage

A list of detected languages for name together with confidence.

value_detected_languages[]

DetectedLanguage

A list of detected languages for value together with confidence.

value_type

string

If the value is non-textual, this field represents the type. Current valid values are:

  • blank (this indicates the field_value is normal text)
  • unfilled_checkbox
  • filled_checkbox
corrected_key_text

string

Created for Labeling UI to export key text. If corrections were made to the text identified by the field_name.text_anchor, this field will contain the correction.

corrected_value_text

string

Created for Labeling UI to export value text. If corrections were made to the text identified by the field_value.text_anchor, this field will contain the correction.

provenance

Provenance

The history of this annotation.

Image

Rendered image contents for this page.

Fields
content

bytes

Raw byte content of the image.

mime_type

string

Encoding media type (MIME type) for the image.

width

int32

Width of the image in pixels.

height

int32

Height of the image in pixels.

ImageQualityScores

Image quality scores for the page image.

Fields
quality_score

float

The overall quality score. Range [0, 1] where 1 is perfect quality.

detected_defects[]

DetectedDefect

A list of detected defects.

DetectedDefect

Image Quality Defects

Fields
type

string

Name of the defect type. Supported values are:

  • quality/defect_blurry
  • quality/defect_noisy
  • quality/defect_dark
  • quality/defect_faint
  • quality/defect_text_too_small
  • quality/defect_document_cutoff
  • quality/defect_text_cutoff
  • quality/defect_glare
confidence

float

Confidence of detected defect. Range [0, 1] where 1 indicates strong confidence that the defect exists.

Layout

Visual element describing a layout unit on a page.

Fields
text_anchor

TextAnchor

Text anchor indexing into the Document.text.

confidence

float

Confidence of the current Layout within context of the object this layout is for. e.g. confidence can be for a single token, a table, a visual element, etc. depending on context. Range [0, 1].

bounding_poly

BoundingPoly

The bounding polygon for the Layout.

orientation

Orientation

Detected orientation for the Layout.

Orientation

Detected human reading orientation.

Enums
ORIENTATION_UNSPECIFIED Unspecified orientation.
PAGE_UP Orientation is aligned with page up.
PAGE_RIGHT Orientation is aligned with page right. Turn the head 90 degrees clockwise from upright to read.
PAGE_DOWN Orientation is aligned with page down. Turn the head 180 degrees from upright to read.
PAGE_LEFT Orientation is aligned with page left. Turn the head 90 degrees counterclockwise from upright to read.

Line

A collection of tokens that a human would perceive as a line. Does not cross column boundaries, can be horizontal, vertical, etc.

Fields
layout

Layout

Layout for Line.

detected_languages[]

DetectedLanguage

A list of detected languages together with confidence.

provenance
(deprecated)

Provenance

The history of this annotation.

Matrix

Representation for transformation matrix, intended to be compatible and used with OpenCV format for image manipulation.

Fields
rows

int32

Number of rows in the matrix.

cols

int32

Number of columns in the matrix.

type

int32

This encodes information about what data type the matrix uses. For example, 0 (CV_8U) is an unsigned 8-bit image. For the full list of OpenCV primitive data types, please refer to https://docs.opencv.org/4.3.0/d1/d1b/group__core__hal__interface.html

data

bytes

The matrix data.

Paragraph

A collection of lines that a human would perceive as a paragraph.

Fields
layout

Layout

Layout for Paragraph.

detected_languages[]

DetectedLanguage

A list of detected languages together with confidence.

provenance
(deprecated)

Provenance

The history of this annotation.

Symbol

A detected symbol.

Fields
layout

Layout

Layout for Symbol.

detected_languages[]

DetectedLanguage

A list of detected languages together with confidence.

Table

A table representation similar to HTML table structure.

Fields
layout

Layout

Layout for Table.

header_rows[]

TableRow

Header rows of the table.

body_rows[]

TableRow

Body rows of the table.

detected_languages[]

DetectedLanguage

A list of detected languages together with confidence.

provenance
(deprecated)

Provenance

The history of this table.

TableCell

A cell representation inside the table.

Fields
layout

Layout

Layout for TableCell.

row_span

int32

How many rows this cell spans.

col_span

int32

How many columns this cell spans.

detected_languages[]

DetectedLanguage

A list of detected languages together with confidence.

TableRow

A row of table cells.

Fields
cells[]

TableCell

Cells that make up this row.

Token

A detected token.

Fields
layout

Layout

Layout for Token.

detected_break

DetectedBreak

Detected break at the end of a Token.

detected_languages[]

DetectedLanguage

A list of detected languages together with confidence.

provenance
(deprecated)

Provenance

The history of this annotation.

style_info

StyleInfo

Text style attributes.

DetectedBreak

Detected break at the end of a Token.

Fields
type

Type

Detected break type.

Type

Enum to denote the type of break found.

Enums
TYPE_UNSPECIFIED Unspecified break type.
SPACE A single whitespace.
WIDE_SPACE A wider whitespace.
HYPHEN A hyphen that indicates that a token has been split across lines.

StyleInfo

Font and other text style attributes.

Fields
font_size

int32

Font size in points (1 point is ¹⁄₇₂ inches).

pixel_font_size

double

Font size in pixels, equal to unrounded font_size * resolution ÷ 72.0.

letter_spacing

double

Letter spacing in points.

font_type

string

Name or style of the font.

bold

bool

Whether the text is bold (equivalent to font_weight is at least 700).

italic

bool

Whether the text is italic.

underlined

bool

Whether the text is underlined.

strikeout

bool

Whether the text is strikethrough. This feature is not supported yet.

subscript

bool

Whether the text is a subscript. This feature is not supported yet.

superscript

bool

Whether the text is a superscript. This feature is not supported yet.

smallcaps

bool

Whether the text is in small caps. This feature is not supported yet.

font_weight

int32

TrueType weight on a scale 100 (thin) to 1000 (ultra-heavy). Normal is 400, bold is 700.

handwritten

bool

Whether the text is handwritten.

text_color

Color

Color of the text.

background_color

Color

Color of the background.

VisualElement

Detected non-text visual elements e.g. checkbox, signature etc. on the page.

Fields
layout

Layout

Layout for VisualElement.

type

string

Type of the VisualElement.

detected_languages[]

DetectedLanguage

A list of detected languages together with confidence.

PageAnchor

Referencing the visual context of the entity in the Document.pages. Page anchors can be cross-page, consist of multiple bounding polygons and optionally reference specific layout element types.

Fields
page_refs[]

PageRef

One or more references to visual page elements

PageRef

Represents a weak reference to a page element within a document.

Fields
page

int64

Required. Index into the Document.pages element, for example using [Document.pages][page_refs.page] to locate the related page element. This field is skipped when its value is the default 0. See https://developers.google.com/protocol-buffers/docs/proto3#json.

layout_type

LayoutType

Optional. The type of the layout element that is being referenced if any.

layout_id
(deprecated)

string

Optional. Deprecated. Use PageRef.bounding_poly instead.

bounding_poly

BoundingPoly

Optional. Identifies the bounding polygon of a layout element on the page. If layout_type is set, the bounding polygon must be exactly the same to the layout element it's referring to.

confidence

float

Optional. Confidence of detected page element, if applicable. Range [0, 1].

LayoutType

The type of layout that is being referenced.

Enums
LAYOUT_TYPE_UNSPECIFIED Layout Unspecified.
BLOCK References a Page.blocks element.
PARAGRAPH References a Page.paragraphs element.
LINE References a Page.lines element.
TOKEN References a Page.tokens element.
VISUAL_ELEMENT References a Page.visual_elements element.
TABLE Refrrences a Page.tables element.
FORM_FIELD References a Page.form_fields element.

Provenance

Structure to identify provenance relationships between annotations in different revisions.

Fields
revision
(deprecated)

int32

The index of the revision that produced this element.

id
(deprecated)

int32

The Id of this operation. Needs to be unique within the scope of the revision.

parents[]

Parent

References to the original elements that are replaced.

type

OperationType

The type of provenance operation.

OperationType

If a processor or agent does an explicit operation on existing elements.

Enums
OPERATION_TYPE_UNSPECIFIED Operation type unspecified. If no operation is specified a provenance entry is simply used to match against a parent.
ADD Add an element.
REMOVE Remove an element identified by parent.
UPDATE Updates any fields within the given provenance scope of the message. It overwrites the fields rather than replacing them. Use this when you want to update a field value of an entity without also updating all the child properties.
REPLACE Currently unused. Replace an element identified by parent.
EVAL_REQUESTED

Deprecated. Request human review for the element identified by parent.

EVAL_APPROVED

Deprecated. Element is reviewed and approved at human review, confidence will be set to 1.0.

EVAL_SKIPPED

Deprecated. Element is skipped in the validation process.

Parent

The parent element the current element is based on. Used for referencing/aligning, removal and replacement operations.

Fields
revision

int32

The index of the index into current revision's parent_ids list.

index

int32

The index of the parent item in the corresponding item list (eg. list of entities, properties within entities, etc.) in the parent revision.

id
(deprecated)

int32

The id of the parent provenance.

Revision

Contains past or forward revisions of this document.

Fields
id

string

Id of the revision, internally generated by doc proto storage. Unique within the context of the document.

parent[]
(deprecated)

int32

The revisions that this revision is based on. This can include one or more parent (when documents are merged.) This field represents the index into the revisions field.

parent_ids[]

string

The revisions that this revision is based on. Must include all the ids that have anything to do with this revision - eg. there are provenance.parent.revision fields that index into this field.

create_time

Timestamp

The time that the revision was created, internally generated by doc proto storage at the time of create.

human_review

HumanReview

Human Review information of this revision.

Union field source. Who/what made the change source can be only one of the following:
agent

string

If the change was made by a person specify the name or id of that person.

processor

string

If the annotation was made by processor identify the processor by its resource name.

HumanReview

Human Review information of the document.

Fields
state

string

Human review state. e.g. requested, succeeded, rejected.

state_message

string

A message providing more details about the current state of processing. For example, the rejection reason when the state is rejected.

ShardInfo

For a large document, sharding may be performed to produce several document shards. Each document shard contains this field to detail which shard it is.

Fields
shard_index

int64

The 0-based index of this shard.

shard_count

int64

Total number of shards.

text_offset

int64

The index of the first character in Document.text in the overall document global text.

Style

Annotation for common text style attributes. This adheres to CSS conventions as much as possible.

Fields
text_anchor

TextAnchor

Text anchor indexing into the Document.text.

color

Color

Text color.

background_color

Color

Text background color.

font_weight

string

Font weight. Possible values are normal, bold, bolder, and lighter.

text_style

string

Text style. Possible values are normal, italic, and oblique.

text_decoration

string

Text decoration. Follows CSS standard.

font_size

FontSize

Font size.

font_family

string

Font family such as Arial, Times New Roman. https://www.w3schools.com/cssref/pr_font_font-family.asp

FontSize

Font size with unit.

Fields
size

float

Font size for the text.

unit

string

Unit for the font size. Follows CSS naming (such as in, px, and pt).

TextAnchor

Text reference indexing into the Document.text.

Fields
text_segments[]

TextSegment

The text segments from the Document.text.

content

string

Contains the content of the text span so that users do not have to look it up in the text_segments. It is always populated for formFields.

TextSegment

A text segment in the Document.text. The indices may be out of bounds which indicate that the text extends into another document shard for large sharded documents. See ShardInfo.text_offset

Fields
start_index

int64

TextSegment start UTF-8 char index in the Document.text.

end_index

int64

TextSegment half open end UTF-8 char index in the Document.text.

TextChange

This message is used for text changes aka. OCR corrections.

Fields
text_anchor

TextAnchor

Provenance of the correction. Text anchor indexing into the Document.text. There can only be a single TextAnchor.text_segments element. If the start and end index of the text segment are the same, the text change is inserted before that index.

changed_text

string

The text that replaces the text identified in the text_anchor.

provenance[]
(deprecated)

Provenance

The history of this annotation.

DocumentId

Document Identifier.

Fields
revision_ref

RevisionRef

Points to a specific revision of the document if set.

Union field type.

type can be only one of the following:

gcs_managed_doc_id

GCSManagedDocumentId

A document id within user-managed Cloud Storage.

unmanaged_doc_id

UnmanagedDocumentId

A document id within unmanaged dataset.

GCSManagedDocumentId

Identifies a document uniquely within the scope of a dataset in the user-managed Cloud Storage option.

Fields
gcs_uri

string

Required. The Cloud Storage URI where the actual document is stored.

cw_doc_id
(deprecated)

string

Id of the document (indexed) managed by Content Warehouse.

UnmanagedDocumentId

Identifies a document uniquely within the scope of a dataset in unmanaged option.

Fields
doc_id

string

Required. The id of the document.

DocumentLabelingState

Describes the labeling status of a document.

Enums
DOCUMENT_LABELING_STATE_UNSPECIFIED Default value if the enum is not set.
DOCUMENT_LABELED Document has been labeled.
DOCUMENT_UNLABELED Document has not been labeled.
DOCUMENT_AUTO_LABELED Document has been auto-labeled.

DocumentMetadata

Metadata about a document.

Fields
document_id

DocumentId

Document identifier.

page_count

int32

Number of pages in the document.

dataset_type

DatasetSplitType

Type of the dataset split to which the document belongs.

labeling_state

DocumentLabelingState

Labeling state of the document.

display_name

string

The display name of the document.

DocumentOutputConfig

Config that controls the output of documents. All documents will be written as a JSON file.

Fields
Union field destination. The destination of the results. destination can be only one of the following:
gcs_output_config

GcsOutputConfig

Output config to write the results to Cloud Storage.

GcsOutputConfig

The configuration used when outputting documents.

Fields
gcs_uri

string

The Cloud Storage uri (a directory) of the output.

field_mask

FieldMask

Specifies which fields to include in the output documents. Only supports top level document and pages field so it must be in the form of {document_field_name} or pages.{page_field_name}.

sharding_config

ShardingConfig

Specifies the sharding config for the output document.

ShardingConfig

The sharding config for the output document.

Fields
pages_per_shard

int32

The number of pages per shard.

pages_overlap

int32

The number of overlapping pages between consecutive shards.

DocumentPageRange

Range of pages present in a document.

Fields
start

int32

First page number (one-based index) to be returned.

end

int32

Last page number (one-based index) to be returned.

DocumentSchema

The schema defines the output of the processed document by a processor.

Fields
display_name

string

Display name to show to users.

description

string

Description of the schema.

entity_types[]

EntityType

Entity types of the schema.

metadata

Metadata

Metadata of the schema.

EntityType

EntityType is the wrapper of a label of the corresponding model with detailed attributes and limitations for entity-based processors. Multiple types can also compose a dependency tree to represent nested types.

Fields
display_name

string

User defined name for the type.

name

string

Name of the type. It must be unique within the schema file and cannot be a "Common Type". The following naming conventions are used:

  • Use snake_casing.
  • Name matching is case-sensitive.
  • Maximum 64 characters.
  • Must start with a letter.
  • Allowed characters: ASCII letters [a-z0-9_-]. (For backward compatibility internal infrastructure and tooling can handle any ascii character.)
  • The / is sometimes used to denote a property of a type. For example line_item/amount. This convention is deprecated, but will still be honored for backward compatibility.
description

string

The description of the entity type. Could be used to provide more information about the entity type for model calls.

base_types[]

string

The entity type that this type is derived from. For now, one and only one should be set.

properties[]

Property

Description the nested structure, or composition of an entity.

entity_type_metadata

EntityTypeMetadata

Metadata for the entity type.

Union field value_source.

value_source can be only one of the following:

enum_values

EnumValues

If specified, lists all the possible values for this entity. This should not be more than a handful of values. If the number of values is >10 or could change frequently use the EntityType.value_ontology field and specify a list of all possible values in a value ontology file.

EnumValues

Defines the a list of enum values.

Fields
values[]

string

The individual values that this enum values type can include.

Property

Defines properties that can be part of the entity type.

Fields
name

string

The name of the property. Follows the same guidelines as the EntityType name.

description

string

The description of the property. Could be used to provide more information about the property for model calls.

display_name

string

User defined name for the property.

value_type

string

A reference to the value type of the property. This type is subject to the same conventions as the Entity.base_types field.

occurrence_type

OccurrenceType

Occurrence type limits the number of instances an entity type appears in the document.

property_metadata

PropertyMetadata

Any additional metadata about the property can be added here.

OccurrenceType

Types of occurrences of the entity type in the document. This represents the number of instances, not mentions, of an entity. For example, a bank statement might only have one account_number, but this account number can be mentioned in several places on the document. In this case, the account_number is considered a REQUIRED_ONCE entity type. If, on the other hand, we expect a bank statement to contain the status of multiple different accounts for the customers, the occurrence type is set to REQUIRED_MULTIPLE.

Enums
OCCURRENCE_TYPE_UNSPECIFIED Unspecified occurrence type.
OPTIONAL_ONCE There will be zero or one instance of this entity type. The same entity instance may be mentioned multiple times.
OPTIONAL_MULTIPLE The entity type will appear zero or multiple times.
REQUIRED_ONCE The entity type will only appear exactly once. The same entity instance may be mentioned multiple times.
REQUIRED_MULTIPLE The entity type will appear once or more times.

Metadata

Metadata for global schema behavior.

Fields
document_splitter

bool

If true, a document entity type can be applied to subdocument (splitting). Otherwise, it can only be applied to the entire document (classification).

document_allow_multiple_labels

bool

If true, on a given page, there can be multiple document annotations covering it.

prefixed_naming_on_properties

bool

If set, all the nested entities must be prefixed with the parents.

skip_naming_validation

bool

If set, we will skip the naming format validation in the schema. So the string values in DocumentSchema.EntityType.name and DocumentSchema.EntityType.Property.name will not be checked.

EnableProcessorMetadata

The long-running operation metadata for the EnableProcessor method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

EnableProcessorRequest

Request message for the EnableProcessor method.

Fields
name

string

Required. The processor resource name to be enabled.

Authorization requires the following IAM permission on the specified resource name:

  • documentai.processors.update

EnableProcessorResponse

This type has no fields.

Response message for the EnableProcessor method. Intentionally empty proto for adding fields in future.

EntityTypeMetadata

Metadata about an entity type.

Fields
inactive

bool

Whether the entity type should be considered inactive.

EvaluateProcessorVersionMetadata

Metadata of the EvaluateProcessorVersion method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

EvaluateProcessorVersionRequest

Evaluates the given ProcessorVersion against the supplied documents.

Fields
processor_version

string

Required. The resource name of the ProcessorVersion to evaluate. projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}

Authorization requires the following IAM permission on the specified resource processorVersion:

  • documentai.evaluations.create
evaluation_documents

BatchDocumentsInputConfig

Optional. The documents used in the evaluation. If unspecified, use the processor's dataset as evaluation input.

EvaluateProcessorVersionResponse

Response of the EvaluateProcessorVersion method.

Fields
evaluation

string

The resource name of the created evaluation.

Evaluation

An evaluation of a ProcessorVersion's performance.

Fields
name

string

The resource name of the evaluation. Format: projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}/evaluations/{evaluation}

create_time

Timestamp

The time that the evaluation was created.

document_counters

Counters

Counters for the documents used in the evaluation.

all_entities_metrics

MultiConfidenceMetrics

Metrics for all the entities in aggregate.

entity_metrics

map<string, MultiConfidenceMetrics>

Metrics across confidence levels, for different entities.

kms_key_name

string

The KMS key name used for encryption.

kms_key_version_name

string

The KMS key version with which data is encrypted.

ConfidenceLevelMetrics

Evaluations metrics, at a specific confidence level.

Fields
confidence_level

float

The confidence level.

metrics

Metrics

The metrics at the specific confidence level.

Counters

Evaluation counters for the documents that were used.

Fields
input_documents_count

int32

How many documents were sent for evaluation.

invalid_documents_count

int32

How many documents were not included in the evaluation as they didn't pass validation.

failed_documents_count

int32

How many documents were not included in the evaluation as Document AI failed to process them.

evaluated_documents_count

int32

How many documents were used in the evaluation.

Metrics

Evaluation metrics, either in aggregate or about a specific entity.

Fields
precision

float

The calculated precision.

recall

float

The calculated recall.

f1_score

float

The calculated f1 score.

predicted_occurrences_count

int32

The amount of occurrences in predicted documents.

ground_truth_occurrences_count

int32

The amount of occurrences in ground truth documents.

predicted_document_count

int32

The amount of documents with a predicted occurrence.

ground_truth_document_count

int32

The amount of documents with a ground truth occurrence.

true_positives_count

int32

The amount of true positives.

false_positives_count

int32

The amount of false positives.

false_negatives_count

int32

The amount of false negatives.

total_documents_count

int32

The amount of documents that had an occurrence of this label.

MultiConfidenceMetrics

Metrics across multiple confidence levels.

Fields
confidence_level_metrics[]

ConfidenceLevelMetrics

Metrics across confidence levels with fuzzy matching enabled.

confidence_level_metrics_exact[]

ConfidenceLevelMetrics

Metrics across confidence levels with only exact matching.

auprc

float

The calculated area under the precision recall curve (AUPRC), computed by integrating over all confidence thresholds.

estimated_calibration_error

float

The Estimated Calibration Error (ECE) of the confidence of the predicted entities.

auprc_exact

float

The AUPRC for metrics with fuzzy matching disabled, i.e., exact matching only.

estimated_calibration_error_exact

float

The ECE for the predicted entities with fuzzy matching disabled, i.e., exact matching only.

metrics_type

MetricsType

The metrics type for the label.

MetricsType

A type that determines how metrics should be interpreted.

Enums
METRICS_TYPE_UNSPECIFIED The metrics type is unspecified. By default, metrics without a particular specification are for leaf entity types (i.e., top-level entity types without child types, or child types which are not parent types themselves).
AGGREGATE Indicates whether metrics for this particular label type represent an aggregate of metrics for other types instead of being based on actual TP/FP/FN values for the label type. Metrics for parent (i.e., non-leaf) entity types are an aggregate of metrics for their children.

EvaluationReference

Gives a short summary of an evaluation, and links to the evaluation itself.

Fields
operation

string

The resource name of the Long Running Operation for the evaluation.

evaluation

string

The resource name of the evaluation.

aggregate_metrics

Metrics

An aggregate of the statistics for the evaluation with fuzzy matching on.

aggregate_metrics_exact

Metrics

An aggregate of the statistics for the evaluation with fuzzy matching off.

FetchProcessorTypesRequest

Request message for the FetchProcessorTypes method. Some processor types may require the project be added to an allowlist.

Fields
parent

string

Required. The location of processor types to list. Format: projects/{project}/locations/{location}.

Authorization requires the following IAM permission on the specified resource parent:

  • documentai.processorTypes.list

FetchProcessorTypesResponse

Response message for the FetchProcessorTypes method.

Fields
processor_types[]

ProcessorType

The list of processor types.

FieldExtractionMetadata

Metadata for how this field value is extracted.

Fields
summary_options

SummaryOptions

Summary options config.

GcsDocument

Specifies a document stored on Cloud Storage.

Fields
gcs_uri

string

The Cloud Storage object uri.

mime_type

string

An IANA MIME type (RFC6838) of the content.

GcsDocuments

Specifies a set of documents on Cloud Storage.

Fields
documents[]

GcsDocument

The list of documents.

GcsPrefix

Specifies all documents on Cloud Storage with a common prefix.

Fields
gcs_uri_prefix

string

The URI prefix.

GetDatasetSchemaRequest

Request for GetDatasetSchema.

Fields
name

string

Required. The dataset schema resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset/datasetSchema

visible_fields_only

bool

If set, only returns the visible fields of the schema.

GetDocumentRequest

Fields
dataset

string

Required. The resource name of the dataset that the document belongs to . Format: projects/{project}/locations/{location}/processors/{processor}/dataset

document_id

DocumentId

Required. Document identifier.

read_mask

FieldMask

If set, only fields listed here will be returned. Otherwise, all fields will be returned by default.

page_range

DocumentPageRange

List of pages for which the fields specified in the read_mask must be served.

GetDocumentResponse

Fields
document

Document

GetEvaluationRequest

Retrieves a specific Evaluation.

Fields
name

string

Required. The resource name of the Evaluation to get. projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}/evaluations/{evaluation}

Authorization requires the following IAM permission on the specified resource name:

  • documentai.evaluations.get

GetProcessorRequest

Request message for the GetProcessor method.

Fields
name

string

Required. The processor resource name.

Authorization requires the following IAM permission on the specified resource name:

  • documentai.processors.get

GetProcessorTypeRequest

Request message for the GetProcessorType method.

Fields
name

string

Required. The processor type resource name.

Authorization requires the following IAM permission on the specified resource name:

  • documentai.processorTypes.get

GetProcessorVersionRequest

Request message for the GetProcessorVersion method.

Fields
name

string

Required. The processor resource name.

Authorization requires the following IAM permission on the specified resource name:

  • documentai.processorVersions.get

HumanReviewStatus

The status of human review on a processed document.

Fields
state

State

The state of human review on the processing request.

state_message

string

A message providing more details about the human review state.

human_review_operation

string

The name of the operation triggered by the processed document. This field is populated only when the state is HUMAN_REVIEW_IN_PROGRESS. It has the same response type and metadata as the long-running operation returned by ReviewDocument.

State

The final state of human review on a processed document.

Enums
STATE_UNSPECIFIED Human review state is unspecified. Most likely due to an internal error.
SKIPPED Human review is skipped for the document. This can happen because human review isn't enabled on the processor or the processing request has been set to skip this document.
VALIDATION_PASSED Human review validation is triggered and passed, so no review is needed.
IN_PROGRESS Human review validation is triggered and the document is under review.
ERROR Some error happened during triggering human review, see the state_message for details.

ImportDocumentsMetadata

Metadata of the import document operation.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

individual_import_statuses[]

IndividualImportStatus

The list of response details of each document.

import_config_validation_results[]

ImportConfigValidationResult

Validation statuses of the batch documents import config.

total_document_count

int32

Total number of the documents that are qualified for importing.

ImportConfigValidationResult

The validation status of each import config. Status is set to an error if there are no documents to import in the import_config, or OK if the operation will try to proceed with at least one document.

Fields
input_gcs_source

string

The source Cloud Storage URI specified in the import config.

status

Status

The validation status of import config.

IndividualImportStatus

The status of each individual document in the import process.

Fields
input_gcs_source

string

The source Cloud Storage URI of the document.

status

Status

The status of the importing of the document.

output_document_id

DocumentId

The document id of imported document if it was successful, otherwise empty.

ImportDocumentsRequest

Fields
dataset

string

Required. The dataset resource name. Format: projects/{project}/locations/{location}/processors/{processor}/dataset

batch_documents_import_configs[]

BatchDocumentsImportConfig

Required. The Cloud Storage uri containing raw documents that must be imported.

BatchDocumentsImportConfig

Config for importing documents. Each batch can have its own dataset split type.

Fields
batch_input_config

BatchDocumentsInputConfig

The common config to specify a set of documents used as input.

Union field split_type_config.

split_type_config can be only one of the following:

dataset_split

DatasetSplitType

Target dataset split where the documents must be stored.

auto_split_config

AutoSplitConfig

If set, documents will be automatically split into training and test split category with the specified ratio.

AutoSplitConfig

The config for auto-split.

Fields
training_split_ratio

float

Ratio of training dataset split.

ImportDocumentsResponse

This type has no fields.

Response of the import document operation.

ImportProcessorVersionMetadata

The long-running operation metadata for the ImportProcessorVersion method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata for the long-running operation.

ImportProcessorVersionRequest

The request message for the ImportProcessorVersion method.

The Document AI Service Agent of the destination project must have Document AI Editor role on the source project.

The destination project is specified as part of the parent field. The source project is specified as part of the source or external_processor_version_source field.

Fields
parent

string

Required. The destination processor name to create the processor version in. Format: projects/{project}/locations/{location}/processors/{processor}

Authorization requires the following IAM permission on the specified resource parent:

  • documentai.processorVersions.create

Union field source.

source can be only one of the following:

processor_version_source

string

The source processor version to import from. The source processor version and destination processor need to be in the same environment and region. Note that ProcessorVersions with model_type MODEL_TYPE_LLM are not supported.

external_processor_version_source

ExternalProcessorVersionSource

The source processor version to import from. It can be from a different environment and region than the destination processor.

ExternalProcessorVersionSource

The external source processor version.

Fields
processor_version

string

Required. The processor version name. Format: projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}

service_endpoint

string

Optional. The Document AI service endpoint. For example, 'https://us-documentai.googleapis.com'

ImportProcessorVersionResponse

The response message for the ImportProcessorVersion method.

Fields
processor_version

string

The destination processor version name.

ListDocumentsRequest

Fields
dataset

string

Required. The resource name of the dataset to be listed. Format: projects/{project}/locations/{location}/processors/{processor}/dataset

page_size

int32

The maximum number of documents to return. The service may return fewer than this value. If unspecified, at most 20 documents will be returned. The maximum value is 100; values above 100 will be coerced to 100.

page_token

string

A page token, received from a previous ListDocuments call. Provide this to retrieve the subsequent page.

When paginating, all other parameters provided to ListDocuments must match the call that provided the page token.

filter

string

Optional. Query to filter the documents based on https://google.aip.dev/160.

SplitType=DATASET_SPLIT_TEST|DATASET_SPLIT_TRAIN|DATASET_SPLIT_UNASSIGNED - LabelingState=DOCUMENT_LABELED|DOCUMENT_UNLABELED|DOCUMENT_AUTO_LABELED - DisplayName=\"file_name.pdf\" - EntityType=abc/def - TagName=\"auto-labeling-running\"|\"sampled\"

Note: - Only AND, = and != are supported. e.g. DisplayName=file_name AND EntityType!=abc IS supported. - Wildcard * is supported only in DisplayName filter - No duplicate filter keys are allowed, e.g. EntityType=a AND EntityType=b is NOT supported. - String match is case sensitive (for filter DisplayName & EntityType).

return_total_size

bool

Optional. Controls if the request requires a total size of matched documents. See ListDocumentsResponse.total_size.

Enabling this flag may adversely impact performance.

Defaults to false.

skip

int32

Optional. Number of results to skip beginning from the page_token if provided. https://google.aip.dev/158#skipping-results. It must be a non-negative integer. Negative values will be rejected. Note that this is not the number of pages to skip. If this value causes the cursor to move past the end of results, ListDocumentsResponse.document_metadata and ListDocumentsResponse.next_page_token will be empty.

ListDocumentsResponse

Fields
document_metadata[]

DocumentMetadata

Document metadata corresponding to the listed documents.

next_page_token

string

A token, which can be sent as ListDocumentsRequest.page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

total_size

int32

Total count of documents queried.

ListEvaluationsRequest

Retrieves a list of evaluations for a given ProcessorVersion.

Fields
parent

string

Required. The resource name of the ProcessorVersion to list evaluations for. projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}

Authorization requires the following IAM permission on the specified resource parent:

  • documentai.evaluations.list
page_size

int32

The standard list page size. If unspecified, at most 5 evaluations are returned. The maximum value is 100. Values above 100 are coerced to 100.

page_token

string

A page token, received from a previous ListEvaluations call. Provide this to retrieve the subsequent page.

ListEvaluationsResponse

The response from ListEvaluations.

Fields
evaluations[]

Evaluation

The evaluations requested.

next_page_token

string

A token, which can be sent as page_token to retrieve the next page. If this field is omitted, there are no subsequent pages.

ListProcessorTypesRequest

Request message for the ListProcessorTypes method. Some processor types may require the project be added to an allowlist.

Fields
parent

string

Required. The location of processor types to list. Format: projects/{project}/locations/{location}.

Authorization requires the following IAM permission on the specified resource parent:

  • documentai.processorTypes.list
page_size

int32

The maximum number of processor types to return. If unspecified, at most 100 processor types will be returned. The maximum value is 500. Values above 500 will be coerced to 500.

page_token

string

Used to retrieve the next page of results, empty if at the end of the list.

ListProcessorTypesResponse

Response message for the ListProcessorTypes method.

Fields
processor_types[]

ProcessorType

The processor types.

next_page_token

string

Points to the next page, otherwise empty.

ListProcessorVersionsRequest

Request message for list all processor versions belongs to a processor.

Fields
parent

string

Required. The parent (project, location and processor) to list all versions. Format: projects/{project}/locations/{location}/processors/{processor}

Authorization requires the following IAM permission on the specified resource parent:

  • documentai.processorVersions.list
page_size

int32

The maximum number of processor versions to return. If unspecified, at most 10 processor versions will be returned. The maximum value is 20. Values above 20 will be coerced to 20.

page_token

string

We will return the processor versions sorted by creation time. The page token will point to the next processor version.

ListProcessorVersionsResponse

Response message for the ListProcessorVersions method.

Fields
processor_versions[]

ProcessorVersion

The list of processors.

next_page_token

string

Points to the next processor, otherwise empty.

ListProcessorsRequest

Request message for list all processors belongs to a project.

Fields
parent

string

Required. The parent (project and location) which owns this collection of Processors. Format: projects/{project}/locations/{location}

Authorization requires the following IAM permission on the specified resource parent:

  • documentai.processors.list
page_size

int32

The maximum number of processors to return. If unspecified, at most 50 processors will be returned. The maximum value is 100. Values above 100 will be coerced to 100.

page_token

string

We will return the processors sorted by creation time. The page token will point to the next processor.

ListProcessorsResponse

Response message for the ListProcessors method.

Fields
processors[]

Processor

The list of processors.

next_page_token

string

Points to the next processor, otherwise empty.

NormalizedVertex

A vertex represents a 2D point in the image. NOTE: the normalized vertex coordinates are relative to the original image and range from 0 to 1.

Fields
x

float

X coordinate.

y

float

Y coordinate (starts from the top of the image).

OcrConfig

Config for Document OCR.

Fields
hints

Hints

Hints for the OCR model.

enable_native_pdf_parsing

bool

Enables special handling for PDFs with existing text information. Results in better text extraction quality in such PDF inputs.

enable_image_quality_scores

bool

Enables intelligent document quality scores after OCR. Can help with diagnosing why OCR responses are of poor quality for a given input. Adds additional latency comparable to regular OCR to the process call.

advanced_ocr_options[]

string

A list of advanced OCR options to further fine-tune OCR behavior. Current valid values are:

  • legacy_layout: a heuristics layout detection algorithm, which serves as an alternative to the current ML-based layout detection algorithm. Customers can choose the best suitable layout algorithm based on their situation.
enable_symbol

bool

Includes symbol level OCR information if set to true.

compute_style_info
(deprecated)

bool

Turn on font identification model and return font style information. Deprecated, use PremiumFeatures.compute_style_info instead.

disable_character_boxes_detection

bool

Turn off character box detector in OCR engine. Character box detection is enabled by default in OCR 2.0 (and later) processors.

premium_features

PremiumFeatures

Configurations for premium OCR features.

Hints

Hints for OCR Engine

Fields
language_hints[]

string

List of BCP-47 language codes to use for OCR. In most cases, not specifying it yields the best results since it enables automatic language detection. For languages based on the Latin alphabet, setting hints is not needed. In rare cases, when the language of the text in the image is known, setting a hint will help get better results (although it will be a significant hindrance if the hint is wrong).

PremiumFeatures

Configurations for premium OCR features.

Fields
enable_selection_mark_detection

bool

Turn on selection mark detector in OCR engine. Only available in OCR 2.0 (and later) processors.

compute_style_info

bool

Turn on font identification model and return font style information.

enable_math_ocr

bool

Turn on the model that can extract LaTeX math formulas.

ProcessOptions

Options for Process API

Fields
ocr_config

OcrConfig

Only applicable to OCR_PROCESSOR and FORM_PARSER_PROCESSOR. Returns error if set on other processor types.

layout_config

LayoutConfig

Optional. Only applicable to LAYOUT_PARSER_PROCESSOR. Returns error if set on other processor types.

schema_override

DocumentSchema

Optional. Override the schema of the ProcessorVersion. Will return an Invalid Argument error if this field is set when the underlying ProcessorVersion doesn't support schema override.

Union field page_range. A subset of pages to process. If not specified, all pages are processed. If a page range is set, only the given pages are extracted and processed from the document. In the output document, Document.Page.page_number refers to the page number in the original document. This configuration only applies to online processing with ProcessDocument. page_range can be only one of the following:
individual_page_selector

IndividualPageSelector

Which pages to process (1-indexed).

from_start

int32

Only process certain pages from the start. Process all if the document has fewer pages.

from_end

int32

Only process certain pages from the end, same as above.

IndividualPageSelector

A list of individual page numbers.

Fields
pages[]

int32

Optional. Indices of the pages (starting from 1).

LayoutConfig

Serving config for layout parser processor.

Fields
chunking_config

ChunkingConfig

Optional. Config for chunking in layout parser processor.

ChunkingConfig

Serving config for chunking.

Fields
chunk_size

int32

Optional. The chunk sizes to use when splitting documents, in order of level.

include_ancestor_headings

bool

Optional. Whether or not to include ancestor headings when splitting.

semantic_chunking_group_size

bool

Optional. The number of tokens to group together when evaluating semantic similarity.

breakpoint_percentile_threshold

int32

Optional. The percentile of cosine dissimilarity that must be exceeded between a group of tokens and the next. The smaller this number is, the more chunks will be generated.

ProcessRequest

Request message for the ProcessDocument method.

Fields
name

string

Required. The resource name of the Processor or ProcessorVersion to use for processing. If a Processor is specified, the server will use its default version. Format: projects/{project}/locations/{location}/processors/{processor}, or projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}

Authorization requires one or more of the following IAM permissions on the specified resource name:

  • documentai.processors.processOnline
  • documentai.processorVersions.processOnline
document
(deprecated)

Document

The document payload, the content and mime_type fields must be set.

skip_human_review

bool

Whether human review should be skipped for this request. Default to false.

field_mask

FieldMask

Specifies which fields to include in the ProcessResponse.document output. Only supports top-level document and pages field, so it must be in the form of {document_field_name} or pages.{page_field_name}.

process_options

ProcessOptions

Inference-time options for the process API

labels

map<string, string>

Optional. The labels with user-defined metadata for the request.

Label keys and values can be no longer than 63 characters (Unicode codepoints) and can only contain lowercase letters, numeric characters, underscores, and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.

imageless_mode

bool

Optional. Option to remove images from the document.

Union field source. The document payload. source can be only one of the following:
inline_document

Document

An inline document proto.

raw_document

RawDocument

A raw document content (bytes).

gcs_document

GcsDocument

A raw document on Google Cloud Storage.

ProcessResponse

Response message for the ProcessDocument method.

Fields
document

Document

The document payload, will populate fields based on the processor's behavior.

human_review_operation
(deprecated)

string

The name of the operation triggered by the processed document. If the human review process isn't triggered, this field is empty. It has the same response type and metadata as the long-running operation returned by ReviewDocument.

human_review_status

HumanReviewStatus

The status of human review on the processed document.

Processor

The first-class citizen for Document AI. Each processor defines how to extract structural information from a document.

Fields
name

string

Output only. Immutable. The resource name of the processor. Format: projects/{project}/locations/{location}/processors/{processor}

type

string

The processor type, such as: OCR_PROCESSOR, INVOICE_PROCESSOR. To get a list of processor types, see FetchProcessorTypes.

display_name

string

The display name of the processor.

state

State

Output only. The state of the processor.

default_processor_version

string

The default processor version.

processor_version_aliases[]

ProcessorVersionAlias

Output only. The processor version aliases.

process_endpoint

string

Output only. Immutable. The http endpoint that can be called to invoke processing.

create_time

Timestamp

The time the processor was created.

kms_key_name

string

The KMS key used for encryption and decryption in CMEK scenarios.

satisfies_pzs

bool

Output only. Reserved for future use.

satisfies_pzi

bool

Output only. Reserved for future use.

State

The possible states of the processor.

Enums
STATE_UNSPECIFIED The processor is in an unspecified state.
ENABLED The processor is enabled, i.e., has an enabled version which can currently serve processing requests and all the feature dependencies have been successfully initialized.
DISABLED The processor is disabled.
ENABLING The processor is being enabled, will become ENABLED if successful.
DISABLING The processor is being disabled, will become DISABLED if successful.
CREATING The processor is being created, will become either ENABLED (for successful creation) or FAILED (for failed ones). Once a processor is in this state, it can then be used for document processing, but the feature dependencies of the processor might not be fully created yet.
FAILED The processor failed during creation or initialization of feature dependencies. The user should delete the processor and recreate one as all the functionalities of the processor are disabled.
DELETING The processor is being deleted, will be removed if successful.

ProcessorType

A processor type is responsible for performing a certain document understanding task on a certain type of document.

Fields
name

string

The resource name of the processor type. Format: projects/{project}/processorTypes/{processor_type}

type

string

The processor type, such as: OCR_PROCESSOR, INVOICE_PROCESSOR.

category

string

The processor category, used by UI to group processor types.

available_locations[]

LocationInfo

The locations in which this processor is available.

allow_creation

bool

Whether the processor type allows creation. If true, users can create a processor of this processor type. Otherwise, users need to request access.

launch_stage

LaunchStage

Launch stage of the processor type

sample_document_uris[]

string

A set of Cloud Storage URIs of sample documents for this processor.

LocationInfo

The location information about where the processor is available.

Fields
location_id

string

The location ID. For supported locations, refer to regional and multi-regional support.

ProcessorVersion

A processor version is an implementation of a processor. Each processor can have multiple versions, pretrained by Google internally or uptrained by the customer. A processor can only have one default version at a time. Its document-processing behavior is defined by that version.

Fields
name

string

Identifier. The resource name of the processor version. Format: projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}

display_name

string

The display name of the processor version.

document_schema

DocumentSchema

The schema of the processor version. Describes the output.

state

State

Output only. The state of the processor version.

create_time

Timestamp

The time the processor version was created.

latest_evaluation

EvaluationReference

The most recently invoked evaluation for the processor version.

kms_key_name

string

The KMS key name used for encryption.

kms_key_version_name

string

The KMS key version with which data is encrypted.

google_managed

bool

Output only. Denotes that this ProcessorVersion is managed by Google.

deprecation_info

DeprecationInfo

If set, information about the eventual deprecation of this version.

model_type

ModelType

Output only. The model type of this processor version.

satisfies_pzs

bool

Output only. Reserved for future use.

satisfies_pzi

bool

Output only. Reserved for future use.

gen_ai_model_info

GenAiModelInfo

Output only. Information about Generative AI model-based processor versions.

DeprecationInfo

Information about the upcoming deprecation of this processor version.

Fields
deprecation_time

Timestamp

The time at which this processor version will be deprecated.

replacement_processor_version

string

If set, the processor version that will be used as a replacement.

GenAiModelInfo

Information about Generative AI model-based processor versions.

Fields
Union field model_info. The processor version is either a pretrained Google-managed foundation model or a custom Generative AI model created by the user. model_info can be only one of the following:
foundation_gen_ai_model_info

FoundationGenAiModelInfo

Information for a pretrained Google-managed foundation model.

custom_gen_ai_model_info

CustomGenAiModelInfo

Information for a custom Generative AI model created by the user.

CustomGenAiModelInfo

Information for a custom Generative AI model created by the user. These are created with Create New Version in either the Call foundation model or Fine tuning tabs.

Fields
custom_model_type

CustomModelType

The type of custom model created by the user.

base_processor_version_id

string

The base processor version ID for the custom model.

CustomModelType

The type of custom model created by the user.

Enums
CUSTOM_MODEL_TYPE_UNSPECIFIED The model type is unspecified.
VERSIONED_FOUNDATION The model is a versioned foundation model.
FINE_TUNED The model is a finetuned foundation model.

FoundationGenAiModelInfo

Information for a pretrained Google-managed foundation model.

Fields
finetuning_allowed

bool

Whether finetuning is allowed for this base processor version.

min_train_labeled_documents

int32

The minimum number of labeled documents in the training dataset required for finetuning.

ModelType

The possible model types of the processor version.

Enums
MODEL_TYPE_UNSPECIFIED The processor version has unspecified model type.
MODEL_TYPE_GENERATIVE The processor version has generative model type.
MODEL_TYPE_CUSTOM The processor version has custom model type.

State

The possible states of the processor version.

Enums
STATE_UNSPECIFIED The processor version is in an unspecified state.
DEPLOYED The processor version is deployed and can be used for processing.
DEPLOYING The processor version is being deployed.
UNDEPLOYED The processor version is not deployed and cannot be used for processing.
UNDEPLOYING The processor version is being undeployed.
CREATING The processor version is being created.
DELETING The processor version is being deleted.
FAILED The processor version failed and is in an indeterminate state.
IMPORTING The processor version is being imported.

ProcessorVersionAlias

Contains the alias and the aliased resource name of processor version.

Fields
alias

string

The alias in the form of processor_version resource name.

processor_version

string

The resource name of aliased processor version.

PropertyMetadata

Metadata about a property.

Fields
inactive

bool

Whether the property should be considered as "inactive".

field_extraction_metadata

FieldExtractionMetadata

Field extraction metadata on the property.

RawDocument

Payload message of raw document content (bytes).

Fields
content

bytes

Inline document content.

mime_type

string

An IANA MIME type (RFC6838) indicating the nature and format of the content.

display_name

string

The display name of the document, it supports all Unicode characters except the following: *, ?, [, ], %, {, },', \", , ~, = and : are reserved. If not specified, a default ID is generated.

ReviewDocumentOperationMetadata

The long-running operation metadata for the ReviewDocument method.

Fields
state

State

Used only when Operation.done is false.

state_message

string

A message providing more details about the current state of processing. For example, the error message if the operation is failed.

create_time

Timestamp

The creation time of the operation.

update_time

Timestamp

The last update time of the operation.

common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

question_id

string

The Crowd Compute question ID.

State

State of the long-running operation.

Enums
STATE_UNSPECIFIED Unspecified state.
RUNNING Operation is still running.
CANCELLING Operation is being cancelled.
SUCCEEDED Operation succeeded.
FAILED Operation failed.
CANCELLED Operation is cancelled.

ReviewDocumentRequest

Request message for the ReviewDocument method.

Fields
human_review_config

string

Required. The resource name of the HumanReviewConfig that the document will be reviewed with.

Authorization requires the following IAM permission on the specified resource humanReviewConfig:

  • documentai.humanReviewConfigs.review
document
(deprecated)

Document

The document that needs human review.

enable_schema_validation

bool

Whether the validation should be performed on the ad-hoc review request.

priority

Priority

The priority of the human review task.

document_schema

DocumentSchema

The document schema of the human review task.

Union field source. The document payload. source can be only one of the following:
inline_document

Document

An inline document proto.

Priority

The priority level of the human review task.

Enums
DEFAULT The default priority level.
URGENT The urgent priority level. The labeling manager should allocate labeler resource to the urgent task queue to respect this priority level.

ReviewDocumentResponse

Response message for the ReviewDocument method.

Fields
gcs_destination

string

The Cloud Storage uri for the human reviewed document if the review is succeeded.

state

State

The state of the review operation.

rejection_reason

string

The reason why the review is rejected by reviewer.

State

Possible states of the review operation.

Enums
STATE_UNSPECIFIED The default value. This value is used if the state is omitted.
REJECTED The review operation is rejected by the reviewer.
SUCCEEDED The review operation is succeeded.

RevisionRef

The revision reference specifies which revision on the document to read.

Fields
Union field source. Specifies which revision to read. source can be only one of the following:
revision_case

RevisionCase

Reads the revision by the predefined case.

revision_id

string

Reads the revision given by the id.

latest_processor_version

string

Reads the revision generated by the processor version. The format takes the full resource name of processor version. projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}

RevisionCase

Some predefined revision cases.

Enums
REVISION_CASE_UNSPECIFIED Unspecified case, fall back to read the LATEST_HUMAN_REVIEW.
LATEST_HUMAN_REVIEW The latest revision made by a human.
LATEST_TIMESTAMP The latest revision based on timestamp.
BASE_OCR_REVISION The first (OCR) revision.

SetDefaultProcessorVersionMetadata

The long-running operation metadata for the SetDefaultProcessorVersion method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

SetDefaultProcessorVersionRequest

Request message for the SetDefaultProcessorVersion method.

Fields
processor

string

Required. The resource name of the Processor to change default version.

Authorization requires the following IAM permission on the specified resource processor:

  • documentai.processors.processBatch
default_processor_version

string

Required. The resource name of child ProcessorVersion to use as default. Format: projects/{project}/locations/{location}/processors/{processor}/processorVersions/{version}

SetDefaultProcessorVersionResponse

This type has no fields.

Response message for the SetDefaultProcessorVersion method.

SummaryOptions

Metadata for document summarization.

Fields
length

Length

How long the summary should be.

format

Format

The format the summary should be in.

Format

The Format enum.

Enums
FORMAT_UNSPECIFIED Default.
PARAGRAPH Format the output in paragraphs.
BULLETS Format the output in bullets.

Length

The Length enum.

Enums
LENGTH_UNSPECIFIED Default.
BRIEF A brief summary of one or two sentences.
MODERATE A paragraph-length summary.
COMPREHENSIVE The longest option available.

TrainProcessorVersionMetadata

The metadata that represents a processor version being created.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

training_dataset_validation

DatasetValidation

The training dataset validation information.

test_dataset_validation

DatasetValidation

The test dataset validation information.

DatasetValidation

The dataset validation information. This includes any and all errors with documents and the dataset.

Fields
document_error_count

int32

The total number of document errors.

dataset_error_count

int32

The total number of dataset errors.

document_errors[]

Status

Error information pertaining to specific documents. A maximum of 10 document errors will be returned. Any document with errors will not be used throughout training.

dataset_errors[]

Status

Error information for the dataset as a whole. A maximum of 10 dataset errors will be returned. A single dataset error is terminal for training.

TrainProcessorVersionRequest

Request message for the TrainProcessorVersion method.

Fields
parent

string

Required. The parent (project, location and processor) to create the new version for. Format: projects/{project}/locations/{location}/processors/{processor}.

processor_version

ProcessorVersion

Required. The processor version to be created.

Authorization requires the following IAM permission on the specified resource processorVersion:

  • documentai.processorVersions.create
document_schema

DocumentSchema

Optional. The schema the processor version will be trained with.

input_data

InputData

Optional. The input data used to train the ProcessorVersion.

base_processor_version

string

Optional. The processor version to use as a base for training. This processor version must be a child of parent. Format: projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}.

Union field processor_flags.

processor_flags can be only one of the following:

custom_document_extraction_options

CustomDocumentExtractionOptions

Options to control Custom Document Extraction (CDE) Processor.

foundation_model_tuning_options

FoundationModelTuningOptions

Options to control foundation model tuning of a processor.

CustomDocumentExtractionOptions

Options to control the training of the Custom Document Extraction (CDE) Processor.

Fields
training_method

TrainingMethod

Training method to use for CDE training.

TrainingMethod

Training Method for CDE. TRAINING_METHOD_UNSPECIFIED will fall back to MODEL_BASED.

Enums
TRAINING_METHOD_UNSPECIFIED
MODEL_BASED
TEMPLATE_BASED

FoundationModelTuningOptions

Options to control foundation model tuning of the processor.

Fields
train_steps

int32

Optional. The number of steps to run for model tuning. Valid values are between 1 and 400. If not provided, recommended steps will be used.

learning_rate_multiplier

float

Optional. The multiplier to apply to the recommended learning rate. Valid values are between 0.1 and 10. If not provided, recommended learning rate will be used.

InputData

The input data used to train a new ProcessorVersion.

Fields
training_documents

BatchDocumentsInputConfig

The documents used for training the new version.

test_documents

BatchDocumentsInputConfig

The documents used for testing the trained version.

TrainProcessorVersionResponse

The response for TrainProcessorVersion.

Fields
processor_version

string

The resource name of the processor version produced by training.

UndeployProcessorVersionMetadata

The long-running operation metadata for the UndeployProcessorVersion method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

UndeployProcessorVersionRequest

Request message for the UndeployProcessorVersion method.

Fields
name

string

Required. The processor version resource name to be undeployed.

Authorization requires the following IAM permission on the specified resource name:

  • documentai.processorVersions.update

UndeployProcessorVersionResponse

This type has no fields.

Response message for the UndeployProcessorVersion method.

UpdateDatasetOperationMetadata

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long-running operation.

UpdateDatasetRequest

Fields
dataset

Dataset

Required. The name field of the Dataset is used to identify the resource to be updated.

update_mask

FieldMask

The update mask applies to the resource.

UpdateDatasetSchemaRequest

Request for UpdateDatasetSchema.

Fields
dataset_schema

DatasetSchema

Required. The name field of the DatasetSchema is used to identify the resource to be updated.

update_mask

FieldMask

The update mask applies to the resource.

Vertex

A vertex represents a 2D point in the image. NOTE: the vertex coordinates are in the same scale as the original image.

Fields
x

int32

X coordinate.

y

int32

Y coordinate (starts from the top of the image).