Package google.cloud.documentai.v1beta3

Index

DocumentProcessorService

Service to call Cloud DocumentAI 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 type processor that the user chose. 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.

FetchProcessorTypes

rpc FetchProcessorTypes(FetchProcessorTypesRequest) returns (FetchProcessorTypesResponse)

Fetches processor types. Note that we do not use ListProcessorTypes here because it is not 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.

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.

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.

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.

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.

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 batch process method.

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. The batch process is started by take snapshot of that document, since a user can move or change that document during the process.

status

Status

The status of the processing of the document.

output_gcs_destination

string

The output_gcs_destination (in the request as output_gcs_destination) 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 is not triggered, this field will be empty. It has the same response type and metadata as the long running operation returned by 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 batch process document method.

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 batch process.

document_output_config

DocumentOutputConfig

The overall output config for batch process.

skip_human_review

bool

Whether Human Review feature should be skipped for this request. Default to false.

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

Mimetype of the input. If the input is a raw document, the supported mimetypes are application/pdf, image/tiff, and image/gif. If the input is a [Document] proto, the type should be application/json.

BatchOutputConfig

The message for output config in batch process.

Fields
gcs_destination

string

The output Cloud Storage directory to put the processed documents.

BatchProcessResponse

Response message for batch process document method.

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 create a processor. Notice this request is sent to a regionalized backend service, and if the processor type is not available on that region, the creation will fail.

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 [display_name] to be set. Also, the processor is under CMEK if CMEK fields are set.

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

  • documentai.processors.create

DeleteProcessorMetadata

The long running operation metadata for delete processor method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long running operation.

DeleteProcessorRequest

Request message for the delete processor 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 delete processor version method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long running operation.

DeleteProcessorVersionRequest

Request message for the delete processor version 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 deploy processor version method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long running operation.

DeployProcessorVersionRequest

Request message for the deploy processor version 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

Response message for the deploy processor version method.

DisableProcessorMetadata

The long running operation metadata for disable processor method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long running operation.

DisableProcessorRequest

Request message for the disable processor 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

Response message for the disable processor 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 MIME type (also referred to as media type). For more information, see https://www.iana.org/assignments/media-types/media-types.xhtml.

text

string

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

text_styles[]

Style

Placeholder. 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. See Google Cloud Storage Request URIs for more info.

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 in the document e.g. 1600 Amphitheatre Pkwy. If the entity is not present in the document, this field will be empty.

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.

non_present

bool

Optional. This attribute indicates that the processing didn't actually identify this entity, but a confidence score was assigned that represent the potential that this could be a false negative. A non-present entity should have an empty mention_text and text_anchor.

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 int 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.

provenance

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

Provenance

The history of this annotation.

DetectedLanguage

Detected language for a structural component.

Fields
language_code

string

The BCP-47 language code, such as "en-US" or "sr-Latn". For more information, see https://www.unicode.org/reports/tr35/#Unicode_locale_identifier.

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 mime type for the image.

width

int32

Width of the image in pixels.

height

int32

Height of the image in pixels.

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

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

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.

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

Provenance

The history of this annotation.

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.

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.

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

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.
REPLACE Replace an element identified by parent.
EVAL_REQUESTED Request human review for the element identified by parent.
EVAL_APPROVED Element is reviewed and approved at human review, confidence will be set to 1.0.
EVAL_SKIPPED 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. 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.

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. https://www.w3schools.com/cssref/pr_font_weight.asp

text_style

string

Text style. Possible values are normal, italic, and oblique. https://www.w3schools.com/cssref/pr_font_font-style.asp

text_decoration

string

Text decoration. Follows CSS standard. https://www.w3schools.com/cssref/pr_text_text-decoration.asp

font_size

FontSize

Font size.

FontSize

Font size with unit.

Fields
size

float

Font size for the text.

unit

string

Unit for the font size. Follows CSS naming (in, px, pt, etc.).

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[]

Provenance

The history of this annotation.

DocumentOutputConfig

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

Fields
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.

EnableProcessorMetadata

The long running operation metadata for enable processor method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long running operation.

EnableProcessorRequest

Request message for the enable processor 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

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

FetchProcessorTypesRequest

Request message for fetch processor types.

Fields
parent

string

Required. The project of processor type to list. The available processor types may depend on the allow-listing on projects. Format: projects/{project}/locations/{location}

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

  • documentai.processorTypes.list

FetchProcessorTypesResponse

Response message for fetch processor types.

Fields
processor_types[]

ProcessorType

The list of processor types.

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.

GetProcessorRequest

Request message for get processor.

Fields
name

string

Required. The processor resource name.

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

  • documentai.processors.get

GetProcessorVersionRequest

Request message for get processor version.

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] method.

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 is not 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.

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 list processors.

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 list processors.

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).

ProcessRequest

Request message for the process document 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 feature should be skipped for this request. Default to false.

field_mask

FieldMask

Specifies which fields to include in ProcessResponse's 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).

ProcessResponse

Response message for the process document 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 is not triggered, this field will be empty. It has the same response type and metadata as the long running operation returned by ReviewDocument method.

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, e.g., OCR_PROCESSOR, INVOICE_PROCESSOR, etc. To get a list of processors 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.

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/decryption in CMEK scenarios. See https://cloud.google.com/security-key-management.

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 type of the processor, e.g., "invoice_parsing".

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

LocationInfo

The location information about where the processor is available.

Fields
location_id

string

The location id, currently must be one of [us, eu].

ProcessorVersion

A processor version is an implementation of a processor. Each processor can have multiple versions, pre-trained by Google internally or up-trained by the customer. At a time, a processor can only have one default version version. So the processor's behavior (when processing documents) is defined by a default version

Fields
name

string

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.

state

State

The state of the processor version.

create_time

Timestamp

The time the processor version was created.

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

Denotes that this ProcessorVersion is managed by google.

deprecation_info

DeprecationInfo

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

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.

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.

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].

ReviewDocumentOperationMetadata

The long running operation metadata for review document 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 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.

ReviewDocumentRequest

Request message for review document 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.

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 review document method.

Fields
gcs_destination

string

The Cloud Storage uri for the human reviewed document.

SetDefaultProcessorVersionMetadata

The long running operation metadata for set default processor version method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long running operation.

SetDefaultProcessorVersionRequest

Request message for the set default processor version 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

Response message for set default processor version method.

UndeployProcessorVersionMetadata

The long running operation metadata for the undeploy processor version method.

Fields
common_metadata

CommonOperationMetadata

The basic metadata of the long running operation.

UndeployProcessorVersionRequest

Request message for the undeploy processor version 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

Response message for the undeploy processor version method.

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).