---
title: "POST /v1/projects/{projectsId}/locations/{locationsId}/indexes/{indexesId}:upsertDatapoints"
method: POST
path: "/v1/projects/{projectsId}/locations/{locationsId}/indexes/{indexesId}:upsertDatapoints"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/locations/{locationsId}/indexes/{indexesId}:upsertDatapoints

`POST /v1/projects/{projectsId}/locations/{locationsId}/indexes/{indexesId}:upsertDatapoints`

## Request

- Base URL: `https://aiplatform.googleapis.com`
- URL: `https://aiplatform.googleapis.com/v1/projects/{projectsId}/locations/{locationsId}/indexes/{indexesId}:upsertDatapoints`
- Auth: OAuth 2 and OAuth 2
  - Implicit: `https://accounts.google.com/o/oauth2/auth`
  - Scopes: `https://www.googleapis.com/auth/cloud-platform`
  - Authorization code: `https://accounts.google.com/o/oauth2/auth`
  - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`

Add/update Datapoints into an Index.

## Path parameters

- `projectsId` string, required
- `locationsId` string, required
- `indexesId` string, required

## Request body

- GoogleCloudAiplatformV1UpsertDatapointsRequest: Request message for IndexService.UpsertDatapoints
  - `datapoints` GoogleCloudAiplatformV1IndexDatapoint[]: A list of datapoints to be created/updated.
    - `crowdingTag` GoogleCloudAiplatformV1IndexDatapointCrowdingTag: Crowding tag is a constraint on a neighbor list produced by nearest neighbor search requiring that no more than some value k' of the k neighbors returned have the same value of crowding_attribute.
      - `crowdingAttribute` string: The attribute value used for crowding. The maximum number of neighbors to return per crowding attribute value (per_crowding_attribute_num_neighbors) is configured per-query. This field is ignored if per_crowding_attribute_num_neighbors is larger than the total number of neighbors to return for a given query.
    - `datapointId` string: Required. Unique identifier of the datapoint.
    - `embeddingMetadata` object: Optional. The key-value map of additional metadata for the datapoint.
    - `featureVector` number[]: Required. Feature embedding vector for dense index. An array of numbers with the length of [NearestNeighborSearchConfig.dimensions].
    - `numericRestricts` GoogleCloudAiplatformV1IndexDatapointNumericRestriction[]: Optional. List of Restrict of the datapoint, used to perform "restricted searches" where boolean rule are used to filter the subset of the database eligible for matching. This uses numeric comparisons.
      - `namespace` string: The namespace of this restriction. e.g.: cost.
      - `op` 'OPERATOR_UNSPECIFIED' | 'LESS' | 'LESS_EQUAL' | 'EQUAL' | 'GREATER_EQUAL' | 'GREATER' | 'NOT_EQUAL': This MUST be specified for queries and must NOT be specified for datapoints.
      - `valueDouble` number, double: Represents 64 bit float.
      - `valueFloat` number, float: Represents 32 bit float.
      - `valueInt` string, int64: Represents 64 bit integer.
    - `restricts` GoogleCloudAiplatformV1IndexDatapointRestriction[]: Optional. List of Restrict of the datapoint, used to perform "restricted searches" where boolean rule are used to filter the subset of the database eligible for matching. This uses categorical tokens. See: https://cloud.google.com/vertex-ai/docs/matching-engine/filtering
      - `allowList` string[]: The attributes to allow in this namespace. e.g.: 'red'
      - `denyList` string[]: The attributes to deny in this namespace. e.g.: 'blue'
      - `namespace` string: The namespace of this restriction. e.g.: color.
    - `sparseEmbedding` GoogleCloudAiplatformV1IndexDatapointSparseEmbedding: Feature embedding vector for sparse index. An array of numbers whose values are located in the specified dimensions.
      - `dimensions` string[]: Required. The list of indexes for the embedding values of the sparse vector.
      - `values` number[]: Required. The list of embedding values of the sparse vector.
  - `updateMask` string, google-fieldmask: Optional. Update mask is used to specify the fields to be overwritten in the datapoints by the update. The fields specified in the update_mask are relative to each IndexDatapoint inside datapoints, not the full request. Updatable fields: * Use `all_restricts` to update both restricts and numeric_restricts.

## Response `200`

Successful response

- GoogleCloudAiplatformV1UpsertDatapointsResponse: Response message for IndexService.UpsertDatapoints

---

[API](https://skmtc.dev/google/apis/aiplatform.md) - [All operations](https://skmtc.dev/google/apis/aiplatform/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/aiplatform/revisions/3aca3b348f0c?raw)
