Cloud Vision API
  1. projects
Cloud Vision API
  • files
    • /v1p2beta1/files:annotate
      POST
    • /v1p2beta1/files:asyncBatchAnnotate
      POST
  • images
    • /v1p2beta1/images:annotate
      POST
    • /v1p2beta1/images:asyncBatchAnnotate
      POST
  • projects
    • /v1p2beta1/{parent}/files:annotate
      POST
    • /v1p2beta1/{parent}/files:asyncBatchAnnotate
      POST
    • /v1p2beta1/{parent}/images:annotate
      POST
    • /v1p2beta1/{parent}/images:asyncBatchAnnotate
      POST
  1. projects

/v1p2beta1/{parent}/files:annotate

POST
/v1p2beta1/{parent}/files:annotate
projects
Service that performs image detection and annotation for a batch of files. Now only "application/pdf", "image/tiff" and "image/gif" are supported. This service will extract at most 5 (customers can specify which 5 in AnnotateFileRequest.pages) frames (gif) or pages (pdf or tiff) from each file provided and perform detection and annotation for each image extracted.
Request Request Example
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://vision.googleapis.com//v1p2beta1//files:annotate' \
--header 'Content-Type: application/json' \
--data-raw '{
    "parent": "string",
    "requests": [
        {
            "features": [
                {
                    "maxResults": 0,
                    "model": "string",
                    "type": "TYPE_UNSPECIFIED"
                }
            ],
            "imageContext": {
                "cropHintsParams": {
                    "aspectRatios": [
                        0
                    ]
                },
                "languageHints": [
                    "string"
                ],
                "latLongRect": {
                    "maxLatLng": {
                        "latitude": 0,
                        "longitude": 0
                    },
                    "minLatLng": {
                        "latitude": 0,
                        "longitude": 0
                    }
                },
                "productSearchParams": {
                    "boundingPoly": {
                        "normalizedVertices": [
                            {
                                "x": 0,
                                "y": 0
                            }
                        ],
                        "vertices": [
                            {
                                "x": 0,
                                "y": 0
                            }
                        ]
                    },
                    "filter": "string",
                    "productCategories": [
                        "string"
                    ],
                    "productSet": "string"
                },
                "textDetectionParams": {
                    "advancedOcrOptions": [
                        "string"
                    ],
                    "enableTextDetectionConfidenceScore": true
                },
                "webDetectionParams": {
                    "includeGeoResults": true
                }
            },
            "inputConfig": {
                "content": "string",
                "gcsSource": {
                    "uri": "string"
                },
                "mimeType": "string"
            },
            "pages": [
                0
            ]
        }
    ]
}'
Response Response Example
{
    "responses": [
        {
            "error": {
                "code": 0,
                "details": [
                    {
                        "property1": null,
                        "property2": null
                    }
                ],
                "message": "string"
            },
            "inputConfig": {
                "content": "string",
                "gcsSource": {
                    "uri": "string"
                },
                "mimeType": "string"
            },
            "responses": [
                {
                    "context": {
                        "pageNumber": 0,
                        "uri": "string"
                    },
                    "cropHintsAnnotation": {
                        "cropHints": [
                            {
                                "boundingPoly": {
                                    "normalizedVertices": [
                                        {
                                            "x": 0,
                                            "y": 0
                                        }
                                    ],
                                    "vertices": [
                                        {
                                            "x": 0,
                                            "y": 0
                                        }
                                    ]
                                },
                                "confidence": 0,
                                "importanceFraction": 0
                            }
                        ]
                    },
                    "error": {
                        "code": 0,
                        "details": [
                            {
                                "property1": null,
                                "property2": null
                            }
                        ],
                        "message": "string"
                    },
                    "faceAnnotations": [
                        {
                            "angerLikelihood": "UNKNOWN",
                            "blurredLikelihood": "UNKNOWN",
                            "boundingPoly": {
                                "normalizedVertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ],
                                "vertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ]
                            },
                            "detectionConfidence": 0,
                            "fdBoundingPoly": {
                                "normalizedVertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ],
                                "vertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ]
                            },
                            "headwearLikelihood": "UNKNOWN",
                            "joyLikelihood": "UNKNOWN",
                            "landmarkingConfidence": 0,
                            "landmarks": [
                                {
                                    "position": {
                                        "x": 0,
                                        "y": 0,
                                        "z": 0
                                    },
                                    "type": "UNKNOWN_LANDMARK"
                                }
                            ],
                            "panAngle": 0,
                            "rollAngle": 0,
                            "sorrowLikelihood": "UNKNOWN",
                            "surpriseLikelihood": "UNKNOWN",
                            "tiltAngle": 0,
                            "underExposedLikelihood": "UNKNOWN"
                        }
                    ],
                    "fullTextAnnotation": {
                        "pages": [
                            {
                                "blocks": [
                                    {
                                        "blockType": "UNKNOWN",
                                        "boundingBox": {
                                            "normalizedVertices": [
                                                {
                                                    "x": 0,
                                                    "y": 0
                                                }
                                            ],
                                            "vertices": [
                                                {
                                                    "x": 0,
                                                    "y": 0
                                                }
                                            ]
                                        },
                                        "confidence": 0,
                                        "paragraphs": [
                                            {
                                                "boundingBox": {
                                                    "normalizedVertices": [
                                                        {}
                                                    ],
                                                    "vertices": [
                                                        {}
                                                    ]
                                                },
                                                "confidence": 0,
                                                "property": {
                                                    "detectedBreak": {
                                                        "isPrefix": true,
                                                        "type": "UNKNOWN"
                                                    },
                                                    "detectedLanguages": [
                                                        {}
                                                    ]
                                                },
                                                "words": [
                                                    {
                                                        "boundingBox": {
                                                            "normalizedVertices": [],
                                                            "vertices": []
                                                        },
                                                        "confidence": 0,
                                                        "property": {
                                                            "detectedLanguages": []
                                                        },
                                                        "symbols": [
                                                            null
                                                        ]
                                                    }
                                                ]
                                            }
                                        ],
                                        "property": {
                                            "detectedBreak": {
                                                "isPrefix": true,
                                                "type": "UNKNOWN"
                                            },
                                            "detectedLanguages": [
                                                {
                                                    "confidence": 0,
                                                    "languageCode": "string"
                                                }
                                            ]
                                        }
                                    }
                                ],
                                "confidence": 0,
                                "height": 0,
                                "property": {
                                    "detectedBreak": {
                                        "isPrefix": true,
                                        "type": "UNKNOWN"
                                    },
                                    "detectedLanguages": [
                                        {
                                            "confidence": 0,
                                            "languageCode": "string"
                                        }
                                    ]
                                },
                                "width": 0
                            }
                        ],
                        "text": "string"
                    },
                    "imagePropertiesAnnotation": {
                        "dominantColors": {
                            "colors": [
                                {
                                    "color": {},
                                    "pixelFraction": 0,
                                    "score": 0
                                }
                            ]
                        }
                    },
                    "labelAnnotations": [
                        {
                            "boundingPoly": {
                                "normalizedVertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ],
                                "vertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ]
                            },
                            "confidence": 0,
                            "description": "string",
                            "locale": "string",
                            "locations": [
                                {
                                    "latLng": {
                                        "latitude": 0,
                                        "longitude": 0
                                    }
                                }
                            ],
                            "mid": "string",
                            "properties": [
                                {
                                    "name": "string",
                                    "uint64Value": "string",
                                    "value": "string"
                                }
                            ],
                            "score": 0,
                            "topicality": 0
                        }
                    ],
                    "landmarkAnnotations": [
                        {
                            "boundingPoly": {
                                "normalizedVertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ],
                                "vertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ]
                            },
                            "confidence": 0,
                            "description": "string",
                            "locale": "string",
                            "locations": [
                                {
                                    "latLng": {
                                        "latitude": 0,
                                        "longitude": 0
                                    }
                                }
                            ],
                            "mid": "string",
                            "properties": [
                                {
                                    "name": "string",
                                    "uint64Value": "string",
                                    "value": "string"
                                }
                            ],
                            "score": 0,
                            "topicality": 0
                        }
                    ],
                    "localizedObjectAnnotations": [
                        {
                            "boundingPoly": {
                                "normalizedVertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ],
                                "vertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ]
                            },
                            "languageCode": "string",
                            "mid": "string",
                            "name": "string",
                            "score": 0
                        }
                    ],
                    "logoAnnotations": [
                        {
                            "boundingPoly": {
                                "normalizedVertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ],
                                "vertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ]
                            },
                            "confidence": 0,
                            "description": "string",
                            "locale": "string",
                            "locations": [
                                {
                                    "latLng": {
                                        "latitude": 0,
                                        "longitude": 0
                                    }
                                }
                            ],
                            "mid": "string",
                            "properties": [
                                {
                                    "name": "string",
                                    "uint64Value": "string",
                                    "value": "string"
                                }
                            ],
                            "score": 0,
                            "topicality": 0
                        }
                    ],
                    "productSearchResults": {
                        "indexTime": "string",
                        "productGroupedResults": [
                            {
                                "boundingPoly": {
                                    "normalizedVertices": [
                                        {
                                            "x": 0,
                                            "y": 0
                                        }
                                    ],
                                    "vertices": [
                                        {
                                            "x": 0,
                                            "y": 0
                                        }
                                    ]
                                },
                                "objectAnnotations": [
                                    {
                                        "languageCode": "string",
                                        "mid": "string",
                                        "name": "string",
                                        "score": 0
                                    }
                                ],
                                "results": [
                                    {
                                        "image": "string",
                                        "product": {
                                            "description": "string",
                                            "displayName": "string",
                                            "name": "string",
                                            "productCategory": "string",
                                            "productLabels": [
                                                {
                                                    "key": "string",
                                                    "value": "string"
                                                }
                                            ]
                                        },
                                        "score": 0
                                    }
                                ]
                            }
                        ],
                        "results": [
                            {
                                "image": "string",
                                "product": {
                                    "description": "string",
                                    "displayName": "string",
                                    "name": "string",
                                    "productCategory": "string",
                                    "productLabels": [
                                        {
                                            "key": "string",
                                            "value": "string"
                                        }
                                    ]
                                },
                                "score": 0
                            }
                        ]
                    },
                    "safeSearchAnnotation": {
                        "adult": "UNKNOWN",
                        "medical": "UNKNOWN",
                        "racy": "UNKNOWN",
                        "spoof": "UNKNOWN",
                        "violence": "UNKNOWN"
                    },
                    "textAnnotations": [
                        {
                            "boundingPoly": {
                                "normalizedVertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ],
                                "vertices": [
                                    {
                                        "x": 0,
                                        "y": 0
                                    }
                                ]
                            },
                            "confidence": 0,
                            "description": "string",
                            "locale": "string",
                            "locations": [
                                {
                                    "latLng": {
                                        "latitude": 0,
                                        "longitude": 0
                                    }
                                }
                            ],
                            "mid": "string",
                            "properties": [
                                {
                                    "name": "string",
                                    "uint64Value": "string",
                                    "value": "string"
                                }
                            ],
                            "score": 0,
                            "topicality": 0
                        }
                    ],
                    "webDetection": {
                        "bestGuessLabels": [
                            {
                                "label": "string",
                                "languageCode": "string"
                            }
                        ],
                        "fullMatchingImages": [
                            {
                                "score": 0,
                                "url": "string"
                            }
                        ],
                        "pagesWithMatchingImages": [
                            {
                                "fullMatchingImages": [
                                    {
                                        "score": 0,
                                        "url": "string"
                                    }
                                ],
                                "pageTitle": "string",
                                "partialMatchingImages": [
                                    {
                                        "score": 0,
                                        "url": "string"
                                    }
                                ],
                                "score": 0,
                                "url": "string"
                            }
                        ],
                        "partialMatchingImages": [
                            {
                                "score": 0,
                                "url": "string"
                            }
                        ],
                        "visuallySimilarImages": [
                            {
                                "score": 0,
                                "url": "string"
                            }
                        ],
                        "webEntities": [
                            {
                                "description": "string",
                                "entityId": "string",
                                "score": 0
                            }
                        ]
                    }
                }
            ],
            "totalPages": 0
        }
    ]
}

