Getting Started
- Quickstart
- Editing
- Global Settings
- Navigation
- Themes
- Migration
Writing Content
API References
- Playground
- OpenAPI
- AsyncAPI
- MDX
- Troubleshooting
Configurations
Advanced
- Custom Subdirectory
- Auth & Personalization
- Dashboard Access
- Model Context Protocol
- REST API
Upsert vectors
Upsert vectors
The upsert
operation writes vectors into a namespace. If a new value is upserted for an existing vector ID, it will overwrite the previous value.
For guidance and examples, see Upsert data.
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="INDEX_HOST"
curl -X POST "https://$INDEX_HOST/vectors/upsert" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "content-type: application/json" \
-d '{
"vectors": [
{
"id": "vec1",
"values": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
"sparseValues": {
"indices": [2, 7],
"values": [0.4, 0.5]
},
"metatdata": {
"genre": "drama"
}
},
{
"id": "vec2",
"values": [0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
"sparseValues": {
"indices": [1, 4],
"values": [0.1, 0.2]
},
"metadata": {
"genre": "action"
}
}
]
}'
{
"upsertedCount": 2
}
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="INDEX_HOST"
curl -X POST "https://$INDEX_HOST/vectors/upsert" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "content-type: application/json" \
-d '{
"vectors": [
{
"id": "vec1",
"values": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
"sparseValues": {
"indices": [2, 7],
"values": [0.4, 0.5]
},
"metatdata": {
"genre": "drama"
}
},
{
"id": "vec2",
"values": [0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
"sparseValues": {
"indices": [1, 4],
"values": [0.1, 0.2]
},
"metadata": {
"genre": "action"
}
}
]
}'
{
"upsertedCount": 2
}
Was this page helpful?
PINECONE_API_KEY="YOUR_API_KEY"
INDEX_HOST="INDEX_HOST"
curl -X POST "https://$INDEX_HOST/vectors/upsert" \
-H "Api-Key: $PINECONE_API_KEY" \
-H "content-type: application/json" \
-d '{
"vectors": [
{
"id": "vec1",
"values": [0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8],
"sparseValues": {
"indices": [2, 7],
"values": [0.4, 0.5]
},
"metatdata": {
"genre": "drama"
}
},
{
"id": "vec2",
"values": [0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9],
"sparseValues": {
"indices": [1, 4],
"values": [0.1, 0.2]
},
"metadata": {
"genre": "action"
}
}
]
}'
{
"upsertedCount": 2
}