Documentation · API reference
POST
/api/v1/sites/{site}/goalsAdd a goal
This page as Markdown, or in an AI chatMore ways to read this page
Add a goal: what counts as reaching it.
# Add a goal
> tidekeeper's API reference: https://tidekeeper.eu/docs/api/post-sites-site-goals
`POST /api/v1/sites/{site}/goals`
Add a goal: what counts as reaching it.
## Parameters
- `site` (in path, needed): A site's id or name
## What to send
`GoalCreate`
- `name` (string, needed)
- `spec` (object, needed)
## The answer
201, `GoalView`
- `created_at` (string, needed)
- `id` (string, needed)
- `name` (string, needed)
- `paused` (boolean, needed)
- `site_id` (string, needed)
- `spec` (object, needed)
- `summary` (string, needed): `event install-copy`, `page /thanks*`.
- `version` (integer, needed): The version in force. Each conversion records the one it was counted under (EV-06).
## Asking
```sh
curl -X POST https://tidekeeper.eu/api/v1/sites/example.org/goals \
-H "Authorization: Bearer $TIDEKEEPER_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "…", "spec": {}}'
```
Parameters
- sitein the address
- neededA site's id or name
What to send
GoalCreate
- name
- stringneeded
- spec
- objectneeded
The answer
Status 201
GoalView
- created_at
- stringneeded
- id
- stringneeded
- name
- stringneeded
- paused
- booleanneeded
- site_id
- stringneeded
- spec
- objectneeded
- summary
- stringneeded`event install-copy`, `page /thanks*`.
- version
- integerneededThe version in force. Each conversion records the one it was counted under (EV-06).
Asking
curl -X POST https://tidekeeper.eu/api/v1/sites/example.org/goals \ -H "Authorization: Bearer $TIDEKEEPER_TOKEN" \ -H "Content-Type: application/json" \ -d '{"name": "…", "spec": {}}'
const answer = await fetch("https://tidekeeper.eu/api/v1/sites/example.org/goals", { method: "POST", headers: { Authorization: `Bearer ${process.env.TIDEKEEPER_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({"name": "…", "spec": {}}), }).then((r) => r.json());