curl https://better-dodo-20522-us1-vector.upstash.io/upsert \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"id": "id10",
"vector": [0.44,0.8,0.05,0.72,0.83,0.49,0.6,0.48],
"metadata": { "key": "value" } }'
const url = "https://better-dodo-20522-us1-vector.upstash.io/upsert"; // Replace with your index endpoint.
const token = "YOUR_TOKEN"; // Replace with your actual token
const data = {
id: "id10",
vector: [0.44, 0.8, 0.05, 0.72, 0.83, 0.49, 0.6, 0.48],
metadata: { key: "value" },
};
fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(data),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
import requests
import json
url = 'https://better-dodo-20522-us1-vector.upstash.io/upsert' # Replace with your index endpoint.
token = 'YOUR_TOKEN' # Replace with your actual token
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
data = {
'id': 'id10',
'vector': [0.44, 0.8, 0.05, 0.72, 0.83, 0.49, 0.6, 0.48],
'metadata': {'key': 'value'}
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
{
"result" : "Success"
}
{
"error": "Invalid vector dimension: 2, expected: 256",
"status": 422
}
Endpoints
Upsert Vectors
This endpoint upserts (adds) a vector to given index. You can also add metadata with the vector.
POST
/
upsert
curl https://better-dodo-20522-us1-vector.upstash.io/upsert \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"id": "id10",
"vector": [0.44,0.8,0.05,0.72,0.83,0.49,0.6,0.48],
"metadata": { "key": "value" } }'
const url = "https://better-dodo-20522-us1-vector.upstash.io/upsert"; // Replace with your index endpoint.
const token = "YOUR_TOKEN"; // Replace with your actual token
const data = {
id: "id10",
vector: [0.44, 0.8, 0.05, 0.72, 0.83, 0.49, 0.6, 0.48],
metadata: { key: "value" },
};
fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(data),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
import requests
import json
url = 'https://better-dodo-20522-us1-vector.upstash.io/upsert' # Replace with your index endpoint.
token = 'YOUR_TOKEN' # Replace with your actual token
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
data = {
'id': 'id10',
'vector': [0.44, 0.8, 0.05, 0.72, 0.83, 0.49, 0.6, 0.48],
'metadata': {'key': 'value'}
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
{
"result" : "Success"
}
{
"error": "Invalid vector dimension: 2, expected: 256",
"status": 422
}
Request
You can either upsert a single vector, or multiple vectors in a array.The ID of the vector
The vector data to upsert.
The provided vector should have the same number of dimensions as your index.
The metadata of the vector. This is used to make it easier to identify the
vector on queries.
Response
Returns
"Success" on successful upsert operation.curl https://better-dodo-20522-us1-vector.upstash.io/upsert \
-H "Authorization: Bearer YOUR_TOKEN" \
-d '{"id": "id10",
"vector": [0.44,0.8,0.05,0.72,0.83,0.49,0.6,0.48],
"metadata": { "key": "value" } }'
const url = "https://better-dodo-20522-us1-vector.upstash.io/upsert"; // Replace with your index endpoint.
const token = "YOUR_TOKEN"; // Replace with your actual token
const data = {
id: "id10",
vector: [0.44, 0.8, 0.05, 0.72, 0.83, 0.49, 0.6, 0.48],
metadata: { key: "value" },
};
fetch(url, {
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify(data),
})
.then((response) => response.json())
.then((data) => console.log(data))
.catch((error) => console.error("Error:", error));
import requests
import json
url = 'https://better-dodo-20522-us1-vector.upstash.io/upsert' # Replace with your index endpoint.
token = 'YOUR_TOKEN' # Replace with your actual token
headers = {
'Authorization': f'Bearer {token}',
'Content-Type': 'application/json'
}
data = {
'id': 'id10',
'vector': [0.44, 0.8, 0.05, 0.72, 0.83, 0.49, 0.6, 0.48],
'metadata': {'key': 'value'}
}
response = requests.post(url, headers=headers, data=json.dumps(data))
print(response.json())
{
"result" : "Success"
}
{
"error": "Invalid vector dimension: 2, expected: 256",
"status": 422
}
Was this page helpful?
⌘I