---
title: "Update a record"
method: POST
path: "/vectors/update"
tags: ["Vector Operations"]
---

# Update a record

`POST /vectors/update`

Update records by ID or by metadata in a namespace. Updating by ID changes the vector and/or metadata of a single record. Updating by metadata changes metadata across multiple records using a metadata filter.
If a vector value is included, it will overwrite the previous value. If `set_metadata` is included, only the specified metadata fields are modified, and if a specified metadata field does not exist, it is added.
For guidance and examples, see [Update data](https://docs.pinecone.io/guides/manage-data/update-data).

## Headers

- `X-Pinecone-Api-Version` string, required

## Request body

- DbDataUpdateRequest — The request for the `update` operation.
  - `id` string — Vector's unique id.
  - `values` number[] — Vector data.
  - `sparseValues` DbDataSparseValues — Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be with the same length.
    - `indices` integer[], required — The indices of the sparse data.
    - `values` number[], required — The corresponding values of the sparse data, which must be with the same length as the indices.
  - `setMetadata` object — Metadata to set for the record.
  - `namespace` string — The namespace containing the record to update.
  - `filter` object — A metadata filter expression. When updating metadata across records in a namespace, the update is applied to all records that match the filter. See [Understanding metadata](https://docs.pinecone.io/guides/index-data/indexing-overview#metadata).
  - `dryRun` boolean — If `true`, return the number of records that match the `filter`, but do not execute the update. Default is `false`.

## Response `200`

A successful response.

- DbDataUpdateResponse — The response for the `update` operation.
  - `matchedRecords` integer — The number of records that matched the filter (if a filter was provided).

## Other responses

- `400` — Bad request. The request body included invalid request parameters.
- `4XX` — An unexpected error response.
- `5XX` — An unexpected error response.

---

[API](https://skmtc.net/pinecone/apis/pinecone-api.md) · [All operations](https://skmtc.net/pinecone/apis/pinecone-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/pinecone/pinecone-api/revisions/35876583485d/schema)
