Document AI's `v1beta2` API is now deprecated in favor of the
[`v1`](https://docs.cloud.google.com/document-ai/docs/reference/rest/v1/projects.locations.processors) API.

Unlike `v1beta2`, Document AI [`v1`](https://docs.cloud.google.com/document-ai/docs/reference/rest/v1/projects.locations.processors)
is a stateful API, meaning you need to create a [`Processor`](https://docs.cloud.google.com/document-ai/docs/reference/rest/v1/projects.locations.processors#resource:-processor)
before you can send requests to [`Process`](https://docs.cloud.google.com/document-ai/docs/reference/rest/v1/projects.locations.processors/process)
and [`BatchProcess`](https://docs.cloud.google.com/document-ai/docs/reference/rest/v1/projects.locations.processors/batchProcess)
documents.

NOTE: This deprecation only affects the version of the API used to call any processor.
It does not affect the availability of any processor.

The major areas of v1 API backward incompatibility with v1beta2 API are discussed
later in this document.

### Creating a processor

To migrate to `v1` for processor creation, first create a [`Processor`](https://docs.cloud.google.com/document-ai/docs/reference/rest/v1/projects.locations.processors#resource:-processor). The following table serves as a general guideline for choosing an appropriate
[`ProcessorType`](https://docs.cloud.google.com/document-ai/docs/reference/rest/v1/projects.locations.processorTypes#resource:-processortype)
to create, but you can consult the full [processor list](https://docs.cloud.google.com/document-ai/docs/processors-list).

| `document_type` | `params` | Processor type |
|---|---|---|
| `invoice` |   | [`INVOICE_PROCESSOR`](https://docs.cloud.google.com/document-ai/docs/processors-list#processor_invoice-processor) |
| `general` |   | [`OCR_PROCESSOR`](https://docs.cloud.google.com/document-ai/docs/processors-list#processor_doc-ocr) |
| `general` | `table_extraction_params` | [`FORM_PARSER_PROCESSOR`](https://docs.cloud.google.com/document-ai/docs/processors-list#processor_form-parser) |
| `general` | `form_extraction_params` | [`FORM_PARSER_PROCESSOR`](https://docs.cloud.google.com/document-ai/docs/processors-list#processor_form-parser) |
| `general` | `entity_extraction_params` | [`FORM_PARSER_PROCESSOR`](https://docs.cloud.google.com/document-ai/docs/processors-list#processor_form-parser) |
| `general` | `automl_params` | [`CUSTOM_EXTRACTION_PROCESSOR`](https://docs.cloud.google.com/document-ai/docs/processors-list#processor_cde) |

For a step-by-step guide to creating a processor, view the
[guide](https://docs.cloud.google.com/document-ai/docs/create-processor).

### Processing documents

Document AI `v1` has two APIs to accept documents: [`Process`](https://docs.cloud.google.com/document-ai/docs/reference/rest/v1/projects.locations.processors/process) and [`BatchProcess`](https://docs.cloud.google.com/document-ai/docs/reference/rest/v1/projects.locations.processors/batchProcess).
Each of these methods corresponds to a method from `v1beta2`. The methods and
their differences are highlighted:

| `v1beta2` Method | `v1` Method | Migration notes |
|---|---|---|
| `ProcessDocument` | [`Process`](https://docs.cloud.google.com/document-ai/docs/reference/rest/v1/projects.locations.processors/process) | `InputConfig.Cloud Storage_source` not supported in `v1`, use `BatchProcess` to process documents on Cloud Storage. |
| `BatchProcessDocuments` | [`BatchProcess`](https://docs.cloud.google.com/document-ai/docs/reference/rest/v1/projects.locations.processors/batchProcess) | In addition to accepting individual documents on Cloud Storage, `v1` supports a Cloud Storage prefix to process many documents at once. |

### Client libraries

If using the [`Client Libraries`](https://docs.cloud.google.com/document-ai/docs/libraries) to interact with
Document AI, switch from using the `DocumentUnderstandingService` to the
`DocumentProcessorService`. For a detailed example of using the client libraries
for `v1`, see [client libraries](https://docs.cloud.google.com/document-ai/docs/libraries).