Skip to navigation

Run an explorer query

Runs an INLINE query, or a SAVED one as stored or with an adjusted text, and returns one page (page and limit in the URL). FROM picks the source: events need METER_DATA.VIEW, invoices INVOICE.VIEW (403 PERMISSION_REQUIRED). An invalid query answers 400 with reason INVALID_SYNTAX, UNKNOWN_REFERENCE or LIMIT_EXCEEDED and its position; one that reads too much 422 QUERY_TOO_EXPENSIVE; 429 RATE_LIMITED and 504 TIMEOUT mean try again shortly. Requires the METER_DATA.VIEW or INVOICE.VIEW permission.

Authentication

X-API-KEYstring
API Key authentication via header
OR
AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Path parameters

versionstringRequiredDefaults to 1
version

Headers

x-platform-idstringOptional
Platform ID.

Query parameters

limitintegerOptional

Rows per page, 1 to 100 (default 25). A LIMIT in the query takes precedence.

pageintegerOptional

The page to return, from 1 (default 1). page × limit is at most 10000.

Request

This endpoint expects an object.
typeenum or nullOptional

INLINE runs inline.query; SAVED runs the saved query saved.saved_query_id, or saved.query in its place. Required.

Allowed values:
inlineobjectOptional

For type INLINE only: the query to run.

savedobjectOptional

For type SAVED only: the saved query to run, and optionally an adjusted text that runs instead of its stored one.

orderobjectOptional

Orders the result by one of its columns, replacing the query’s ORDER BY. Part of what runs: see executed_query.

autocorrectboolean or nullOptional

When true and the text sent is invalid, unambiguous technical errors (a missing GROUP BY, a keyword typo, an unquoted value, ==, a trailing comma, …) are corrected: see executed_query and corrections. Only for text sent along; a stored query is never corrected. Default false.

Response

OK
typeenum or nullOptionalRead-only
As in the request.
Allowed values:
inlineobject or nullOptional

The text as sent (INLINE only).

savedobject or nullOptional

The saved query (SAVED only): its name, its stored text, and whether what ran differs from it.

executed_querystring or nullOptionalRead-only

The text that ran: with autocorrect’s corrections and the order applied. Update and Save as new send this text.

correctionslist of objects or nullOptionalRead-only

What autocorrect changed, at its position in the text as sent; absent when nothing was corrected.

columnslist of objects or nullOptionalRead-only

The result columns, in order; every row has one cell per column.

rowslist of lists of objects or nullOptionalRead-only

The rows: per column a cell holding its value in the field the column’s type names (string, number, amount, …).

pageinteger or nullOptionalRead-only
The page returned.
limitinteger or nullOptionalRead-only
Rows per page.
has_moreboolean or nullOptionalRead-only

Whether there is a next page: post the same body with page + 1.

statsobject or nullOptional
How much the query read.

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
422
Unprocessable Entity Error
429
Too Many Requests Error
500
Internal Server Error
504
Gateway Timeout Error