Ask Question
curl --request POST \
--url https://api.gurubase.io/api/v1/{guru_slug}/answer/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"question": "<string>",
"stream": true,
"mode": "<string>",
"session_id": "<string>",
"external_user_id": "<string>",
"fetch_existing": true,
"images": [
{}
],
"log_files": [
{}
],
"pdf_files": [
{}
]
}
'import requests
url = "https://api.gurubase.io/api/v1/{guru_slug}/answer/"
payload = {
"question": "<string>",
"stream": True,
"mode": "<string>",
"session_id": "<string>",
"external_user_id": "<string>",
"fetch_existing": True,
"images": [{}],
"log_files": [{}],
"pdf_files": [{}]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
question: '<string>',
stream: true,
mode: '<string>',
session_id: '<string>',
external_user_id: '<string>',
fetch_existing: true,
images: [{}],
log_files: [{}],
pdf_files: [{}]
})
};
fetch('https://api.gurubase.io/api/v1/{guru_slug}/answer/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gurubase.io/api/v1/{guru_slug}/answer/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'question' => '<string>',
'stream' => true,
'mode' => '<string>',
'session_id' => '<string>',
'external_user_id' => '<string>',
'fetch_existing' => true,
'images' => [
[
]
],
'log_files' => [
[
]
],
'pdf_files' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gurubase.io/api/v1/{guru_slug}/answer/"
payload := strings.NewReader("{\n \"question\": \"<string>\",\n \"stream\": true,\n \"mode\": \"<string>\",\n \"session_id\": \"<string>\",\n \"external_user_id\": \"<string>\",\n \"fetch_existing\": true,\n \"images\": [\n {}\n ],\n \"log_files\": [\n {}\n ],\n \"pdf_files\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gurubase.io/api/v1/{guru_slug}/answer/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"question\": \"<string>\",\n \"stream\": true,\n \"mode\": \"<string>\",\n \"session_id\": \"<string>\",\n \"external_user_id\": \"<string>\",\n \"fetch_existing\": true,\n \"images\": [\n {}\n ],\n \"log_files\": [\n {}\n ],\n \"pdf_files\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gurubase.io/api/v1/{guru_slug}/answer/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"question\": \"<string>\",\n \"stream\": true,\n \"mode\": \"<string>\",\n \"session_id\": \"<string>\",\n \"external_user_id\": \"<string>\",\n \"fetch_existing\": true,\n \"images\": [\n {}\n ],\n \"log_files\": [\n {}\n ],\n \"pdf_files\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"slug": "is-slack-supported-on-anteon-5fdf19ad-de4c-4f07-9dff-0fe1003dccac",
"content": "# Is Slack supported on Anteon?\n\n**Yes, Slack is supported on Anteon.** You can integrate Slack to receive notifications about anomalies in your Kubernetes cluster. This integration is available for Anteon Cloud and the Self-Hosted Enterprise Edition. For the Self-Hosted version, you need to create a Slack application and configure it with specific OAuth scopes. Once set up, you can receive alerts directly in your Slack channels. For detailed instructions, refer to the [Slack Integration Guide](https://getanteon.com/docs/self-hosted/self-hosted-slack-integration/).",
"question": "Is Slack supported on Anteon?",
"date_updated": "22 January 2025",
"trust_score": 76,
"references": [
{
"link": "https://getanteon.com/docs/self-hosted/self-hosted-slack-integration/",
"icon": "https://getanteon.com/img/favicon.ico",
"title": "📧 Slack Integration | Anteon"
}
],
"session_id": "3cdbdc4c-023f-45ce-832f-f1881b4f238b",
"question_url": "https://app.gurubase.io/g/gurubase/is-slack-supported-on-anteon-5fdf19ad-de4c-4f07-9dff-0fe1003dccac",
"can_receive_feedback": true
}
# Is Slack supported on Anteon?
**Yes, Slack is supported on Anteon.** You can integrate Slack to receive notifications about anomalies in your Kubernetes cluster. This integration is available for Anteon Cloud and the Self-Hosted Enterprise Edition. For the Self-Hosted version, you need to create a Slack application and configure it with specific OAuth scopes. Once set up, you can receive alerts directly in your Slack channels. For detailed instructions, refer to the [Slack Integration Guide](https://getanteon.com/docs/self-hosted/self-hosted-slack-integration/).
{
"msg": "<error message>"
}
{
"msg": "Invalid API key"
}
{
"msg": "Request was throttled. Expected available in 56 seconds."
}
{
"msg": "External user ID mismatch for this session. Code: S-902"
}
Endpoints
Ask Question
Ask a question to your Guru
POST
/
{guru_slug}
/
answer
/
Ask Question
curl --request POST \
--url https://api.gurubase.io/api/v1/{guru_slug}/answer/ \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"question": "<string>",
"stream": true,
"mode": "<string>",
"session_id": "<string>",
"external_user_id": "<string>",
"fetch_existing": true,
"images": [
{}
],
"log_files": [
{}
],
"pdf_files": [
{}
]
}
'import requests
url = "https://api.gurubase.io/api/v1/{guru_slug}/answer/"
payload = {
"question": "<string>",
"stream": True,
"mode": "<string>",
"session_id": "<string>",
"external_user_id": "<string>",
"fetch_existing": True,
"images": [{}],
"log_files": [{}],
"pdf_files": [{}]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
question: '<string>',
stream: true,
mode: '<string>',
session_id: '<string>',
external_user_id: '<string>',
fetch_existing: true,
images: [{}],
log_files: [{}],
pdf_files: [{}]
})
};
fetch('https://api.gurubase.io/api/v1/{guru_slug}/answer/', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.gurubase.io/api/v1/{guru_slug}/answer/",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'question' => '<string>',
'stream' => true,
'mode' => '<string>',
'session_id' => '<string>',
'external_user_id' => '<string>',
'fetch_existing' => true,
'images' => [
[
]
],
'log_files' => [
[
]
],
'pdf_files' => [
[
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.gurubase.io/api/v1/{guru_slug}/answer/"
payload := strings.NewReader("{\n \"question\": \"<string>\",\n \"stream\": true,\n \"mode\": \"<string>\",\n \"session_id\": \"<string>\",\n \"external_user_id\": \"<string>\",\n \"fetch_existing\": true,\n \"images\": [\n {}\n ],\n \"log_files\": [\n {}\n ],\n \"pdf_files\": [\n {}\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.gurubase.io/api/v1/{guru_slug}/answer/")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"question\": \"<string>\",\n \"stream\": true,\n \"mode\": \"<string>\",\n \"session_id\": \"<string>\",\n \"external_user_id\": \"<string>\",\n \"fetch_existing\": true,\n \"images\": [\n {}\n ],\n \"log_files\": [\n {}\n ],\n \"pdf_files\": [\n {}\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.gurubase.io/api/v1/{guru_slug}/answer/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"question\": \"<string>\",\n \"stream\": true,\n \"mode\": \"<string>\",\n \"session_id\": \"<string>\",\n \"external_user_id\": \"<string>\",\n \"fetch_existing\": true,\n \"images\": [\n {}\n ],\n \"log_files\": [\n {}\n ],\n \"pdf_files\": [\n {}\n ]\n}"
response = http.request(request)
puts response.read_body{
"slug": "is-slack-supported-on-anteon-5fdf19ad-de4c-4f07-9dff-0fe1003dccac",
"content": "# Is Slack supported on Anteon?\n\n**Yes, Slack is supported on Anteon.** You can integrate Slack to receive notifications about anomalies in your Kubernetes cluster. This integration is available for Anteon Cloud and the Self-Hosted Enterprise Edition. For the Self-Hosted version, you need to create a Slack application and configure it with specific OAuth scopes. Once set up, you can receive alerts directly in your Slack channels. For detailed instructions, refer to the [Slack Integration Guide](https://getanteon.com/docs/self-hosted/self-hosted-slack-integration/).",
"question": "Is Slack supported on Anteon?",
"date_updated": "22 January 2025",
"trust_score": 76,
"references": [
{
"link": "https://getanteon.com/docs/self-hosted/self-hosted-slack-integration/",
"icon": "https://getanteon.com/img/favicon.ico",
"title": "📧 Slack Integration | Anteon"
}
],
"session_id": "3cdbdc4c-023f-45ce-832f-f1881b4f238b",
"question_url": "https://app.gurubase.io/g/gurubase/is-slack-supported-on-anteon-5fdf19ad-de4c-4f07-9dff-0fe1003dccac",
"can_receive_feedback": true
}
# Is Slack supported on Anteon?
**Yes, Slack is supported on Anteon.** You can integrate Slack to receive notifications about anomalies in your Kubernetes cluster. This integration is available for Anteon Cloud and the Self-Hosted Enterprise Edition. For the Self-Hosted version, you need to create a Slack application and configure it with specific OAuth scopes. Once set up, you can receive alerts directly in your Slack channels. For detailed instructions, refer to the [Slack Integration Guide](https://getanteon.com/docs/self-hosted/self-hosted-slack-integration/).
{
"msg": "<error message>"
}
{
"msg": "Invalid API key"
}
{
"msg": "Request was throttled. Expected available in 56 seconds."
}
{
"msg": "External user ID mismatch for this session. Code: S-902"
}
Ask a question to your AI-powered Q&A assistant and receive a detailed response with references.
To ask follow-up questions, include the
session_id from a previous response in your request. This allows the Guru to maintain context of the conversation.Path Parameters
string
required
The slug of the Guru to ask a question to
Headers
string
required
Your API key for authentication. You can obtain your API key from the Gurubase dashboard.
Body Parameters
string
required
The question to ask your Guru
boolean
default:false
Whether to stream the response or not. If true, only the content of the response will be returned in chunks.
string
default:"chat"
Selects the answer pipeline for this request. Accepted values:
chat(default): the classic single-pass answer pipeline.agent: the autonomous tool loop, which lets the Guru chain Agentic Actions and other tools before answering.
agent requires an agent-capable Guru (multi-step answers enabled with at least one usable tool). If the Guru does not qualify, the request silently falls back to chat. Any unrecognized value is also treated as chat.string
Maintain conversation context for follow-up questions. When a question is asked, the response includes a session_id that can be used in subsequent requests. On the Gurubase platform, these conversation sessions are called “Binges”.
string
External user identifier for tracking user-specific conversation sessions. When provided, this ID is stored in the session. If a session already exists with a different external_user_id, the request will be rejected.
boolean
default:false
Fetch an existing answer. Do not ask a new question (generally used after streaming to fetch the answer fields like references etc.).
array
Optional list of image attachments to include with the question. Each item is an object with:
data(string): Base64-encoded image as a data URL, formatted asdata:<mime>;base64,<payload>(see theencode_binaryhelper in the “Asking With Attachments” example).name(string): File name (e.g.screenshot.png).type(string): MIME type (e.g.image/png).
array
Optional list of log file attachments to include with the question. Each item is an object with:
data(string): Raw UTF-8 log text (see theread_loghelper in the “Asking With Attachments” example). Not base64-encoded.name(string): File name (e.g.app.log).
array
Optional list of PDF attachments to include with the question. Each item is an object with:
data(string): Base64-encoded PDF as a data URL, formatted asdata:<mime>;base64,<payload>(see theencode_binaryhelper in the “Asking With Attachments” example).name(string): File name (e.g.doc.pdf).type(string): MIME type (typicallyapplication/pdf).
Response
string
Unique identifier for the question-answer pair
string
The answer in Markdown format
string
The original question
string
The date when the answer was generated
number
Confidence score of the answer (0-100)
array
Array of reference sources used to generate the answer
Show Reference Object
Show Reference Object
string
URL of the reference
string
Icon URL for the reference source
string
Title of the reference
boolean
Present and
true only when the reference is an attachment (log, PDF, or image) that was uploaded in an earlier turn of the same conversation session and is being surfaced again on a follow-up. Omitted for fresh attachments and knowledge base sources.string
Unique identifier for the conversation session
string
URL link to open the question on the app
boolean
Whether the question can receive votes and feedback. Returns
false for simple interactions and clarifications, true for normal answers. See the Record Vote endpoint for more information on providing feedbacks and votes.When
stream=true, the response will be a text stream containing only the answer content in chunks, not the full JSON object. The JSON response format shown below applies only when stream=false (default).{
"slug": "is-slack-supported-on-anteon-5fdf19ad-de4c-4f07-9dff-0fe1003dccac",
"content": "# Is Slack supported on Anteon?\n\n**Yes, Slack is supported on Anteon.** You can integrate Slack to receive notifications about anomalies in your Kubernetes cluster. This integration is available for Anteon Cloud and the Self-Hosted Enterprise Edition. For the Self-Hosted version, you need to create a Slack application and configure it with specific OAuth scopes. Once set up, you can receive alerts directly in your Slack channels. For detailed instructions, refer to the [Slack Integration Guide](https://getanteon.com/docs/self-hosted/self-hosted-slack-integration/).",
"question": "Is Slack supported on Anteon?",
"date_updated": "22 January 2025",
"trust_score": 76,
"references": [
{
"link": "https://getanteon.com/docs/self-hosted/self-hosted-slack-integration/",
"icon": "https://getanteon.com/img/favicon.ico",
"title": "📧 Slack Integration | Anteon"
}
],
"session_id": "3cdbdc4c-023f-45ce-832f-f1881b4f238b",
"question_url": "https://app.gurubase.io/g/gurubase/is-slack-supported-on-anteon-5fdf19ad-de4c-4f07-9dff-0fe1003dccac",
"can_receive_feedback": true
}
# Is Slack supported on Anteon?
**Yes, Slack is supported on Anteon.** You can integrate Slack to receive notifications about anomalies in your Kubernetes cluster. This integration is available for Anteon Cloud and the Self-Hosted Enterprise Edition. For the Self-Hosted version, you need to create a Slack application and configure it with specific OAuth scopes. Once set up, you can receive alerts directly in your Slack channels. For detailed instructions, refer to the [Slack Integration Guide](https://getanteon.com/docs/self-hosted/self-hosted-slack-integration/).
{
"msg": "<error message>"
}
{
"msg": "Invalid API key"
}
{
"msg": "Request was throttled. Expected available in 56 seconds."
}
{
"msg": "External user ID mismatch for this session. Code: S-902"
}
Code Examples
- Streaming and Fetching
- Asking With Attachments
Stream a response for real-time output, then fetch the completed answer to get metadata like
trust_score, references, and session_id.// Configuration
const API_KEY = 'your-api-key-here';
const BASE_URL = 'https://api.gurubase.io/api/v1';
const GURU_SLUG = 'your-guru-slug';
// Simple stream example
async function askGurubase(question) {
console.log("Asking question:", question);
const response = await fetch(`${BASE_URL}/${GURU_SLUG}/answer/`, {
method: 'POST',
headers: {
'X-API-KEY': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
question: question,
stream: true
})
});
// Read stream chunks
const reader = response.body.getReader();
const decoder = new TextDecoder();
console.log("Answer below:\n");
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
process.stdout.write(chunk.replace(/\n/g, ' '));
}
console.log("\n");
}
// Fetch existing answer with metadata
async function fetchExisting(question) {
const response = await fetch(`${BASE_URL}/${GURU_SLUG}/answer/`, {
method: 'POST',
headers: {
'X-API-KEY': API_KEY,
'Content-Type': 'application/json'
},
body: JSON.stringify({
question: question,
stream: false,
fetch_existing: true
})
});
const data = await response.json();
console.log('Answer JSON:');
console.log(data);
return data;
}
// Usage
const question = "Does Gurubase support Slack?";
// 1. Ask with stream
await askGurubase(question);
// 2. Then fetch the answer from the db (for the JSON fields)
await fetchExisting(question);
Ask a question with image, log, and PDF attachments. Images and PDFs are base64-encoded into
data:<mime>;base64,... URLs; log files are sent as raw UTF-8 text.Fill in the Config block, list file paths under IMAGE_PATHS, LOG_PATHS, and PDF_PATHS, then run:pip install requests
python ask_with_attachments.py
ask_with_attachments.py
import base64
import json
import mimetypes
import sys
from pathlib import Path
from typing import List
import requests
# ---------- Config ----------
BASE_URL = "https://api.gurubase.io/api/v1"
API_KEY = "your-api-key-here"
GURU_SLUG = "your-guru-slug"
QUESTION = "Summarize the attached files."
STREAM = False
# ---------- Attachments (absolute paths) ----------
IMAGE_PATHS: List[str] = [
# "/path/to/screenshot.png",
]
LOG_PATHS: List[str] = [
# "/path/to/app.log",
]
PDF_PATHS: List[str] = [
# "/path/to/doc.pdf",
]
def encode_binary(path: Path, fallback_mime: str) -> dict:
mime = mimetypes.guess_type(path.name)[0] or fallback_mime
b64 = base64.b64encode(path.read_bytes()).decode("ascii")
return {
"data": f"data:{mime};base64,{b64}",
"name": path.name,
"type": mime,
}
def read_log(path: Path) -> dict:
return {
"data": path.read_text(encoding="utf-8", errors="replace"),
"name": path.name,
}
def build_payload() -> dict:
payload: dict = {"question": QUESTION, "stream": STREAM}
if IMAGE_PATHS:
payload["images"] = [encode_binary(Path(p), "image/png") for p in IMAGE_PATHS]
if LOG_PATHS:
payload["log_files"] = [read_log(Path(p)) for p in LOG_PATHS]
if PDF_PATHS:
payload["pdf_files"] = [encode_binary(Path(p), "application/pdf") for p in PDF_PATHS]
return payload
def main() -> int:
url = f"{BASE_URL.rstrip('/')}/{GURU_SLUG}/answer/"
headers = {"x-api-key": API_KEY, "Content-Type": "application/json"}
payload = build_payload()
resp = requests.post(url, headers=headers, json=payload, timeout=180, stream=STREAM)
if STREAM:
for chunk in resp.iter_content(chunk_size=None, decode_unicode=True):
if chunk:
sys.stdout.write(chunk)
sys.stdout.flush()
sys.stdout.write("\n")
return 0 if resp.ok else 1
try:
print(json.dumps(resp.json(), indent=2, ensure_ascii=False))
except ValueError:
print(resp.text)
return 0 if resp.ok else 1
if __name__ == "__main__":
sys.exit(main())
PDFs are validated upfront: if the request exceeds the Guru’s PDF count or per-file size limit, the endpoint returns HTTP 400 and no answer is generated.Images and log files that exceed the Guru’s count or size limits are silently skipped during answering, and the response includes a note stating how many attachments were dropped.
Was this page helpful?