Generate a SbQL query from natural language (event-scoped)
US Region: https://public-api.sessionboard.com · EU Region: https://public-api-eu.sessionboard.com
Use AI to translate natural language into a SbQL query scoped to the event in the path. Requires the read:insights scope. An eventId in the body that names a different event returns 400 (or 403 EVENT_NOT_ALLOWED for a token limited to specific events).
Request example
curl --request POST \ --url 'https://public-api.sessionboard.com/v1/event/{eventId}/insights/ai/generate' \ --header 'x-access-token: <api-token>' \ --header 'Content-Type: application/json' \ --data '{ "prompt": "<string>"}'const response = await fetch('https://public-api.sessionboard.com/v1/event/{eventId}/insights/ai/generate', { method: 'POST', headers: { "x-access-token": "<api-token>", "Content-Type": "application/json" }, body: JSON.stringify({ "prompt": "<string>" }),});
const data = await response.json();console.log(data);import requests
response = requests.request( "POST", "https://public-api.sessionboard.com/v1/event/{eventId}/insights/ai/generate", headers={ "x-access-token": "<api-token>", "Content-Type": "application/json" }, json={ "prompt": "<string>" },)
print(response.json())<?php
$curl = curl_init();
curl_setopt_array($curl, [ CURLOPT_URL => "https://public-api.sessionboard.com/v1/event/{eventId}/insights/ai/generate", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "prompt": "<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/event/{eventId}/insights/ai/generate", strings.NewReader(`{ "prompt": "<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/event/{eventId}/insights/ai/generate")) .header("x-access-token", "<api-token>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{\n \"prompt\": \"<string>\"\n}")) .build();
HttpResponse<String> response = HttpClient.newHttpClient() .send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());Try it
Response headers
Authorizations
x-access-tokenstringheaderOrganization API token. Generate from Organization Settings → API Tokens.
AuthorizationBearer <token>headerorOAuth 2.1 access token. Obtained via the OAuth PKCE flow at
/oauth/token.
Send one of these. See Authentication.
Path parameters
eventIdintegerpathrequired
Request body
promptstringrequired
{ "prompt": "<string>"}Responses
200application/json
OK
querystringexplanationstring
401
Unauthorized
403
Insufficient scope
Response examples
{ "query": "<string>", "explanation": "<string>"}