Generate a SbQL query from natural language
US Region: https://public-api.sessionboard.com · EU Region: https://public-api-eu.sessionboard.com
Use AI to translate a natural language prompt into a SbQL query. Requires the read:insights scope.
Request example
curl --request POST \ --url 'https://public-api.sessionboard.com/v1/insights/ai/generate' \ --header 'x-access-token: <api-token>' \ --header 'Content-Type: application/json' \ --data '{ "prompt": "Show me all accepted sessions with their speakers", "eventId": 123, "eventIds": [ 123 ], "conversationHistory": [ { "role": "<string>", "content": "<string>" } ]}'const response = await fetch('https://public-api.sessionboard.com/v1/insights/ai/generate', { method: 'POST', headers: { "x-access-token": "<api-token>", "Content-Type": "application/json" }, body: JSON.stringify({ "prompt": "Show me all accepted sessions with their speakers", "eventId": 123, "eventIds": [ 123 ], "conversationHistory": [ { "role": "<string>", "content": "<string>" } ] }),});
const data = await response.json();console.log(data);import requests
response = requests.request( "POST", "https://public-api.sessionboard.com/v1/insights/ai/generate", headers={ "x-access-token": "<api-token>", "Content-Type": "application/json" }, json={ "prompt": "Show me all accepted sessions with their speakers", "eventId": 123, "eventIds": [ 123 ], "conversationHistory": [ { "role": "<string>", "content": "<string>" } ] },)
print(response.json())<?php
$curl = curl_init();
curl_setopt_array($curl, [ CURLOPT_URL => "https://public-api.sessionboard.com/v1/insights/ai/generate", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "prompt": "Show me all accepted sessions with their speakers", "eventId": 123, "eventIds": [ 123 ], "conversationHistory": [ { "role": "<string>", "content": "<string>" } ]}', CURLOPT_HTTPHEADER => [ "x-access-token: <api-token>", "Content-Type: application/json", ],]);
$response = curl_exec($curl);curl_close($curl);
echo $response;package main
import ( "fmt" "io" "net/http" "strings")
func main() { req, _ := http.NewRequest("POST", "https://public-api.sessionboard.com/v1/insights/ai/generate", strings.NewReader(`{ "prompt": "Show me all accepted sessions with their speakers", "eventId": 123, "eventIds": [ 123 ], "conversationHistory": [ { "role": "<string>", "content": "<string>" } ]}`)) req.Header.Add("x-access-token", "<api-token>") 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))}HttpRequest request = HttpRequest.newBuilder() .uri(URI.create("https://public-api.sessionboard.com/v1/insights/ai/generate")) .header("x-access-token", "<api-token>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{\n \"prompt\": \"Show me all accepted sessions with their speakers\",\n \"eventId\": 123,\n \"eventIds\": [\n 123\n ],\n \"conversationHistory\": [\n {\n \"role\": \"<string>\",\n \"content\": \"<string>\"\n }\n ]\n}")) .build();
HttpResponse<String> response = HttpClient.newHttpClient() .send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());Try it
Response headers
Authorizations
x-access-tokenstringheaderrequiredOrganization API token. Generate from Organization Settings → API Tokens.
Request body
promptstringrequiredNatural language description of the data you want to query.
eventIdintegerScope to a single event for context.
eventIdsinteger[]Scope to multiple events for context.
conversationHistoryobject[]Previous conversation turns for multi-turn query refinement.
Show child attributes
rolestringThe message role (e.g., user, assistant).
contentstringThe message content.
{ "prompt": "Show me all accepted sessions with their speakers", "eventId": 123, "eventIds": [ 123 ], "conversationHistory": [ { "role": "<string>", "content": "<string>" } ]}Responses
200application/json
OK
querystringThe generated SbQL query.
explanationstringHuman-readable explanation of the generated query.
400
Bad request
401
Unauthorized
403
Insufficient scope
Response examples
{ "query": "<string>", "explanation": "<string>"}