curl --request POST \
--url https://app.traceroot.ai/api/v1/public/sql \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"max_rows": 500000,
"parameters": {}
}
'import requests
url = "https://app.traceroot.ai/api/v1/public/sql"
payload = {
"query": "<string>",
"max_rows": 500000,
"parameters": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: '<string>', max_rows: 500000, parameters: {}})
};
fetch('https://app.traceroot.ai/api/v1/public/sql', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.traceroot.ai/api/v1/public/sql",
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' => '<string>',
'max_rows' => 500000,
'parameters' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.traceroot.ai/api/v1/public/sql"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"max_rows\": 500000,\n \"parameters\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <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))
}HttpResponse<String> response = Unirest.post("https://app.traceroot.ai/api/v1/public/sql")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"max_rows\": 500000,\n \"parameters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.traceroot.ai/api/v1/public/sql")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"max_rows\": 500000,\n \"parameters\": {}\n}"
response = http.request(request)
puts response.read_body{
"columns": [
{
"name": "<string>",
"type": "<string>"
}
],
"elapsed_ms": 123,
"row_count": 123,
"rows": [
[
"<unknown>"
]
],
"truncated": true,
"statistics": {}
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Run Sql
Run one read-only SQL query scoped to the caller’s project.
Args:
auth (DualStampedAuth): Resolved credential context. Its project_id
is the only project this query can ever see.
body (SqlRequest): The query, optional parameter values, and an optional
row cap that the service clamps down to the server ceiling.
Returns: SqlResponse: Columns, rows, and whether more rows matched than were returned.
Raises: HTTPException: 400 when the query breaks the read-only contract or asks for more than the server allows, 429 when no query slot is free, 500 when execution fails for a reason the caller cannot act on.
curl --request POST \
--url https://app.traceroot.ai/api/v1/public/sql \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"query": "<string>",
"max_rows": 500000,
"parameters": {}
}
'import requests
url = "https://app.traceroot.ai/api/v1/public/sql"
payload = {
"query": "<string>",
"max_rows": 500000,
"parameters": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({query: '<string>', max_rows: 500000, parameters: {}})
};
fetch('https://app.traceroot.ai/api/v1/public/sql', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.traceroot.ai/api/v1/public/sql",
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' => '<string>',
'max_rows' => 500000,
'parameters' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.traceroot.ai/api/v1/public/sql"
payload := strings.NewReader("{\n \"query\": \"<string>\",\n \"max_rows\": 500000,\n \"parameters\": {}\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <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))
}HttpResponse<String> response = Unirest.post("https://app.traceroot.ai/api/v1/public/sql")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"query\": \"<string>\",\n \"max_rows\": 500000,\n \"parameters\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.traceroot.ai/api/v1/public/sql")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"query\": \"<string>\",\n \"max_rows\": 500000,\n \"parameters\": {}\n}"
response = http.request(request)
puts response.read_body{
"columns": [
{
"name": "<string>",
"type": "<string>"
}
],
"elapsed_ms": 123,
"row_count": 123,
"rows": [
[
"<unknown>"
]
],
"truncated": true,
"statistics": {}
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}{
"detail": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Target project for the request. Required when authenticating with a user session token (a user credential is only meaningful scoped to a project); for an API key it is optional and, if given, must match the key's project.
Body
A public SQL query. The project is never part of this body.
extra="forbid" is the point rather than tidiness: scope is resolved from
the credential, so a body carrying project_id or a scope_* key is a
caller trying to choose a tenant. Forbidding unknown keys turns that into a
422 instead of a silently ignored field.
Response
Successful Response

