# Method: projects.locations.indexEndpoints.searchIndexEndpoint

- [HTTP request](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.indexEndpoints/searchIndexEndpoint#body.HTTP_TEMPLATE)
- [Path parameters](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.indexEndpoints/searchIndexEndpoint#body.PATH_PARAMETERS)
- [Request body](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.indexEndpoints/searchIndexEndpoint#body.request_body)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.indexEndpoints/searchIndexEndpoint#body.request_body.SCHEMA_REPRESENTATION)
- [Response body](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.indexEndpoints/searchIndexEndpoint#body.response_body)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.indexEndpoints/searchIndexEndpoint#body.SearchIndexEndpointResponse.SCHEMA_REPRESENTATION)
- [Authorization scopes](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.indexEndpoints/searchIndexEndpoint#body.aspect)
- [IAM Permissions](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.indexEndpoints/searchIndexEndpoint#body.aspect_1)
- [ImageQuery](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.indexEndpoints/searchIndexEndpoint#ImageQuery)
  - [JSON representation](https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.indexEndpoints/searchIndexEndpoint#ImageQuery.SCHEMA_REPRESENTATION)

Search a deployed index endpoint (IMAGE corpus type only).

### HTTP request

`POST https://visionai.googleapis.com/v1/{indexEndpoint=projects/*/locations/*/indexEndpoints/*}:searchIndexEndpoint`

The URL uses [gRPC Transcoding](https://google.aip.dev/127) syntax.

### Path parameters

| Parameters ||
|---|---|
| `indexEndpoint` | `string` Required. The index endpoint to search. Format: \`projects/{projectId}/locations/{locationId}/indexEndpoints/{indexEndpointId}' |

### Request body

The request body contains data with the following structure:

| JSON representation |
|---|
| ``` { "criteria": [ { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/Criteria`) } ], "exclusionCriteria": [ { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/Criteria`) } ], "pageSize": integer, "pageToken": string, // Union field `query` can be only one of the following: "imageQuery": { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.indexEndpoints/searchIndexEndpoint#ImageQuery`) }, "textQuery": string // End of list of possible types for union field `query`. } ``` |

| Fields ||
|---|---|
| `criteria[]` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/Criteria`)`` Criteria applied to search results. |
| `exclusionCriteria[]` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/Criteria`)`` Criteria to exclude from search results. Note that `fetchMatchedAnnotations` will be ignored. |
| `pageSize` | `integer` Requested page size. API may return fewer results than requested. If negative, INVALID_ARGUMENT error will be returned. If unspecified or 0, API will pick a default size, which is 10. If the requested page size is larger than the maximum size, API will pick the maximum size, which is 100. |
| `pageToken` | `string` The continuation token to fetch the next page. If empty, it means it is fetching the first page. |
| Union field `query`. The oneof global search query. `query` can be only one of the following: ||
| `imageQuery` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/projects.locations.indexEndpoints/searchIndexEndpoint#ImageQuery`)`` An image-only query. |
| `textQuery` | `string` A text-only query. |

### Response body

Response message for indexEndpoints.searchIndexEndpoint.

If successful, the response body contains data with the following structure:

| JSON representation |
|---|
| ``` { "searchResultItems": [ { object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/SearchResultItem`) } ], "nextPageToken": string } ``` |

| Fields ||
|---|---|
| `searchResultItems[]` | ``object (`https://docs.cloud.google.com/vision-ai/docs/reference/rest/v1/SearchResultItem`)`` Returned search results. |
| `nextPageToken` | `string` The next-page continuation token. If this field is omitted, there are no subsequent pages. |

### Authorization scopes

Requires the following OAuth scope:

- `https://www.googleapis.com/auth/cloud-platform`

For more information, see the [Authentication Overview](https://cloud.google.com/docs/authentication/).

### IAM Permissions

Requires the following [IAM](https://cloud.google.com/iam/docs) permission on the `indexEndpoint` resource:

- `visionai.indexEndpoints.search`

For more information, see the [IAM documentation](https://cloud.google.com/iam/docs).

## ImageQuery

Image query for search endpoint request.

| JSON representation |
|---|
| ``` { // Union field `image` can be only one of the following: "inputImage": string, "asset": string // End of list of possible types for union field `image`. } ``` |

| Fields ||
|---|---|
| Union field `image`. `image` can be only one of the following: ||
| `inputImage` | `string (https://developers.google.com/discovery/v1/type-format format)` Input image in raw bytes. A base64-encoded string. |
| `asset` | `string` Resource name of the asset. Only supported in IMAGE corpus type. Format: `projects/{project_number}/locations/{locationId}/corpora/{corpus_id}/assets/{assetId}` |