On this page
Query API
Run ObiQL searches and discover fields from scripts with a personal access token.
The supported external read API is the same pair of routes used by the Log Explorer. There is no separate public service or second query language:
POST /v1/queryruns ObiQL searches and aggregations.GET /v1/query/schemadiscovers fields available to the caller.
Start with the API overview for the base URL and common error
shape. The generated reference is built from the same
OpenAPI document served at GET /openapi.json.
1. Create a personal access token
Open Preferences, Workspace access tokens, click + Create token, and copy the token when it is shown. See API Keys for creation, expiry, and revocation.
Choose one of these scopes:
| Scope | Query behavior |
|---|---|
read_only | Runs reads and schema discovery. It is refused for ` |
full_access | Runs reads. ` |
Do not use an ingest key. It represents a data input, carries no person, and
is refused by every query route.
export OBISTACK_TOKEN=obi_ro_replace_me
2. Run an ObiQL query
curl -s https://api.obistack.com/v1/query \
-H "Authorization: Bearer $OBISTACK_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"query": "service:payments level:error | stats count() by host",
"from": "now-1h",
"to": "now",
"page": 1,
"perPage": 50
}'
The response has shape: "events" for raw-event searches and
shape: "aggregate" for stats or timechart. Both include columns,
rows, timeRange, and execution metadata. Learn the query syntax in the
ObiQL guide.
Set from to null to search all retained data. Omit from and to to use
the server's default time window.
3. Discover fields
curl -s "https://api.obistack.com/v1/query/schema?q=service%3Apayments&from=now-1h&to=now" \
-H "Authorization: Bearer $OBISTACK_TOKEN"
The response includes names, inferred types, occurrence hints, null rates, and
sample values. Optional q, from, and to values narrow field discovery to
the current search.
For service discovery, use ObiQL rather than a separate endpoint:
{
"query": "* | stats count() by service",
"from": "now-30d",
"to": "now"
}
Data Scopes and RBAC
A personal access token acts as the person who created it. Its scope only
narrows that person's access; it never replaces or widens their workspace role.
A full_access token held by a viewer is still a viewer.
The creator's current Data Scopes are added inside the shared query executor.
The token cannot remove them by changing ObiQL, adding a tenant identifier, or
calling from outside the console. If current roles grant no Data Scope, the API
returns 403 data_scope_denied instead of silently returning an empty result.
Adjacent reads
The following existing routes deliberately accept read_only and
full_access personal tokens:
GET /v1/saved-searchesandGET /v1/saved-searches/{id}GET /v1/dashboardsandGET /v1/dashboards/{id}POST /v1/dashboards/{id}/query
Private saved-search ownership and dashboard visibility still apply. Each route opts in separately. This list is not a promise that every route used by the console accepts a token.
Rate limits
POST /v1/query and GET /v1/query/schema share 300 requests per minute for
each personal access token. Exceeding the allowance returns 429 with
Retry-After set to the number of seconds before that token's window resets.
One token does not consume another token's allowance.
The counter is currently local to each API process, so deployments with several replicas enforce this allowance per replica.
Errors
| Status | What to do |
|---|---|
400 | Fix the request or ObiQL. Query errors include a message and source span. |
401 | Supply a valid, unexpired, unrevoked personal access token. |
403 insufficient_scope | Replace an ingest key, or use full_access for ` |
403 data_scope_denied | Ask an Admin to grant the creator a Data Scope. |
429 rate_limited | Wait for Retry-After, then retry. |
Activity & Security History may record token and query activity when that Enterprise feature is enabled. Its absence on lower plans never blocks a query that otherwise authenticates and passes authorization.
Tenant Isolation & Data Boundaries
The token resolves the workspace and creator server-side. No tenant, workspace, or user field in the URL, headers, body, or ObiQL can select a different tenant. Query execution applies both the tenant predicate and the creator's Data Scopes before reaching event storage. See Tenant Isolation for the platform-wide model.