Skip to main content
Pinecone Docs
current

Search documentation

Type to search this documentation.

Upsert records

Upsert records into a namespace. If a new value is upserted for an existing record ID, it will overwrite the previous value.

For guidance, examples, and limits, see Upsert data.

curl
# To get the unique host for an index,
# see https://docs.pinecone.io/guides/manage-data/target-an-index
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="INDEX_HOST"

curl "https://$INDEX_HOST/vectors/upsert" \
  -H "Api-Key: $PINECONE_API_KEY" \
  -H 'Content-Type: application/json' \
  -H "X-Pinecone-Api-Version: 2026-07" \
  -d '{
    "vectors": [
      {
        "id": "vec1",
        "values": [0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1],
        "metadata": {"genre": "comedy", "year": 2020}
      },
      {
        "id": "vec2",
        "values": [0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2],
        "metadata": {"genre": "documentary", "year": 2019}
      }
    ],
    "namespace": "example-namespace"
  }'

POST /vectors/upsert

200
{
  "upsertedCount": 2
}
400
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
409
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
4XX
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
5XX
{
  "code": 123,
  "message": "<string>",
  "details": [
    {
      "typeUrl": "<string>",
      "value": "<string>"
    }
  ]
}
Api-Keystringrequired

An API Key is required to call Pinecone APIs. Get yours from the console.

X-Pinecone-Api-Versionstringrequired

Required date-based version header

Typestring
Default2026-07
vectorsobject[]required

An array containing the vectors to upsert. Recommended batch limit is up to 1000 vectors.

Typeobject[]
Show child attributes
idstringrequired

This is the vector's unique id.

Required string length: 1 - 512. Example: example-vector-1

Typestring
values?number[]

This is the vector data. On a request it must be non-empty, and at least one value must have a magnitude of 1e-8 or greater — a vector whose values are all smaller than that is rejected as containing only zeros. On a response this is an empty array whenever the record has no dense data to return: on a sparse index, and on any index when values were not requested. The array is therefore not constrained here, because this schema describes both directions.

Typenumber[]
sparseValues?object

Vector sparse data. Represented as a list of indices and a list of corresponded values, which must be with the same length.

Typeobject
Show child attributes
indicesinteger[]required

The indices of the sparse data.

Typeinteger[]
valuesnumber[]required

The corresponding values of the sparse data, which must be with the same length as the indices.

Typenumber[]
metadata?object

This is the metadata included in the request. Field names may not begin with $, which is reserved for filter operators. Every other name is accepted, including names that are empty, non-ASCII, or begin with _.

Typeobject
namespace?string

The namespace where you upsert records.

Example: example-namespace

Typestring

200 — A successful response.

The response for the upsert operation.

upsertedCount?integer

The number of vectors upserted.

Example: 2

Typeinteger
Suggest an edit

Propose a replacement for this page. The site team reviews it before applying any changes.

Export
Documentation menu