Request

Path Params
parent
string 
required
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.
Body Params application/json
A list of requests to annotate files using the BatchAnnotateFiles API.
parent
string 
optional
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.
requests
array[object (GoogleCloudVisionV1p2beta1AnnotateFileRequest) {4}] 
optional
Required. The list of file annotation requests. Right now we support only one AnnotateFileRequest in BatchAnnotateFilesRequest.
features
array[object (GoogleCloudVisionV1p2beta1Feature) {3}] 
optional
Required. Requested features.
imageContext
object (GoogleCloudVisionV1p2beta1ImageContext) 
optional
Additional context that may accompany the image(s) in the file.
inputConfig
object (GoogleCloudVisionV1p2beta1InputConfig) 
optional
Required. Information about the input file.
pages
array[integer <int32>]
optional
Pages of the file to perform image annotation. Pages starts from 1, we assume the first page of the file is page 1. At most 5 pages are supported per request. Pages can be negative. Page 1 means the first page. Page 2 means the second page. Page -1 means the last page. Page -2 means the second to the last page. If the file is GIF instead of PDF or TIFF, page refers to GIF frames. If this field is empty, by default the service performs image annotation for the first 5 pages of the file.
Examples

Responses

🟢200Successful response
application/json
Body
A list of file annotation responses.
responses
array[object (GoogleCloudVisionV1p2beta1AnnotateFileResponse) {4}] 
optional
The list of file annotation responses, each response corresponding to each AnnotateFileRequest in BatchAnnotateFilesRequest.
error
object (Status) 
optional
If set, represents the error message for the failed request. The responses field will not be set in this case.
inputConfig
object (GoogleCloudVisionV1p2beta1InputConfig) 
optional
Information about the file for which this response is generated.
responses
array[object (GoogleCloudVisionV1p2beta1AnnotateImageResponse) {14}] 
optional
Individual responses to images found within the file. This field will be empty if the error field is set.
totalPages
integer <int32>
optional
This field gives the total number of pages in the file.
Modified at 2023-08-15 09:10:12
Previous
/v1p2beta1/images:asyncBatchAnnotate
Next
/v1p2beta1/{parent}/files:asyncBatchAnnotate
Built with