Skip to main content
POST
/
brains
/
{id}
/
query
Query a brain
curl --request POST \
  --url https://versuno.ai/api/public/brains/{id}/query \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "query": "How do I set up dynamic routes?"
}
'
import requests

url = "https://versuno.ai/api/public/brains/{id}/query"

payload = { "query": "How do I set up dynamic routes?" }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: 'How do I set up dynamic routes?'})
};

fetch('https://versuno.ai/api/public/brains/{id}/query', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://versuno.ai/api/public/brains/{id}/query"

payload := strings.NewReader("{\n \"query\": \"How do I set up dynamic routes?\"\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "<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))

}
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://versuno.ai/api/public/brains/{id}/query",
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([
'query' => 'How do I set up dynamic routes?'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
require 'uri'
require 'net/http'

url = URI("https://versuno.ai/api/public/brains/{id}/query")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"How do I set up dynamic routes?\"\n}"

response = http.request(request)
puts response.read_body
HttpResponse<String> response = Unirest.post("https://versuno.ai/api/public/brains/{id}/query")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"How do I set up dynamic routes?\"\n}")
.asString();
using RestSharp;


var options = new RestClientOptions("https://versuno.ai/api/public/brains/{id}/query");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "<api-key>");
request.AddJsonBody("{\n \"query\": \"How do I set up dynamic routes?\"\n}", false);
var response = await client.PostAsync(request);

Console.WriteLine("{0}", response.Content);
{
  "success": true,
  "data": {
    "objects": {
      "chunks": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "type": "chunk",
          "parent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "container_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "brain_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "page_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "canonical": "<string>",
          "created_at": "<string>",
          "updated_at": "<string>"
        }
      ],
      "chunk_parts": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "type": "chunk_part",
          "parent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "container_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "brain_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "content": "Dynamic segments are passed as the params prop...",
          "relevancy_score": 0.82,
          "metadata": {
            "num": 2
          },
          "created_at": "<string>",
          "updated_at": "<string>"
        }
      ],
      "pages": [
        {
          "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "type": "page",
          "parent_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "container_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "brain_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
          "canonical": "<string>",
          "metadata": {
            "urlGroup": [
              "<string>"
            ]
          },
          "created_at": "<string>",
          "updated_at": "<string>"
        }
      ]
    },
    "graph_tree": [
      {
        "id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
        "children": "<array>"
      }
    ],
    "graph_context": {
      "relations": {}
    }
  },
  "error": null,
  "metadata": {
    "query_latency_ms": 142,
    "embedding_latency_ms": 88
  }
}
{
"error": "Wrong data: assetType is required"
}
{
"error": "Invalid API key"
}
Sending this request runs the live, metered query endpoint and consumes your brain-query quota.

Authorizations

Authorization
string
header
default:Bearer uk_live_your_api_key_here
required

Versuno API key. Must be prefixed with Bearer. Format: Bearer uk_live_...

Path Parameters

id
string<uuid>
required

ID of the brain to query.

Body

application/json
query
string
required

The natural-language query to search the brain with.

Required string length: 1 - 4000
Example:

"How do I set up dynamic routes?"

entities
string[]

Optional list of entity names to bias the search toward.

Example:
["routing", "app-router"]
limit
integer
default:5

Maximum number of results to return (1–20, default 5).

Required range: 1 <= x <= 20
Example:

5

Response

Query result envelope. Check success to determine if the query actually succeeded.

Result envelope for a brain query. Always returned with HTTP 200; check success and error.

success
boolean

Whether the query succeeded. Inspect this rather than the HTTP status.

Example:

true

data
object | null

Query result payload, or null when success is false.

error
string | null

Error message when success is false, otherwise null.

Example:

null

metadata
object