Integrate expert chat powered by your knowledge base into any application.
See it in action: andruid.ai — a live integration built with this API.
All API requests require an API key passed via the X-Api-Key header.
X-Api-Key: pk_live_...
API keys are bound to a specific expert and billed to the key owner's wallet. To request an API key, contact support .
POST https://sagetube.ai/api/public/expert/chat
{
"question": "What do you know about vitamin C?",
"session_token": null
}
| Field | Type | Required | Description |
|---|---|---|---|
question |
string | Yes | The question to ask (max 2000 characters) |
session_token |
string (UUID) | No | Session token from a previous response. Omit or send null for first request. |
{
"session_token": "3ab1aca5-6442-4456-81da-11b5f1ddceda",
"answer": {
"answer_text": "Vitamin C is a powerful antioxidant...",
"answer_type": "directly_supported",
"supported_points": [
{
"text": "Vitamin C boosts immunity",
"evidence_refs": ["E1", "E3"]
}
],
"synthesis_points": [],
"uncertainties": [],
"citations": {
"E1": {
"source_title": "Video about vitamins",
"source_type": "uploaded_video",
"source_url": null,
"passage_text": "Original transcript passage..."
}
}
},
"queries_remaining": 4,
"limit_reached": false
}
| Type | Meaning |
|---|---|
directly_supported |
Answer is directly backed by cited evidence passages |
synthesized |
Answer combines information from multiple sources |
weakly_supported |
Limited evidence available — answer may be incomplete |
unsupported |
No relevant evidence found in the expert's knowledge base |
{
"session_token": "3ab1aca5-...",
"limit_reached": true,
"signup_url": "https://sagetube.ai/register",
"message": "You've used your free questions. Create an account to continue."
}
All errors return {"error": "...", "message": "..."}
| Status | Error | Description |
|---|---|---|
| 401 | unauthorized |
Invalid or missing API key |
| 402 | service_unavailable |
API key owner has insufficient wallet balance |
| 403 | forbidden |
Request IP not in the key's allowlist |
| 422 | validation_error |
Invalid request (missing question, too long, invalid UUID) |
| 429 | rate_limited |
Too many requests or too many new sessions from this IP |
| 500 | internal_error |
Server error — retry the request |
session_token or send null. The response includes a new token.session_token from the previous response to maintain conversation context.limit_reached: true.Queries are billed to the API key owner's SageTube wallet at the standard pay-as-you-go rate. The owner must maintain sufficient wallet balance — if the balance reaches zero, the API returns HTTP 402.
First request — creates a new session:
curl -X POST https://sagetube.ai/api/public/expert/chat \
-H "Content-Type: application/json" \
-H "X-Api-Key: pk_live_your_key_here" \
-d '{"question": "What is vitamin D good for?"}'
Follow-up request — uses the session token from the first response:
curl -X POST https://sagetube.ai/api/public/expert/chat \
-H "Content-Type: application/json" \
-H "X-Api-Key: pk_live_your_key_here" \
-d '{"question": "Tell me more about dosage", "session_token": "3ab1aca5-6442-4456-81da-11b5f1ddceda"}'
andruid.ai is a working example of a thin-client integration:
.env (never exposed to the browser)Want a drop-in chat bubble instead? See the Chat Widget documentation — one script tag, no backend required.
SageTube Support
Hi! I'm SageTube's AI assistant. Ask me anything about the product, billing, or troubleshooting.