Query SQL
Execute a SQL query and return results as JSON
post
/api/sqlbash
Sample request12345678910curl --request POST 'https://api.eu-west-1.aws.dash0.com/api/sql' \--header "Authorization: Bearer ${DASH0_AUTH_TOKEN}" \--header 'Content-Type: application/json' \--data-raw '{"timeRange": {"from": "now-10m","to": "now"},"query": "SELECT * FROM spans LIMIT 10"}'
Request body required
References ExecuteSqlRequest
TimeReferenceRangerequired
A range of time between two time references.
Optional dataset to query across. Defaults to whatever is configured to be the default dataset for the organization.
stringrequired
Responses
Returns the SQL query results.
References ExecuteSqlResponse
FixedTimerequired
A fixed point in time represented as an RFC 3339 date-time string.
Format: YYYY-MM-DDTHH:MM:SSZ (UTC) or YYYY-MM-DDTHH:MM:SS±HH:MM (with timezone offset)
Examples:
2024-01-15T14:30:00Z2024-01-15T14:30:00+08:00
TimeRangerequired
string
Structured error information for query errors. Present alongside the error string when the error is related to the user's query (syntax, semantic, or execution errors). Not present for system-level errors (unauthorized access, unexpected failures).
D0QLWarningsrequired