Skip to content

Management API

Create sites, goals and funnels through the versioned public API.

Create a site and its first goal and funnel with scoped API requests.

  1. Use an unrestricted organization key with sites:write to 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"}'
  2. Copy the numeric id from the response and set it for later requests.

    Terminal window
    export SITE_ID="1"
  3. 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"}'
  4. 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.

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