Skip to main content
POST
/
vectors
/
update
from pinecone import Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")

# To get the unique host for an index, 
# see https://docs.pinecone.io/guides/manage-data/target-an-index
index = pc.Index(host="INDEX_HOST")

index.update(
    id="vec1",
    values=[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
    set_metadata={"genre": "comedy"},
    namespace="example-namespace"
)

Documentation Index

Fetch the complete documentation index at: https://docs.pinecone.io/llms.txt

Use this file to discover all available pages before exploring further.

from pinecone import Pinecone

pc = Pinecone(api_key="YOUR_API_KEY")

# To get the unique host for an index, 
# see https://docs.pinecone.io/guides/manage-data/target-an-index
index = pc.Index(host="INDEX_HOST")

index.update(
    id="vec1",
    values=[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
    set_metadata={"genre": "comedy"},
    namespace="example-namespace"
)

Authorizations

Api-Key
string
header
required

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

Headers

X-Pinecone-Api-Version
string
default:202601-alpha
required

Required date-based version header

Body

application/json

The request for the update operation.

id
string

Vector's unique id.

Required string length: 1 - 512
Example:

"example-vector-1"

values
number<float>[]

Vector data.

Example:
[0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]
sparseValues
object

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

setMetadata
object

Metadata to set for the record.

Example:
{ "genre": "documentary", "year": 2019 }
namespace
string

The namespace containing the record to update.

Example:

"example-namespace"

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.

Example:
{
"genre": { "$in": ["comedy", "documentary", "drama"] },
"year": { "$eq": 2019 }
}
dryRun
boolean
default:false

If true, return the number of records that match the filter, but do not execute the update. Default is false.

Example:

false

Response

A successful response.

The response for the update operation.

matchedRecords
integer<int32>

The number of records that matched the filter (if a filter was provided).

Example:

42