curl https://hardy-cricket-48359-us1-vector.upstash.io/random \
-H "Authorization: Bearer <YOUR_TOKEN>" \
const url = "https://better-dodo-20522-us1-vector.upstash.io/random"; // Replace with your index endpoint.
const token = "YOUR_TOKEN"; // Replace with your actual token
fetch(url, {
method: "GET",
headers: {
Authorization: `Bearer ${token}`,
},
})
.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/random' # Replace with your index endpoint.
token = 'YOUR_TOKEN' # Replace with your actual token
headers = {
'Authorization': f'Bearer {token}',
}
response = requests.get(url, headers=headers)
print(response.json())
{
"result" : {
"id" : "1",
"vector" : [0.1, 0.2, 0.3]
}
}
Endpoints
Fetch Random Vector
This endpoint fetches a random vector. Returns null if the index is empty.
GET
/
random
curl https://hardy-cricket-48359-us1-vector.upstash.io/random \
-H "Authorization: Bearer <YOUR_TOKEN>" \
const url = "https://better-dodo-20522-us1-vector.upstash.io/random"; // Replace with your index endpoint.
const token = "YOUR_TOKEN"; // Replace with your actual token
fetch(url, {
method: "GET",
headers: {
Authorization: `Bearer ${token}`,
},
})
.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/random' # Replace with your index endpoint.
token = 'YOUR_TOKEN' # Replace with your actual token
headers = {
'Authorization': f'Bearer {token}',
}
response = requests.get(url, headers=headers)
print(response.json())
{
"result" : {
"id" : "1",
"vector" : [0.1, 0.2, 0.3]
}
}
Request
This endpoint doesn’t require any additional data.Response
The response isnull if the index is empty.
The ID of the resulting vector.
The resulting vector data.
curl https://hardy-cricket-48359-us1-vector.upstash.io/random \
-H "Authorization: Bearer <YOUR_TOKEN>" \
const url = "https://better-dodo-20522-us1-vector.upstash.io/random"; // Replace with your index endpoint.
const token = "YOUR_TOKEN"; // Replace with your actual token
fetch(url, {
method: "GET",
headers: {
Authorization: `Bearer ${token}`,
},
})
.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/random' # Replace with your index endpoint.
token = 'YOUR_TOKEN' # Replace with your actual token
headers = {
'Authorization': f'Bearer {token}',
}
response = requests.get(url, headers=headers)
print(response.json())
{
"result" : {
"id" : "1",
"vector" : [0.1, 0.2, 0.3]
}
}
Was this page helpful?
⌘I