Managing processor versions
New versions are released for a variety of reasons, for example, to improve accuracy, increase availability, and support new document elements, such as selection marks.
Given that Document AI is powered by generative AI, future versions are using new foundation models so you can benefit from generative AI enhancements.
As we improve foundation models, earlier foundation models are deprecated. Similarly, processor versions are deprecated six months after new versions are released.
A processor can have one of the following versions:
- Stable version
- Release candidate (RC)
- Customized version and its associated base version
This page describes how processors are versioned, and how to view and select a particular version.
Processor versions overview
There are two categories of processor versions:
- Google versions are either stable (for production use cases) or release candidates (experimental with latest functionality).
- User versions are created by you to customize predictions for your documents and have alphanumeric version IDs.
Google versions
Each Google version is identified by a Version ID, for example pretrained-TYPE-vX.X-YYYY-MM-DD
.
Each processor version Google offers is named either Google Stable or Google Release Candidate (RC).
Google stable versions
Stable versions are production-quality and ready for use.
- Google prioritizes stability of the processor behaviour, but still includes critical fixes.
- Earlier Google stable versions are deprecated six months after the newest stable version is released as depicted in the following figure.
Google release candidates (RC)
Release candidates are experimental and are upgraded regularly with the latest features. These are not production-quality versions, and their stability may vary.
Customized versions
Customized versions are the processor versions that you can create based on your
documents to customize predictions.
Customized versions have a Type
, which shows the kind of model used for predictions. If you create a version
using a foundation model (either by creating a version or fine tuning), then the type is Generative AI.
If you create a processor version by training a smaller, custom model (either model or template based), then the type is Custom.
If you create processor versions, you decide the name and ID.
Base versions
If you create a processor version, the "base version" shows which Google version powers your customized user version. The base version dictates the lifecycle of your user version. You need to make decisions about how to manage the lifecycle of your customized user version.
Available stable processor versions
Custom extractor | Release date | Deprecation date |
---|---|---|
pretrained-foundation-model-v1.3-2024-08-31 | May 28, 2024 | Not applicable |
pretrained-foundation-model-v1.2-2024-05-10 | May 28, 2024 | Not applicable |
pretrained-foundation-model-v1.0-2023-08-22 | January 9, 2024 | April 9, 2025 |
Bank statement | Release date | Deprecation date |
---|---|---|
pretrained-bankstatement-v3.0-2022-05-16 | May 16, 2022 | Not applicable |
pretrained-bankstatement-v2.0-2021-12-10 | December 10, 2021 | Not applicable |
pretrained-bankstatement-v1.1-2021-08-13 | August 13, 2021 | Not applicable |
pretrained-bankstatement-v1.0-2021-08-08 | August 8, 2021 | Not applicable |
Expense | Release date | Deprecation date |
---|---|---|
pretrained-expense-v1.3-2022-07-15 | July 15, 2022 | Will be discontinued in the United States (US) and European Union (EU) effective April 30, 2025. |
pretrained-expense-v1.2-2022-02-18 | February 18, 2022 | Will be discontinued in the United States (US) and European Union (EU) effective April 30, 2025. |
pretrained-expense-v1.1-2021-04-09 | April 9, 2021 | Not applicable |
Identity proofing | Release date | Deprecation date |
---|---|---|
pretrained-id-proofing-v1.0-2022-10-03 | October 3, 2022 | Not applicable |
Invoice | Release date | Deprecation date |
---|---|---|
pretrained-invoice-v1.3-2022-07-15 | July 15, 2022 | Not applicable |
pretrained-invoice-v1.2-2022-02-18 | February 18, 2022 | Not applicable |
pretrained-invoice-v1.1-2021-04-09 | April 9, 2021 | Not applicable |
US driver license | Release date | Deprecation date |
---|---|---|
pretrained-us-driver-license-v1.0-2021-06-14 | June 14, 2021 | Not applicable |
US passport | Release date | Deprecation date |
---|---|---|
pretrained-us-passport-v1.0-2021-06-14 | June 14, 2021 | Not applicable |
Paystub | Release date | Deprecation date |
---|---|---|
pretrained-paystub-v2.0-2022-07-22 | July 22, 2022 | Not applicable |
pretrained-paystub-v1.2-2021-12-10 | December 10, 2021 | Not applicable |
pretrained-paystub-v1.1-2021-08-13 | August 13, 2021 | Not applicable |
pretrained-paystub-v1.0-2021-03-19 | March 19, 2021 | Not applicable |
W2 | Release date | Deprecation date |
---|---|---|
pretrained-w2-v2.1-2022-06-08 | June 8, 2022 | Not applicable |
pretrained-w2-v1.2-2022-01-28 | January 28, 2022 | Not applicable |
pretrained-w2-v1.1-2022-01-27 | January 27, 2022 | March 31, 2024 |
pretrained-w2-v1.0-2020-10-01 | October 1, 2020 | March 31, 2024 |
Processor version lifecycle
As soon as a new Google version is available, you should create and evaluate new user versions with the new base version. Then, deploy your new version and undeploy (or delete) earlier user versions that use the prior stable version as their base. Stable versions are discontinued after a new one is released. Google gives you at least six months' notice when this occurs.
What happens when a base version is deprecated?
User versions depending on earlier base versions stop returning predictions when the base version is deprecated.
How are processor versions selected for your requests?
When you call a processor endpoint without specifying the processor version, the default processor version is used. When the default processor version changes, you might need to update the code.
Endpoint used | Experience |
---|---|
If you do not specify a processor version ID | Requests processed using a new default processor version. If your default processor version is deprecated, the default updates to the most recently launched stable Google version when the older default version is deprecated. |
If you specify the processor version ID | The response fails if you call a processor endpoint and specify a version ID which has been deprecated. |
Deprecation example of a customized version
Consider the following scenario that describes the sequence of events in a customized version deprecation:
As a developer, you're using a Custom Extractor to get data from documents. Given the complexity and volume of documents you process, you fine tune the foundation model to create a version named
fine-tune-A
. You set thefine-tune-A
version as the default version for your processor and use it to process documents. The base version that powers thefine-tune-A
model is thepretrained-foundation-model-v1.0-2023-08-22 (v1.0)
stable version.Google published a new stable version named
pretrained-foundation-model-v1.2-2024-05-10 (v1.2)
and announced that thev1.0
stable version is to be deprecated on April 9, 2025.Since you kept your training and test documents in your processor's dataset, you fine-tune another version based on the newest Google stable version,
v1.2
, and name itfine-tune-B
. After you evaluate its performance, you set thefine-tune-B
version as the new default version for your processor and decommission thefine-tune-A
version. Your new version now uses the latest supported Google stable version.
On the other hand, had you not created and evaluated the customized fine-tune-B
version,
then Google would have updated the default version of your processor to v1.2
on April 9, 2025.
Because you are calling the processor's endpoint and not specifying a processor version, the new
v1.2
version is used as the new default to process your requests.
Deprecation and migration resources
For deprecated parsers and processors, you can consult Document AI deprecations.
See the following resources for migrations:
For creation and training of a new Expense Parser, you can refer to uptrain pretrained processor.
For creation and tuning of a new Custom Extractor processor, you can refer to Custom Extractor with GenAI.
Select a processor version
There are three ways to specify which processor version to use for online and batch processing:
If you do not specify a version, the processor's default is used.
- Example:
projects/my-proj/locations/us/processors/my-processor:process
- Example:
If you specify a version, then that specific version is used. If the specific version does not exist, the request fails with an error.
- Example:
projects/my-proj/locations/us/processors/my-processor/processorVersions/pretrained-invoice-v1.2-2022-02-18:process
- Example:
If you specify a channel then the latest version in that channel is used. (Options:
stable
,rc
)- Example:
projects/my-proj/locations/us/processors/my-processor/processorVersions/stable:process
- Example:
View available version
Console
In the Google Cloud console, in the Document AI section, go to the Processors page.
From the list of processors, click the name of the processor that you want to view details for.
Select the Manage Versions (or Deploy & use) tab, which will display all of the available processor versions.
REST
This sample shows how to list the available processor versions for your
processor using the processorVersions.list
method.
Before using any of the request data, make the following replacements:
- LOCATION: your processor's location, for example:
us
- United Stateseu
- European Union
- PROJECT_ID: Your Google Cloud project ID.
- PROCESSOR_ID: the ID of your custom processor.
HTTP method and URL:
GET https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions
To send your request, choose one of these options:
curl
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions"
PowerShell
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions" | Select-Object -Expand Content
The response contains a list of
ProcessorVersions
,
which contains information about each processor version such as its
name
, state
, and other details.
{ "processorVersions": [ { "name": "projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/pretrained-ocr-v1.1-2022-09-12", "displayName": "Google Release Candidate", "state": "DEPLOYED", "createTime": "2022-09-13T23:39:12.156648Z", "googleManaged": true }, { "name": "projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/pretrained-ocr-v1.0-2020-09-23", "displayName": "Google Stable", "state": "DEPLOYED", "createTime": "2022-09-12T23:35:09.829557Z", "googleManaged": true, "deprecationInfo": { "deprecationTime": "1970-01-01T00:00:00Z" } } ] }
C#
For more information, see the Document AI C# API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
For more information, see the Document AI Go API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
For more information, see the Document AI Java API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
For more information, see the Document AI Python API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
For more information, see the Document AI Ruby API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
View details about a version
Console
In the Google Cloud console, in the Document AI section, go to the Processors page.
From the list of processors, click the name of the processor that you want to view details for.
Select the Manage Versions (or Deploy & use) tab, which will display all of the available processor versions and their details.
REST
This sample shows how to get details about a processor version for your
processor using the processorVersions.get
method.
Before using any of the request data, make the following replacements:
- LOCATION: your processor's location, for example:
us
- United Stateseu
- European Union
- PROJECT_ID: Your Google Cloud project ID.
- PROCESSOR_ID: the ID of your custom processor.
- PROCESSOR_VERSION: the processor version identifier. Refer to Select a processor version for more information. For example:
pretrained-TYPE-vX.X-YYYY-MM-DD
stable
rc
HTTP method and URL:
GET https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION
To send your request, choose one of these options:
curl
Execute the following command:
curl -X GET \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION"
PowerShell
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method GET `
-Headers $headers `
-Uri "https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION" | Select-Object -Expand Content
The response is a
ProcessorVersion
,
which contains information about the processor version such as its
name
, state
, and other details.
{ "name": "projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/pretrained-ocr-v1.1-2022-09-12", "displayName": "Google Release Candidate", "state": "DEPLOYED", "createTime": "2022-09-13T23:39:12.156648Z", "googleManaged": true }
C#
For more information, see the Document AI C# API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
For more information, see the Document AI Go API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
For more information, see the Document AI Java API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
For more information, see the Document AI Python API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
For more information, see the Document AI Ruby API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Change the default version
A processor's default version specifies the version that is used to process documents when you don't specify a specific version. When you create a processor, the initial default version is the latest version in the stable channel.
If you change the default version, incoming requests are processed using the newly selected version. If you change the default version while the processor is in the middle of a request, the request will continue to use the previously selected version.
To change the default version:
Console
In the Google Cloud console, in the Document AI section, go to the Processors page.
From the list of processors, click the name of the processor that you want to view details for.
In the processor's Manage Versions (or Deploy & use) tab, in the Default version dropdown menu, choose a version of the processor that you want to use as the default version.
REST
This sample shows how to set the default processor version for your
processor using the
processors.setDefaultProcessorVersion
method.
Before using any of the request data, make the following replacements:
- LOCATION: your processor's location, for example:
us
- United Stateseu
- European Union
- PROJECT_ID: Your Google Cloud project ID.
- PROCESSOR_ID: the ID of your custom processor.
- PROCESSOR_VERSION: the processor version identifier. Refer to Select a processor version for more information. For example:
pretrained-TYPE-vX.X-YYYY-MM-DD
stable
rc
HTTP method and URL:
POST https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID:setDefaultProcessorVersion
Request JSON body:
{ "defaultProcessorVersion": "PROCESSOR_VERSION" }
To send your request, choose one of these options:
curl
Save the request body in a file named request.json
,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID:setDefaultProcessorVersion"
PowerShell
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID:setDefaultProcessorVersion" | Select-Object -Expand Content
The response is a long running operation. To poll the long-running operation, call operations.get
The SetDefaultProcessorVersionMetadata
in the response indicates the state of the operation.
{ "name": "projects/PROJECT_ID/locations/LOCATION/operations/OPERATION", "metadata": { "@type": "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionMetadata", "commonMetadata": { "state": "SUCCEEDED", "createTime": "2022-03-02T22:52:49.957096Z", "updateTime": "2022-03-02T22:52:50.175976Z", "resource": "projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION" } }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.documentai.v1.SetDefaultProcessorVersionResponse" } }
C#
For more information, see the Document AI C# API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
For more information, see the Document AI Go API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
For more information, see the Document AI Java API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
For more information, see the Document AI Python API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
For more information, see the Document AI Ruby API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Deploy a processor version
After creating a new processor version with Document AI, you will need to deploy it before you can process documents with this version.
Console
In the Google Cloud console, in the Document AI section, go to the Processors page.
From the list of processors, click the name of the processor that you want to view details for.
In the processor's Manage Versions (or Deploy & use) tab, select the checkbox next to the processor version you want to deploy.
Click Deploy, then again click Deploy on the dialog window. This process takes a few minutes.
REST
This sample shows how to deploy a processor version for your
processor using the
processorVersions.deploy
method.
Before using any of the request data, make the following replacements:
- LOCATION: your processor's location, for example:
us
- United Stateseu
- European Union
- PROJECT_ID: Your Google Cloud project ID.
- PROCESSOR_ID: the ID of your custom processor.
- PROCESSOR_VERSION: the processor version identifier.
HTTP method and URL:
POST https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION:deploy
To send your request, choose one of these options:
curl
Execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION:deploy"
PowerShell
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION:deploy" | Select-Object -Expand Content
The response is a long running operation. To poll the long-running operation, call operations.get
The DeployProcessorVersionMetadata
in the response indicates the state of the operation.
{ "name": "projects/PROJECT_ID/locations/LOCATION/operations/OPERATION", "metadata": { "@type": "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionMetadata", "commonMetadata": { "state": "SUCCEEDED", "createTime": "2022-08-29T16:27:00.195539Z", "updateTime": "2022-08-29T16:32:01.963962Z", "resource": "projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION" } }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.documentai.v1.DeployProcessorVersionResponse" } }
C#
For more information, see the Document AI C# API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
For more information, see the Document AI Go API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
For more information, see the Document AI Java API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
For more information, see the Document AI Python API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
For more information, see the Document AI Ruby API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Undeploy a processor version
After creating a new processor version with Document AI and deploying it, you can undeploy it if you don't want the processor version to be able to handle processing requests.
Console
In the Google Cloud console, in the Document AI section, go to the Processors page.
From the list of processors, click the name of the processor that you want to view details for.
In the processor's Manage Versions (or Deploy & use) tab, select the checkbox next to the processor version you want to undeploy.
Click Undeploy, then again click Undeploy on the dialog window. This process takes a few minutes.
REST
This sample shows how to undeploy a processor version for your processor using the
processorVersions.undeploy
method.
Before using any of the request data, make the following replacements:
- LOCATION: your processor's location, for example:
us
- United Stateseu
- European Union
- PROJECT_ID: Your Google Cloud project ID.
- PROCESSOR_ID: the ID of your custom processor.
- PROCESSOR_VERSION: the processor version identifier.
HTTP method and URL:
POST https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION:undeploy
To send your request, choose one of these options:
curl
Execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d "" \
"https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION:undeploy"
PowerShell
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-Uri "https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION:undeploy" | Select-Object -Expand Content
The response is a long running operation. To poll the long-running operation, call operations.get
The UndeployProcessorVersionMetadata
in the response indicates the state of the operation.
{ "name": "projects/PROJECT_ID/locations/LOCATION/operations/OPERATION", "metadata": { "@type": "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionMetadata", "commonMetadata": { "state": "SUCCEEDED", "createTime": "2022-08-29T16:27:00.195539Z", "updateTime": "2022-08-29T16:32:01.963962Z", "resource": "projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION" } }, "done": true, "response": { "@type": "type.googleapis.com/google.cloud.documentai.v1.UndeployProcessorVersionResponse" } }
C#
For more information, see the Document AI C# API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
For more information, see the Document AI Go API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
For more information, see the Document AI Java API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
For more information, see the Document AI Python API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
For more information, see the Document AI Ruby API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Delete a processor version
After creating a new processor version with Document AI, you can delete it if you have no further use for the processor version.
Console
In the Google Cloud console, in the Document AI section, go to the Processors page.
From the list of processors, click the name of the processor that you want to view details for.
In the processor's Manage Versions (or Deploy & use) tab, click the action menu
next to the processor version you want to delete.Click Delete, then again click Delete on the dialog window.
REST
This sample shows how to delete a processor version for your processor using the
processorVersions.delete
method.
Before using any of the request data, make the following replacements:
- LOCATION: your processor's location, for example:
us
- United Stateseu
- European Union
- PROJECT_ID: Your Google Cloud project ID.
- PROCESSOR_ID: the ID of your custom processor.
- PROCESSOR_VERSION: the processor version identifier.
HTTP method and URL:
DELETE https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION
To send your request, choose one of these options:
curl
Execute the following command:
curl -X DELETE \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
"https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION"
PowerShell
Execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method DELETE `
-Headers $headers `
-Uri "https://LOCATION-documentai.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION" | Select-Object -Expand Content
The response is a long running operation. To poll the long-running operation, call operations.get
The DeleteProcessorVersionMetadata
in the response indicates the state of the operation.
{ "name": "projects/PROJECT_ID/locations/LOCATION/operations/OPERATION", "metadata": { "@type": "type.googleapis.com/google.cloud.documentai.v1.DeleteProcessorVersionMetadata", "commonMetadata": { "state": "SUCCEEDED", "createTime": "2022-08-29T16:27:00.195539Z", "updateTime": "2022-08-29T16:32:01.963962Z", "resource": "projects/PROJECT_ID/locations/LOCATION/processors/PROCESSOR_ID/processorVersions/PROCESSOR_VERSION" } }, "done": true, "response": { "@type": "type.googleapis.com/google.protobuf.Empty" } }
C#
For more information, see the Document AI C# API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Go
For more information, see the Document AI Go API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Java
For more information, see the Document AI Java API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Python
For more information, see the Document AI Python API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Ruby
For more information, see the Document AI Ruby API reference documentation.
To authenticate to Document AI, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Import a processor version
After creating a new processor with Document AI, you can import a processor version from the same or a different project.
The destination project
is where you begin the import and where the processor version becomes available after the import.
The source project
is where the source processor version lives.
The source or destination processors must meet the following requirements to import:
- Processor types must match. Examples:
CUSTOM_EXTRACTION_PROCESSOR
orINVOICE_PROCESSOR
- Processor schemas must not conflict.
- Destination processor can have existing datasets and versions.
- Destination processor must be in
ENABLED
state. - Source processor version must be in one of the following states:
DEPLOYED
DEPLOYING
UNDEPLOYED
UNDEPLOYING
You must grant the DocumentAI Core Service Agent of the destination project Document AI Editor permission on the source project to avoid a permission denied error.
Complete the following steps to set up permission before importing a processor version:
Console
Look up DocumentAI Core Service Agent and fill in your destination project number. The DocumentAI Core Service Agent is formatted like an email address. For example:
service-123@gcp-sa-prod-dai-core.iam.gserviceaccount.com
Open the IAM page in the Google Cloud console.
Select your source project.
Click grant access.
Add the destination project's DocumentAI Core Service Agent as a new principal, and assign Document AI Editor role.
gcloud
Use the following gcloud
command to grant the necessary permissions:
gcloud projects add-iam-policy-binding SOURCE_PROJECT \ --member=serviceAccount:service-DESTINATION_PROJECT NUMBER@gcp-sa-prod-dai-core.iam.gserviceaccount.com \ --role=roles/documentai.editor
Provide the following values:
SOURCE_PROJECT
: The source project number or project id.DESTINATION_PROJECT NUMBER
: The destination project number.
After updating the permissions, use the following steps to import a processor version:
Console
In the Google Cloud console, in the Document AI section, go to the Processors page.
From the list of processors, click the name of the processor that you want to import a processor version to as a destination processor.
Go to the Manage Versions (or Deploy & use) tab, and click Import.
Choose the project, the processor, and the processor version as the source processor version in the window.
Click IMPORT button in the window, and the import operation will start.
REST
This sample shows you how to use the
processorVersions.importProcessorVersion
method to import a processor version.
Before using any of the request data, make the following replacements:
- Destination Project
- DESTINATION_PROJECT_ID: your destination Google Cloud project ID.
- DESTINATION_LOCATION: your destination processor's location.
- DESTINATION_PROCESSOR_ID: the ID of your destination processor.
- Source Project
- SOURCE_PROJECT_ID: your source Google Cloud project ID.
- SOURCE_LOCATION: the source processor's location.
- SOURCE_PROCESSOR_ID: the ID of your source processor.
- SOURCE_PROCESSOR_VERSION: the source processor version to import.
HTTP method and URL:
POST https://DESTINATION_LOCATION-documentai.googleapis.com/v1beta3/projects/DESTINATION_PROJECT_ID/locations/DESTINATION_LOCATION/processors/DESTINATION_PROCESSOR_ID/processorVersions:importProcessorVersion
Request JSON body:
{ "processorVersionSource": "projects/SOURCE_PROJECT_ID/locations/SOURCE_LOCATION/processors/SOURCE_PROCESSOR_ID/processorVersions/SOURCE_PROCESSOR_VERSION" }
To send your request, choose one of these options:
curl
Save the request body in a file named request.json
,
and execute the following command:
curl -X POST \
-H "Authorization: Bearer $(gcloud auth print-access-token)" \
-H "Content-Type: application/json; charset=utf-8" \
-d @request.json \
"https://DESTINATION_LOCATION-documentai.googleapis.com/v1beta3/projects/DESTINATION_PROJECT_ID/locations/DESTINATION_LOCATION/processors/DESTINATION_PROCESSOR_ID/processorVersions:importProcessorVersion"
PowerShell
Save the request body in a file named request.json
,
and execute the following command:
$cred = gcloud auth print-access-token
$headers = @{ "Authorization" = "Bearer $cred" }
Invoke-WebRequest `
-Method POST `
-Headers $headers `
-ContentType: "application/json; charset=utf-8" `
-InFile request.json `
-Uri "https://DESTINATION_LOCATION-documentai.googleapis.com/v1beta3/projects/DESTINATION_PROJECT_ID/locations/DESTINATION_LOCATION/processors/DESTINATION_PROCESSOR_ID/processorVersions:importProcessorVersion" | Select-Object -Expand Content
You should receive a JSON response similar to the following:
{ "name": "projects/DESTINATION_PROJECT_ID/locations/DESTINATION_LOCATION/operations/OPERATION_ID" }
What's next?
- Learn how to set up Document AI.
- Review the processors list.