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

# POST /v1/{+parent}/files:asyncBatchAnnotate

`POST /v1/{+parent}/files:asyncBatchAnnotate`

Run asynchronous image detection and annotation for a list of generic files, such as PDF files, which may contain multiple pages and multiple images per page. Progress and results can be retrieved through the `google.longrunning.Operations` interface. `Operation.metadata` contains `OperationMetadata` (metadata). `Operation.response` contains `AsyncBatchAnnotateFilesResponse` (results).

## Path parameters

- `parent` string, required

## Request body

- AsyncBatchAnnotateFilesRequest — Multiple async file annotation requests are batched into a single service call.
  - `requests` AsyncAnnotateFileRequest[] — Required. Individual async file annotation requests for this batch.
    - `outputConfig` OutputConfig — The desired output location and metadata.
      - `batchSize` integer — The max number of response protos to put into each output JSON file on Google Cloud Storage. The valid range is [1, 100]. If not specified, the default value is 20. For example, for one pdf file with 100 pages, 100 response protos will be generated. If `batch_size` = 20, then 5 json files each containing 20 response protos will be written under the prefix `gcs_destination`.`uri`. Currently, batch_size only applies to GcsDestination, with potential future support for other output configurations.
      - `gcsDestination` GcsDestination — The Google Cloud Storage location where the output will be written to.
        - `uri` string — Google Cloud Storage URI prefix where the results will be stored. Results will be in JSON format and preceded by its corresponding input URI prefix. This field can either represent a gcs file prefix or gcs directory. In either case, the uri should be unique because in order to get all of the output files, you will need to do a wildcard gcs search on the uri prefix you provide. Examples: * File Prefix: gs://bucket-name/here/filenameprefix The output files will be created in gs://bucket-name/here/ and the names of the output files will begin with "filenameprefix". * Directory Prefix: gs://bucket-name/some/location/ The output files will be created in gs://bucket-name/some/location/ and the names of the output files could be anything because there was no filename prefix specified. If multiple outputs, each response is still AnnotateFileResponse, each of which contains some subset of the full list of AnnotateImageResponse. Multiple outputs can happen if, for example, the output JSON is too large and overflows into multiple sharded files.
    - `features` Feature[] — Required. Requested features.
      - `type` 'TYPE_UNSPECIFIED' | 'FACE_DETECTION' | 'LANDMARK_DETECTION' | 'LOGO_DETECTION' | 'LABEL_DETECTION' | 'TEXT_DETECTION' | 'DOCUMENT_TEXT_DETECTION' | 'SAFE_SEARCH_DETECTION' | 'IMAGE_PROPERTIES' | 'CROP_HINTS' | 'WEB_DETECTION' | 'PRODUCT_SEARCH' | 'OBJECT_LOCALIZATION' — The feature type.
      - `model` string — Model to use for the feature. Supported values: "builtin/stable" (the default if unset) and "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also support "builtin/rc" for the latest release candidate.
      - `maxResults` integer — Maximum number of results of this type. Does not apply to `TEXT_DETECTION`, `DOCUMENT_TEXT_DETECTION`, or `CROP_HINTS`.
    - `inputConfig` InputConfig — The desired input location and metadata.
      - `mimeType` string — The type of the file. Currently only "application/pdf", "image/tiff" and "image/gif" are supported. Wildcards are not supported.
      - `content` string, byte — File content, represented as a stream of bytes. Note: As with all `bytes` fields, protobuffers use a pure binary representation, whereas JSON representations use base64. Currently, this field only works for BatchAnnotateFiles requests. It does not work for AsyncBatchAnnotateFiles requests.
      - `gcsSource` GcsSource — The Google Cloud Storage location where the input will be read from.
        - `uri` string — Google Cloud Storage URI for the input file. This must only be a Google Cloud Storage object. Wildcards are not currently supported.
    - `imageContext` ImageContext — Image context and/or feature-specific parameters.
      - `latLongRect` LatLongRect — Rectangle determined by min and max `LatLng` pairs.
        - `minLatLng` LatLng — An object that represents a latitude/longitude pair. This is expressed as a pair of doubles to represent degrees latitude and degrees longitude. Unless specified otherwise, this object must conform to the WGS84 standard. Values must be within normalized ranges.
          - `latitude` number, double — The latitude in degrees. It must be in the range [-90.0, +90.0].
          - `longitude` number, double — The longitude in degrees. It must be in the range [-180.0, +180.0].
        - `maxLatLng` LatLng — An object that represents a latitude/longitude pair. This is expressed as a pair of doubles to represent degrees latitude and degrees longitude. Unless specified otherwise, this object must conform to the WGS84 standard. Values must be within normalized ranges.
          - `latitude` number, double — The latitude in degrees. It must be in the range [-90.0, +90.0].
          - `longitude` number, double — The longitude in degrees. It must be in the range [-180.0, +180.0].
      - `cropHintsParams` CropHintsParams — Parameters for crop hints annotation request.
        - `aspectRatios` number[] — Aspect ratios in floats, representing the ratio of the width to the height of the image. For example, if the desired aspect ratio is 4/3, the corresponding float value should be 1.33333. If not specified, the best possible crop is returned. The number of provided aspect ratios is limited to a maximum of 16; any aspect ratios provided after the 16th are ignored.
      - `languageHints` string[] — List of languages to use for TEXT_DETECTION. In most cases, an empty value yields the best results since it enables automatic language detection. For languages based on the Latin alphabet, setting `language_hints` is not needed. In rare cases, when the language of the text in the image is known, setting a hint will help get better results (although it will be a significant hindrance if the hint is wrong). Text detection returns an error if one or more of the specified languages is not one of the [supported languages](https://cloud.google.com/vision/docs/languages).
      - `textDetectionParams` TextDetectionParams — Parameters for text detections. This is used to control TEXT_DETECTION and DOCUMENT_TEXT_DETECTION features.
        - `enableTextDetectionConfidenceScore` boolean — By default, Cloud Vision API only includes confidence score for DOCUMENT_TEXT_DETECTION result. Set the flag to true to include confidence score for TEXT_DETECTION as well.
        - `advancedOcrOptions` string[] — A list of advanced OCR options to further fine-tune OCR behavior. Current valid values are: - `legacy_layout`: a heuristics layout detection algorithm, which serves as an alternative to the current ML-based layout detection algorithm. Customers can choose the best suitable layout algorithm based on their situation.
      - `productSearchParams` ProductSearchParams — Parameters for a product search request.
        - `boundingPoly` BoundingPoly — A bounding polygon for the detected image annotation.
          - `normalizedVertices` NormalizedVertex[] — The bounding polygon normalized vertices.
            - `x` number, float — X coordinate.
            - `y` number, float — Y coordinate.
          - `vertices` Vertex[] — The bounding polygon vertices.
            - `x` integer — X coordinate.
            - `y` integer — Y coordinate.
        - `filter` string — The filtering expression. This can be used to restrict search results based on Product labels. We currently support an AND of OR of key-value expressions, where each expression within an OR must have the same key. An '=' should be used to connect the key and value. For example, "(color = red OR color = blue) AND brand = Google" is acceptable, but "(color = red OR brand = Google)" is not acceptable. "color: red" is not acceptable because it uses a ':' instead of an '='.
        - `productSet` string — The resource name of a ProductSet to be searched for similar images. Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID`.
        - `productCategories` string[] — The list of product categories to search in. Currently, we only consider the first category, and either "homegoods-v2", "apparel-v2", "toys-v2", "packagedgoods-v1", or "general-v1" should be specified. The legacy categories "homegoods", "apparel", and "toys" are still supported but will be deprecated. For new products, please use "homegoods-v2", "apparel-v2", or "toys-v2" for better product search accuracy. It is recommended to migrate existing products to these categories as well.
      - `webDetectionParams` WebDetectionParams — Parameters for web detection request.
        - `includeGeoResults` boolean — This field has no effect on results.
  - `parent` string — Optional. Target project and location to make a call. Format: `projects/{project-id}/locations/{location-id}`. If no parent is specified, a region will be chosen automatically. Supported location-ids: `us`: USA country only, `asia`: East asia areas, like Japan, Taiwan, `eu`: The European Union. Example: `projects/project-A/locations/eu`.
  - `labels` object — Optional. The labels with user-defined metadata for the request. Label keys and values can be no longer than 63 characters (Unicode codepoints), can only contain lowercase letters, numeric characters, underscores and dashes. International characters are allowed. Label values are optional. Label keys must start with a letter.

## Response `200`

Successful response

---

[API](https://skmtc.net/google/apis/vision.md) · [All operations](https://skmtc.net/google/apis/vision/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/google/vision/versions/d5becca397b9/schema)
