Create a site and its first goal and funnel with scoped API requests.
-
Use an unrestricted organization key with
sites:writeto create a site.Terminal window export SUPERMETRY_URL="https://analytics.example.com"export SUPERMETRY_API_KEY="replace-with-your-key"curl --fail-with-body -X POST "$SUPERMETRY_URL/api/public/v1/sites" \-H "Authorization: Bearer $SUPERMETRY_API_KEY" \-H "Content-Type: application/json" \--data '{"name":"Example","hosts":["www.example.com"],"timezone":"UTC","retention_days":30,"revenue_currency":"USD"}' -
Copy the numeric
idfrom the response and set it for later requests.Terminal window export SITE_ID="1" -
With
goals:write, create an event goal.Terminal window curl --fail-with-body -X POST "$SUPERMETRY_URL/api/public/v1/sites/$SITE_ID/goals" \-H "Authorization: Bearer $SUPERMETRY_API_KEY" \-H "Content-Type: application/json" \--data '{"kind":"event","match":"exact","value":"Signup","name":"Signup"}' -
Create a saved funnel with at least two ordered steps.
Terminal window curl --fail-with-body -X POST "$SUPERMETRY_URL/api/public/v1/sites/$SITE_ID/funnels" \-H "Authorization: Bearer $SUPERMETRY_API_KEY" \-H "Content-Type: application/json" \--data '{"name":"Signup funnel","steps":[{"type":"page","match":"exact","value":"/pricing"},{"type":"event","match":"exact","value":"Signup"}]}'
What you should see: the requests return 201 Created with the created site, goal and saved funnel, each including an id.
Dashboard-only endpoints
Section titled “Dashboard-only endpoints”These areas are managed through the signed-in dashboard session API under /api/private, not with API keys: imports (preview, history and undo), saved dashboards, cohorts and power users, short links and tracking pixels, the revenue report, integrations such as Search Console, and the instance admin console. Writes need the role listed for each area; see the endpoint tables in the core repository’s docs/api.md. The paths for cohorts, dashboards, revenue, integrations and admin are also in internal/api/openapi.yaml.
| Area | Example path |
|---|---|
| Imports | POST /api/private/sites/{site}/imports/preview (dry run, stores nothing) |
| Dashboards | GET /api/private/sites/{site}/dashboards |
| Cohorts | POST /api/private/sites/{site}/cohorts/evaluate |
| Revenue | GET /api/private/sites/{site}/revenue/report |
| Integrations | GET /api/private/sites/{site}/integrations |
| Admin | GET /api/private/admin/users |