Developer Hub
Integrate powerful RAG capabilities into your applications in minutes.
Introduction
VectorizeAI provides a simple REST API to interact with your knowledge bases (DataStores) and AI Agents. Whether you're building a chatbot, a support tool, or an internal search engine, our API makes it seamless.
Current Base URL: Detecting...
Authentication
All API requests must include your API Key in the headers. You can generate keys from your Dashboard.
Headers
X-API-Key: mrairag-k-xxxxxxxxxxxxxxxxxx
| Header | Required | Description |
|---|---|---|
X-API-Key | Yes | Your global API secret key. |
Content-Type | Yes | Must be application/json for POST requests. |
Query API (Ask AI)
Use this endpoint to ask questions to an AI Agent or a specific DataStore.
POST
/api/query
JSON Payload
{
"question": "What is the return policy?",
"agent_id": "agent_123",
"stream": false
}
Python Implementation
The easiest way to use VectorizeAI in Python using the requests library.
Python
import requests BASE_URL = "" API_KEY = "YOUR_API_KEY" headers = { "X-API-Key": API_KEY, "Content-Type": "application/json" } payload = { "question": "How do I use the API?", "agent_id": "agent_id_here" } response = requests.post(f"{BASE_URL}/api/query", json=payload, headers=headers) if response.status_code == 200: print(response.json()["answer"]) else: print("Error:", response.text)
Node.js Implementation
Using the modern fetch API in Node.js or the browser.
JavaScript
const BASE_URL = ''; const API_KEY = 'YOUR_API_KEY'; async function askQuestion(question) { const response = await fetch(`${BASE_URL}/api/query`, { method: 'POST', headers: { 'X-API-Key': API_KEY, 'Content-Type': 'application/json' }, body: JSON.stringify({ question: question, agent_id: 'agent_id_here' }) }); const data = await response.json(); console.log(data.answer); }
Streaming Responses
For high-performance apps, use SSE (Server-Sent Events) to get answers word-by-word.
cURL
curl -X POST "/api/query" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"question": "Tell me a story", "stream": true}'