Spoar
SQL

Run SQL across projects

POST
/v2/query

As the per-project route, over every project you may run SQL on.

Authorization

AuthorizationBearer <token>

An API token from POST /v2/tokens (at_live_...), or a project's secret key (sk_...) for server-side ingest.

In: header

Request Body

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v2/query" \  -H "Content-Type: application/json" \  -d '{    "sql": "select route, count(*) as views from events where name = \'pageview\' and ts > now() - interval \'7 days\' group by 1 order by 2 desc limit 5"  }'
{  "columns": [    "route",    "views"  ],  "rows": [    [      "/",      1011    ],    [      "/blog/[slug]",      530    ]  ],  "rowCount": 2,  "truncated": false,  "durationMs": 41}