Skip to main content

Alerts

Edit an alert

Change a rule, or switch it off.

PATCH/sites/{siteId}/alerts/{alertId}
Edit an alert
curl --request PATCH \
  --url 'https://truestat.io/api/v1/sites/{siteId}/alerts/{alertId}' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "body": "<string>",
  "name": "<string>",
  "enabled": false,
  "subject": "<string>",
  "goal_name": "<string>",
  "threshold": 0,
  "trigger_type": "goal",
  "threshold_mode": "absolute"
}'
{
  "data": {
    "id": "ed054a7c-696a-4db4-809e-531a169da959",
    "body": null,
    "name": "Traffic dropped by half",
    "enabled": false,
    "subject": null,
    "goal_name": null,
    "threshold": 50,
    "created_at": "2026-09-16T18:05:00.000Z",
    "created_by": "734c7de3-58f1-46e6-83d1-2be85466ee70",
    "updated_at": "2026-09-16T18:40:00.000Z",
    "trigger_type": "traffic_drop",
    "last_fired_at": null,
    "threshold_mode": "percent_change"
  },
  "meta": {
    "site_id": "6fed8980-a119-4a9c-a4d4-53e448ef9f9e"
  }
}

See Alerts for the two trigger shapes, what threshold_mode means, and why an alert belongs to the site rather than to whoever created it.

Authorizations

Authorizationstringheaderrequired

An API key from Settings → API keys. Scopes available: analytics:read, sites:read, sites:write, settings:read, settings:write, goals:read, goals:write, funnels:read, funnels:write, notes:read, notes:write, alerts:read, alerts:write, team:read, team:write, revenue:read, revenue:write.

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path parameters

siteIdstring (uuid)pathrequired
The site's id, from `GET /sites`. A site that is not yours and a site that does not exist both answer 403, so this cannot be used to discover other people's ids.
alertIdstring (uuid)pathrequired
The alert's id.

Request bodyapplication/json

bodystringbody
namestringbody
enabledbooleanbody
subjectstringbody
goal_namestringbody
thresholdintegerbody
trigger_typeenum<string>body
options:goaltraffic_spiketraffic_drop
threshold_modeenum<string>body
options:absolutepercent_change

Response

application/json

The answer.

dataobject
metaobject