Skip to main content
POST
/
records
/
namespaces
/
{namespace}
/
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_records(
    "example-namespace",
    [
        {
            "_id": "rec1",
            "chunk_text": "Apples are a great source of dietary fiber.",
            "category": "digestive system",
        },
        {
            "_id": "rec2",
            "chunk_text": "Apples originated in Central Asia.",
            "category": "cultivation",
        }
    ]
)

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_records(
    "example-namespace",
    [
        {
            "_id": "rec1",
            "chunk_text": "Apples are a great source of dietary fiber.",
            "category": "digestive system",
        },
        {
            "_id": "rec2",
            "chunk_text": "Apples originated in Central Asia.",
            "category": "cultivation",
        }
    ]
)

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

Path Parameters

namespace
string
required

The namespace to upsert records into.

Body

application/x-ndjson

Each record in the request body must include an _id field and a field that matches your index's field_map configuration (such as chunk_text or data). All other fields are stored as metadata.

_id
string
required

The unique ID of the record to upsert. Note that id can be used as an alias for _id.

Response

A successful response.