API Tokens
API Documentation
Use your API token to query any connector in the enterprise. Replace
YOUR_API_TOKEN and CONNECTOR_SLUG with your values.Ask a Question (SQL Generation)
curl -X POST /api/c/CONNECTOR_SLUG/ask \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-d '{"question": "how many active SIMs?", "server": "auto"}'
server options: "auto" (GPU if available, else CPU), "gpu" (GPU only), "cpu" (CPU only)Response
{
"sql": "SELECT COUNT(*) AS count FROM profiles WHERE status = 'Active'",
"results": [{"count": 1247}]
}
Postman Setup
1. Method:
POST2. URL:
3. Headers tab:
Content-Type: application/jsonAuthorization: Bearer YOUR_API_TOKEN4. Body tab → raw → JSON:
{"question": "show top 10 customers", "server": "auto"}5. Click Send
Python Example
import requests
API_URL = "/api/c/CONNECTOR_SLUG/ask"
TOKEN = "YOUR_API_TOKEN"
resp = requests.post(API_URL, json={
"question": "how many active SIMs?",
"server": "auto",
}, headers={"Authorization": f"Bearer {TOKEN}"})
data = resp.json()
print(data["sql"])
print(data["results"])
JavaScript Example
const resp = await fetch("/api/c/CONNECTOR_SLUG/ask", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_TOKEN",
},
body: JSON.stringify({
question: "how many active SIMs?",
server: "auto",
}),
});
const data = await resp.json();
console.log(data.sql, data.results);