v1

latestOpenAPI 3.1.0Apache 2.0raw.githubusercontent.com2026-05-044743166.6 KB
query

Execute a TRQL query

Execute a TRQL (Trigger.dev Query Language) query against your run data. TRQL is a SQL-style query language that allows you to analyze runs, calculate metrics, and export data.

post/api/v1/query

Request body

querystring required

The TRQL query to execute

scope'environment' | 'project' | 'organization'

The scope of data to query - environment (default), project, or organization

periodstring nullable

Time period shorthand (e.g., "7d", "30d", "1h"). Cannot be used with from/to.

fromstring date-time nullable

Start of time range as ISO 8601 timestamp. Must be used with 'to'.

tostring date-time nullable

End of time range as ISO 8601 timestamp. Must be used with 'from'.

format'json' | 'csv'

Response format - "json" returns structured data (default), "csv" returns CSV string

Example request

{
  "query": "SELECT run_id, status, triggered_at FROM runs WHERE status = 'Failed' LIMIT 10",
  "period": "7d",
  "from": "2024-01-01T00:00:00Z",
  "to": "2024-01-31T23:59:59Z"
}

Response

Query executed successfully

OR