Skip to main content
POST
/
vectors
/
upsert
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.upsert(
    vectors=[
        {
            "id": "vec1", 
            "values": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8], 
            "metadata": {"genre": "drama"}
        },
        {
            "id": "vec2", 
            "values": [0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
            "metadata": {"genre": "action"}
        }
    ],
    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.upsert(
    vectors=[
        {
            "id": "vec1", 
            "values": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8], 
            "metadata": {"genre": "drama"}
        },
        {
            "id": "vec2", 
            "values": [0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
            "metadata": {"genre": "action"}
        }
    ],
    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 upsert operation.

vectors
object[]
required

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

namespace
string

The namespace where you upsert records.

Example:

"example-namespace"

Response

A successful response.

The response for the upsert operation.

upsertedCount
integer<int64>

The number of vectors upserted.

Example:

2