Skip to main content

Goals

Edit a goal rule

Change a rule — and with it, every past figure it produced.

PATCH/sites/{siteId}/goal-rules/{ruleId}
Edit a goal rule
curl --request PATCH \
  --url 'https://truestat.io/api/v1/sites/{siteId}/goal-rules/{ruleId}' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "<string>",
  "match_type": "equals",
  "match_value": "<string>"
}'
{
  "data": {
    "id": "13a3218b-9f23-4990-89d1-5c98ef078cd6",
    "name": "signup",
    "created_at": "2026-09-16T19:06:28.945Z",
    "match_type": "equals",
    "updated_at": "2026-09-16T19:40:11.000Z",
    "match_value": "/thanks"
  },
  "meta": {
    "site_id": "6fed8980-a119-4a9c-a4d4-53e448ef9f9e"
  }
}

See Goal rules for why a rule counts the past, what editing one does to old figures, and when to send an event instead.

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.
ruleIdstring (uuid)pathrequired
The rule's id.

Request bodyapplication/json

namestringbody
match_typeenum<string>body
options:equalsstarts_withcontains
match_valuestringbody

Response

application/json

The answer.

dataobject
metaobject