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.
Use your project-specific Secret API key. Will start with tr_dev_, tr_prod, tr_stg, etc.
You can find your Secret API key in the API Keys section of your Trigger.dev project dashboard.
Our TypeScript SDK will default to using the value of the TRIGGER_SECRET_KEY environment variable if it is set. If you are using the SDK in a different environment, you can set the key using the configure function.
import { configure } from "@trigger.dev/sdk";
configure({ accessToken: "tr_dev_1234" });
The TRQL query to execute
"SELECT run_id, status, triggered_at FROM runs WHERE status = 'Failed' LIMIT 10"
The scope of data to query - environment (default), project, or organization
environment, project, organization Time period shorthand (e.g., "7d", "30d", "1h"). Cannot be used with from/to.
"7d"
Start of time range as ISO 8601 timestamp. Must be used with 'to'.
"2024-01-01T00:00:00Z"
End of time range as ISO 8601 timestamp. Must be used with 'from'.
"2024-01-31T23:59:59Z"
Response format - "json" returns structured data (default), "csv" returns CSV string
json, csv