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.

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.

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. The source. 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

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.

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

DocumentWarehouseConfig

Optional. Document AI Warehouse-based dataset configuration.

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.

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.

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