Execute a SbQL query (event-scoped)
US Region: https://public-api.sessionboard.com · EU Region: https://public-api-eu.sessionboard.com
Execute a SbQL query scoped to the event in the path. Requires the read:insights scope. The query runs on that event only; an eventId or eventIds in the body or query string that names a different event returns 400 (or 403 EVENT_NOT_ALLOWED for a token limited to specific events). Use POST /v1/insights/execute for queries across events.
Request example
curl --request POST \ --url 'https://public-api.sessionboard.com/v1/event/{eventId}/insights/execute' \ --header 'x-access-token: <api-token>' \ --header 'Content-Type: application/json' \ --data '{ "query": "<string>", "obfuscatePii": false, "page": 123, "limit": 123}'const response = await fetch('https://public-api.sessionboard.com/v1/event/{eventId}/insights/execute', { method: 'POST', headers: { "x-access-token": "<api-token>", "Content-Type": "application/json" }, body: JSON.stringify({ "query": "<string>", "obfuscatePii": false, "page": 123, "limit": 123 }),});
const data = await response.json();console.log(data);import requests
response = requests.request( "POST", "https://public-api.sessionboard.com/v1/event/{eventId}/insights/execute", headers={ "x-access-token": "<api-token>", "Content-Type": "application/json" }, json={ "query": "<string>", "obfuscatePii": False, "page": 123, "limit": 123 },)
print(response.json())<?php
$curl = curl_init();
curl_setopt_array($curl, [ CURLOPT_URL => "https://public-api.sessionboard.com/v1/event/{eventId}/insights/execute", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "query": "<string>", "obfuscatePii": false, "page": 123, "limit": 123}', 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/execute", strings.NewReader(`{ "query": "<string>", "obfuscatePii": false, "page": 123, "limit": 123}`)) 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/execute")) .header("x-access-token", "<api-token>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{\n \"query\": \"<string>\",\n \"obfuscatePii\": false,\n \"page\": 123,\n \"limit\": 123\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
eventIdintegerpathrequiredThe event ID to scope the query to.
Request body
querystringrequiredobfuscatePiibooleanSet to
trueto mask personal-data fields (such as emails and phone numbers) in the results. Results are not masked unless you sendtrue.- Default
false
pageintegerlimitinteger
{ "query": "<string>", "obfuscatePii": false, "page": 123, "limit": 123}Responses
200application/json
OK
resultsobject[]paginationPaginationPagination metadata returned with POST search responses. The event-settings GET lists return the same numbers under snake_case keys — see
ListPagination.Show child attributes
currentPageintegerpageSizeintegertotalPagesintegertotalResultsinteger
400
Invalid query
401
Unauthorized
403
Insufficient scope
Response examples
{ "results": [ {} ], "pagination": { "currentPage": 1, "pageSize": 25, "totalPages": 4, "totalResults": 97 }}