Skip to Content

Create an alert

Create a monitoring alert for a project, including Limits alerts.

Private beta. This feature is only available to some organizations right now.

Authenticate with a personal access token.

Body

capabilityKeystringrequired

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.

environmentstringrequired

One of dev, staging, prod or preview.

branchstring

Preview branch. Only valid when environment is preview.

paramsobjectrequired
windowSecnumber

Evaluation window in seconds.

conditionobjectrequired

For Limits alerts, set kind to state and stateKey to the same value as capabilityKey.

componentsstring[]

limits.all only. The limits to watch. Defaults to all of them. Values are the single limit capability keys above.

compositeMode"any" | "all"

limits.all only. Raise when any selected limit is true, or only when all are.

signals("approaching" | "limited")[]

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.

paramsobject

Thresholds, for example utilisationPct (default 80, from 1 to 100).

notifiersobject[]required

At least one notifier, for example { "type": "channel", "channelId": "..." }.

behaviorobjectrequired

Optional expiresAt (ISO 8601 date in the future).

namestring

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, without environment or branch. 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

On this page