---
title: "POST /v1/{+parent}/processorVersions:train"
method: POST
path: "/v1/{+parent}/processorVersions:train"
tags: ["projects"]
---

# POST /v1/{+parent}/processorVersions:train

`POST /v1/{+parent}/processorVersions:train`

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

## Path parameters

- `parent` string, required

## Request body

- GoogleCloudDocumentaiV1TrainProcessorVersionRequest — Request message for the TrainProcessorVersion method.
  - `baseProcessorVersion` string — Optional. The processor version to use as a base for training. This processor version must be a child of `parent`. Format: `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.
  - `documentSchema` GoogleCloudDocumentaiV1DocumentSchema — The schema defines the output of the processed document by a processor.
    - `documentPrompt` string — Optional. Document-level prompt provided by the user. This custom text is injected into the AI model's prompt to provide extra, document-wide guidance for processing.
    - `description` string — Description of the schema.
    - `entityTypes` GoogleCloudDocumentaiV1DocumentSchemaEntityType[] — Entity types of the schema.
      - `enumValues` GoogleCloudDocumentaiV1DocumentSchemaEntityTypeEnumValues — Defines the a list of enum values.
        - `values` string[] — The individual values that this enum values type can include.
      - `name` string — Name of the type. It must be unique within the schema file and cannot be a "Common Type". The following naming conventions are used: - Use `snake_casing`. - Name matching is case-sensitive. - Maximum 64 characters. - Must start with a letter. - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward compatibility, internal infrastructure and tooling can handle any ASCII character.) - The `/` is sometimes used to denote a property of a type. For example, `line_item/amount`. This convention is deprecated, but will still be honored for backward compatibility.
      - `properties` GoogleCloudDocumentaiV1DocumentSchemaEntityTypeProperty[] — Description the nested structure, or composition of an entity.
        - `occurrenceType` 'OCCURRENCE_TYPE_UNSPECIFIED' | 'OPTIONAL_ONCE' | 'OPTIONAL_MULTIPLE' | 'REQUIRED_ONCE' | 'REQUIRED_MULTIPLE' — Occurrence type limits the number of instances an entity type appears in the document.
        - `displayName` string — User defined name for the property.
        - `valueType` string — A reference to the value type of the property. This type is subject to the same conventions as the `Entity.base_types` field.
        - `method` 'METHOD_UNSPECIFIED' | 'EXTRACT' | 'DERIVE' | 'RELAXED_EXTRACT' — Specifies how the entity's value is obtained.
        - `name` string — The name of the property. Follows the same guidelines as the EntityType name.
      - `baseTypes` string[] — The entity type that this type is derived from. For now, one and only one should be set.
      - `displayName` string — User defined name for the type.
    - `displayName` string — Display name to show users.
    - `metadata` GoogleCloudDocumentaiV1DocumentSchemaMetadata — Metadata for global schema behavior.
      - `documentSplitter` boolean — If true, a `document` entity type can be applied to subdocument (splitting). Otherwise, it can only be applied to the entire document (classification).
      - `skipNamingValidation` boolean — If set, this will skip the naming format validation in the schema. So the string values in `DocumentSchema.EntityType.name` and `DocumentSchema.EntityType.Property.name` will not be checked.
      - `documentAllowMultipleLabels` boolean — If true, on a given page, there can be multiple `document` annotations covering it.
      - `prefixedNamingOnProperties` boolean — If set, all the nested entities must be prefixed with the parents.
  - `processorVersion` GoogleCloudDocumentaiV1ProcessorVersion — A processor version is an implementation of a processor. Each processor can have multiple versions, pretrained by Google internally or uptrained by the customer. A processor can only have one default version at a time. Its document-processing behavior is defined by that version.
    - `deprecationInfo` GoogleCloudDocumentaiV1ProcessorVersionDeprecationInfo — Information about the upcoming deprecation of this processor version.
      - `deprecationTime` string, google-datetime — The time at which this processor version will be deprecated.
      - `replacementProcessorVersion` string — If set, the processor version that will be used as a replacement.
    - `satisfiesPzi` boolean — Output only. Reserved for future use.
    - `name` string — Identifier. The resource name of the processor version. Format: `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processor_version}`
    - `googleManaged` boolean — Output only. Denotes that this `ProcessorVersion` is managed by Google.
    - `satisfiesPzs` boolean — Output only. Reserved for future use.
    - `state` 'STATE_UNSPECIFIED' | 'DEPLOYED' | 'DEPLOYING' | 'UNDEPLOYED' | 'UNDEPLOYING' | 'CREATING' | 'DELETING' | 'FAILED' | 'IMPORTING' — Output only. The state of the processor version.
    - `createTime` string, google-datetime — Output only. The time the processor version was created.
    - `genAiModelInfo` GoogleCloudDocumentaiV1ProcessorVersionGenAiModelInfo — Information about Generative AI model-based processor versions.
      - `customGenAiModelInfo` GoogleCloudDocumentaiV1ProcessorVersionGenAiModelInfoCustomGenAiModelInfo — Information for a custom Generative AI model created by the user. These are created with `Create New Version` in either the `Call foundation model` or `Fine tuning` tabs.
        - `customModelType` 'CUSTOM_MODEL_TYPE_UNSPECIFIED' | 'VERSIONED_FOUNDATION' | 'FINE_TUNED' — The type of custom model created by the user.
        - `baseProcessorVersionId` string — The base processor version ID for the custom model.
      - `foundationGenAiModelInfo` GoogleCloudDocumentaiV1ProcessorVersionGenAiModelInfoFoundationGenAiModelInfo — Information for a pretrained Google-managed foundation model.
        - `finetuningAllowed` boolean — Whether fine tuning is allowed for this base processor version.
        - `minTrainLabeledDocuments` integer — The minimum number of labeled documents in the training dataset required for fine tuning.
    - `documentSchema` GoogleCloudDocumentaiV1DocumentSchema — The schema defines the output of the processed document by a processor.
      - `documentPrompt` string — Optional. Document-level prompt provided by the user. This custom text is injected into the AI model's prompt to provide extra, document-wide guidance for processing.
      - `description` string — Description of the schema.
      - `entityTypes` GoogleCloudDocumentaiV1DocumentSchemaEntityType[] — Entity types of the schema.
        - `enumValues` GoogleCloudDocumentaiV1DocumentSchemaEntityTypeEnumValues — Defines the a list of enum values.
          - `values` string[] — The individual values that this enum values type can include.
        - `name` string — Name of the type. It must be unique within the schema file and cannot be a "Common Type". The following naming conventions are used: - Use `snake_casing`. - Name matching is case-sensitive. - Maximum 64 characters. - Must start with a letter. - Allowed characters: ASCII letters `[a-z0-9_-]`. (For backward compatibility, internal infrastructure and tooling can handle any ASCII character.) - The `/` is sometimes used to denote a property of a type. For example, `line_item/amount`. This convention is deprecated, but will still be honored for backward compatibility.
        - `properties` GoogleCloudDocumentaiV1DocumentSchemaEntityTypeProperty[] — Description the nested structure, or composition of an entity.
          - `occurrenceType` 'OCCURRENCE_TYPE_UNSPECIFIED' | 'OPTIONAL_ONCE' | 'OPTIONAL_MULTIPLE' | 'REQUIRED_ONCE' | 'REQUIRED_MULTIPLE' — Occurrence type limits the number of instances an entity type appears in the document.
          - `displayName` string — User defined name for the property.
          - `valueType` string — A reference to the value type of the property. This type is subject to the same conventions as the `Entity.base_types` field.
          - `method` 'METHOD_UNSPECIFIED' | 'EXTRACT' | 'DERIVE' | 'RELAXED_EXTRACT' — Specifies how the entity's value is obtained.
          - `name` string — The name of the property. Follows the same guidelines as the EntityType name.
        - `baseTypes` string[] — The entity type that this type is derived from. For now, one and only one should be set.
        - `displayName` string — User defined name for the type.
      - `displayName` string — Display name to show users.
      - `metadata` GoogleCloudDocumentaiV1DocumentSchemaMetadata — Metadata for global schema behavior.
        - `documentSplitter` boolean — If true, a `document` entity type can be applied to subdocument (splitting). Otherwise, it can only be applied to the entire document (classification).
        - `skipNamingValidation` boolean — If set, this will skip the naming format validation in the schema. So the string values in `DocumentSchema.EntityType.name` and `DocumentSchema.EntityType.Property.name` will not be checked.
        - `documentAllowMultipleLabels` boolean — If true, on a given page, there can be multiple `document` annotations covering it.
        - `prefixedNamingOnProperties` boolean — If set, all the nested entities must be prefixed with the parents.
    - `modelType` 'MODEL_TYPE_UNSPECIFIED' | 'MODEL_TYPE_GENERATIVE' | 'MODEL_TYPE_CUSTOM' — Output only. The model type of this processor version.
    - `latestEvaluation` GoogleCloudDocumentaiV1EvaluationReference — Gives a short summary of an evaluation, and links to the evaluation itself.
      - `operation` string — The resource name of the Long Running Operation for the evaluation.
      - `aggregateMetricsExact` GoogleCloudDocumentaiV1EvaluationMetrics — Evaluation metrics, either in aggregate or about a specific entity.
        - `precision` number, float — The calculated precision.
        - `predictedDocumentCount` integer — The amount of documents with a predicted occurrence.
        - `groundTruthDocumentCount` integer — The amount of documents with a ground truth occurrence.
        - `falsePositivesCount` integer — The amount of false positives.
        - `predictedOccurrencesCount` integer — The amount of occurrences in predicted documents.
        - `f1Score` number, float — The calculated F1 score.
        - `truePositivesCount` integer — The amount of true positives.
        - `totalDocumentsCount` integer — The amount of documents that had an occurrence of this label.
        - `recall` number, float — The calculated recall.
        - `falseNegativesCount` integer — The amount of false negatives.
        - `groundTruthOccurrencesCount` integer — The amount of occurrences in ground truth documents.
      - `evaluation` string — The resource name of the evaluation.
      - `aggregateMetrics` GoogleCloudDocumentaiV1EvaluationMetrics — Evaluation metrics, either in aggregate or about a specific entity.
        - `precision` number, float — The calculated precision.
        - `predictedDocumentCount` integer — The amount of documents with a predicted occurrence.
        - `groundTruthDocumentCount` integer — The amount of documents with a ground truth occurrence.
        - `falsePositivesCount` integer — The amount of false positives.
        - `predictedOccurrencesCount` integer — The amount of occurrences in predicted documents.
        - `f1Score` number, float — The calculated F1 score.
        - `truePositivesCount` integer — The amount of true positives.
        - `totalDocumentsCount` integer — The amount of documents that had an occurrence of this label.
        - `recall` number, float — The calculated recall.
        - `falseNegativesCount` integer — The amount of false negatives.
        - `groundTruthOccurrencesCount` integer — The amount of occurrences in ground truth documents.
    - `kmsKeyName` string — Output only. The KMS key name used for encryption.
    - `displayName` string — The display name of the processor version.
    - `kmsKeyVersionName` string — Output only. The KMS key version with which data is encrypted.
  - `customDocumentExtractionOptions` GoogleCloudDocumentaiV1TrainProcessorVersionRequestCustomDocumentExtractionOptions — Options to control the training of the Custom Document Extraction (CDE) Processor.
    - `trainingMethod` 'TRAINING_METHOD_UNSPECIFIED' | 'MODEL_BASED' | 'TEMPLATE_BASED' — Optional. Training method to use for CDE training.
  - `inputData` GoogleCloudDocumentaiV1TrainProcessorVersionRequestInputData — The input data used to train a new ProcessorVersion.
    - `trainingDocuments` GoogleCloudDocumentaiV1BatchDocumentsInputConfig — The common config to specify a set of documents used as input.
      - `gcsPrefix` GoogleCloudDocumentaiV1GcsPrefix — Specifies all documents on Cloud Storage with a common prefix.
        - `gcsUriPrefix` string — The URI prefix.
      - `gcsDocuments` GoogleCloudDocumentaiV1GcsDocuments — Specifies a set of documents on Cloud Storage.
        - `documents` GoogleCloudDocumentaiV1GcsDocument[] — The list of documents.
          - `gcsUri` string — The Cloud Storage object uri.
          - `mimeType` string — An IANA MIME type (RFC6838) of the content.
    - `testDocuments` GoogleCloudDocumentaiV1BatchDocumentsInputConfig — The common config to specify a set of documents used as input.
      - `gcsPrefix` GoogleCloudDocumentaiV1GcsPrefix — Specifies all documents on Cloud Storage with a common prefix.
        - `gcsUriPrefix` string — The URI prefix.
      - `gcsDocuments` GoogleCloudDocumentaiV1GcsDocuments — Specifies a set of documents on Cloud Storage.
        - `documents` GoogleCloudDocumentaiV1GcsDocument[] — The list of documents.
          - `gcsUri` string — The Cloud Storage object uri.
          - `mimeType` string — An IANA MIME type (RFC6838) of the content.
  - `foundationModelTuningOptions` GoogleCloudDocumentaiV1TrainProcessorVersionRequestFoundationModelTuningOptions — Options to control foundation model tuning of the processor.
    - `trainSteps` integer — Optional. The number of steps to run for model tuning. Valid values are between 1 and 400. If not provided, recommended steps will be used.
    - `learningRateMultiplier` number, float — Optional. The multiplier to apply to the recommended learning rate. Valid values are between 0.1 and 10. If not provided, recommended learning rate will be used.
    - `previousFineTunedProcessorVersionName` string — Optional. Resource name of a previously fine tuned version ID to copy the overwritten configs from. The base_processor_version should be newer than the base processor version used to fine tune this provided processor version. Format: `projects/{project}/locations/{location}/processors/{processor}/processorVersions/{processorVersion}`.

## Response `200`

Successful response

---

[API](https://skmtc.dev/google/apis/documentai.md) · [All operations](https://skmtc.dev/google/apis/documentai/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/google/documentai/revisions/88d43b76c9f3/schema)
