Create an alert
Create a monitoring alert for a project, including Limits alerts.
Authenticate with a personal access token.
Body
What to alert on. Use limits.all for a combined Limits alert, or a single limit such as limits.api,
limits.concurrency, limits.queue, limits.webhooks.processing,
limits.webhooks.env_rate, limits.webhooks.endpoint_rate or limits.webhooks.waiters.
One of dev, staging, prod or preview.
Preview branch. Only valid when environment is preview.
Evaluation window in seconds.
For Limits alerts, set kind to state and stateKey to the same value as capabilityKey.
limits.all only. The limits to watch. Defaults to all of them. Values are the single limit
capability keys above.
limits.all only. Raise when any selected limit is true, or only when all are.
Which limit signals to watch. approaching means usage has reached the utilisation share;
limited means the limit is already affecting traffic. limits.queue only supports
approaching.
Thresholds, for example utilisationPct (default 80, from 1 to 100).
At least one notifier, for example { "type": "channel", "channelId": "..." }.
Optional expiresAt (ISO 8601 date in the future).
A name for the alert.
Invalid components or signals return a 400 with an error message.
Group alerts
Set capabilityKey to alerts.group to group alerts. The group raises when compositeMode is any or all of its members fire. Members keep evaluating but notify only through the group.
condition:{ "kind": "state", "stateKey": "group", "compositeMode": "any" | "all", "memberAlertIds": ["alert_1234"] }.members(optional): alerts to create with the group. Each has the same body as a single alert, withoutenvironmentorbranch. The group and its members are created in one transaction, so a validation error fails the whole request.- A group holds at most 20 alerts, existing and inline combined. Members must be active, not already in a group, and in the same environment.
action: "ungroup"on the alert endpoint dissolves the group. It requires delete permission.
Examples
Watch every limit and raise when any is true:
curl -X POST "https://api.trigger.dev/api/v1/projects/proj_1234/monitoring-alerts" \
-H "Authorization: Bearer $TRIGGER_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"capabilityKey": "limits.all",
"environment": "prod",
"params": { "windowSec": 300 },
"condition": {
"kind": "state",
"stateKey": "limits.all",
"compositeMode": "any",
"signals": ["approaching", "limited"],
"params": { "utilisationPct": 80 }
},
"behavior": {},
"notifiers": [{ "type": "channel", "channelId": "channel_1234" }]
}'Watch only the API rate limit, when usage reaches 90%:
curl -X POST "https://api.trigger.dev/api/v1/projects/proj_1234/monitoring-alerts" \
-H "Authorization: Bearer $TRIGGER_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"capabilityKey": "limits.api",
"environment": "prod",
"params": { "windowSec": 300 },
"condition": {
"kind": "state",
"stateKey": "limits.api",
"signals": ["approaching"],
"params": { "utilisationPct": 90 }
},
"behavior": {},
"notifiers": [{ "type": "channel", "channelId": "channel_1234" }]
}'Was this page helpful?
Last updated
Edit on GitHub