Call VectorAmp from any backend with the REST API
Use the REST API when your backend runtime does not have an official SDK yet, or when you want a minimal integration from an existing service.
What you will build
A backend endpoint that calls VectorAmp dataset search with API-key authentication, metadata filters, and cited document context.
Prerequisites
- A VectorAmp API key.
- A dataset ID.
- Backend runtime capable of making HTTPS requests.
Request shape
VectorAmp API keys are sent with the X-API-Key header.
curl https://api.vectoramp.com/datasets/ds_123/search \
-H "X-API-Key: $VECTORAMP_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"query_text": "data retention policy",
"top_k": 10,
"filters": {"region": "eu", "policy_status": "current"},
"include_documents": true,
"include_metadata": true
}'
Node.js fetch example
const response = await fetch('https://api.vectoramp.com/datasets/ds_123/search', {
method: 'POST',
headers: {
'X-API-Key': process.env.VECTORAMP_API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
query_text: 'data retention policy',
top_k: 10,
filters: { region: 'eu', policy_status: 'current' },
include_documents: true,
include_metadata: true
})
});
if (!response.ok) {
throw new Error(`VectorAmp search failed: ${response.status}`);
}
const results = await response.json();
console.log(results);
Python requests example
pip install requests
import os
import requests
response = requests.post(
"https://api.vectoramp.com/datasets/ds_123/search",
headers={
"X-API-Key": os.environ["VECTORAMP_API_KEY"],
"Content-Type": "application/json",
},
json={
"query_text": "data retention policy",
"top_k": 10,
"filters": {"region": "eu", "policy_status": "current"},
"include_documents": True,
"include_metadata": True,
},
timeout=30,
)
response.raise_for_status()
print(response.json())
Production notes
- Keep API keys server-side.
- Add retries for transient 429/5xx responses.
- Log request IDs and status codes.
- Apply tenant and permission filters in your backend.
- Return citations or document IDs to the UI so users can verify answers.
When to prefer an SDK
Use an official SDK when one exists for your runtime. SDKs handle request naming, typed source helpers, dataset resources, and streaming helpers.