Run a saved query
US Region: https://public-api.sessionboard.com · EU Region: https://public-api-eu.sessionboard.com
Execute a previously saved SbQL query by ID. Requires the read:insights scope.
Request example
curl --request POST \ --url 'https://public-api.sessionboard.com/v1/insights/queries/{queryId}/run' \ --header 'x-access-token: <api-token>' \ --header 'Content-Type: application/json' \ --data '{ "eventId": 123, "eventIds": [ 123 ], "obfuscatePii": false, "format": "<string>", "page": 123, "limit": 123}'const response = await fetch('https://public-api.sessionboard.com/v1/insights/queries/{queryId}/run', { method: 'POST', headers: { "x-access-token": "<api-token>", "Content-Type": "application/json" }, body: JSON.stringify({ "eventId": 123, "eventIds": [ 123 ], "obfuscatePii": false, "format": "<string>", "page": 123, "limit": 123 }),});
const data = await response.json();console.log(data);import requests
response = requests.request( "POST", "https://public-api.sessionboard.com/v1/insights/queries/{queryId}/run", headers={ "x-access-token": "<api-token>", "Content-Type": "application/json" }, json={ "eventId": 123, "eventIds": [ 123 ], "obfuscatePii": False, "format": "<string>", "page": 123, "limit": 123 },)
print(response.json())<?php
$curl = curl_init();
curl_setopt_array($curl, [ CURLOPT_URL => "https://public-api.sessionboard.com/v1/insights/queries/{queryId}/run", CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => "POST", CURLOPT_POSTFIELDS => '{ "eventId": 123, "eventIds": [ 123 ], "obfuscatePii": false, "format": "<string>", "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/insights/queries/{queryId}/run", strings.NewReader(`{ "eventId": 123, "eventIds": [ 123 ], "obfuscatePii": false, "format": "<string>", "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/insights/queries/{queryId}/run")) .header("x-access-token", "<api-token>") .header("Content-Type", "application/json") .method("POST", HttpRequest.BodyPublishers.ofString("{\n \"eventId\": 123,\n \"eventIds\": [\n 123\n ],\n \"obfuscatePii\": false,\n \"format\": \"<string>\",\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-tokenstringheaderrequiredOrganization API token. Generate from Organization Settings → API Tokens.
Path parameters
queryIdstringpathrequiredThe saved query ID.
Request body
eventIdintegerOverride the event scope for this run.
eventIdsinteger[]Override with multiple event scopes.
obfuscatePiibooleanSet to
trueto mask personal-data fields (such as emails and phone numbers) in the results. Results are not masked unless you sendtrue.- Default
false
formatstringpageintegerlimitinteger
{ "eventId": 123, "eventIds": [ 123 ], "obfuscatePii": false, "format": "<string>", "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
401
Unauthorized
403
Insufficient scope
404
Saved query not found
Response examples
{ "results": [ {} ], "pagination": { "currentPage": 1, "pageSize": 25, "totalPages": 4, "totalResults": 97 }}