Goals
Create a goal rule
Define a conversion from a URL — counted retroactively.
Create a goal rule
curl --request POST \
--url 'https://truestat.io/api/v1/sites/{siteId}/goal-rules' \
--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:06:28.945Z",
"match_value": "/thank-you"
},
"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
AuthorizationstringheaderrequiredAn 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)pathrequiredThe 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.
Request bodyapplication/json
namestringbodyrequiredThe goal name this produces. Lowercase letters, numbers and _ - : only.
match_typeenum<string>bodyrequiredHow `match_value` is compared. There is no wildcard — `starts_with` and `contains` do the same job, and a mistyped pattern silently produces an empty goal.
options:
equalsstarts_withcontainsmatch_valuestringbodyrequiredThe path to match. A full URL is converted to its path.
Response
The answer.
dataobjectmetaobjecterrorobjecterrorobjecterrorobjecterrorobject