Docsllms.txtSign inGo to your sites

Updated

View as Markdown

API reference

Read analytics, push the tracking plan (analytics.yaml), and send server-side events.

Try it Send any request from this reference with your key. The page sends the key only to this API and never stores it.

Loading the playground…

Authentication

Send a key in the Authorization header:

Shell
curl -sS https://twelvebit.app/api/v1/overview -H "Authorization: Bearer $TWELVEBIT_API_KEY"
CredentialPrefixScope
Site keytbk_One site. The site parameter is ignored. Create it in the site settings, or let twelvebit init create it.
Account tokentbt_Every site you can open. Pass ?site=<id, public id or domain> (or site_id in the payments body). Create it on your account page.
Sessioncookie or Bearer session tokenThe dashboard session, and the token that twelvebit init gets through the device login. Works like an account token.

Keys are secrets. Use them on servers and in terminals only, never in browser code.

Scopes

Each key has scopes. You choose them when you create the key: in the site settings (API & MCP), on your account page, with POST /api/v1/keys, or with npx -y twelvebit@latest init --scopes read,write:config. Each endpoint below names the scope that it needs.

ScopeAllows
readRead analytics, revenue, ad spend and campaign performance, people, funnels, goals, alerts, notes and the tracking plan.
write:eventsSend goals, identify calls, payments and crawler hits from a server.
write:configChange funnels, alerts, notes, the tracking plan, exclusions and basic site settings.
adminManage the team and API keys, share the dashboard in public, and create or delete sites.
  • admin includes the other three scopes.
  • Keys made before scopes existed have read, write:events and write:config. New keys get the same set when you do not choose.
  • A dashboard session (and the device login of the CLI) has every scope. MCP connectors that sign in with OAuth get what the person chose on the consent page: read (Read only), or read and write:config (Read and change setup). They never get admin.
  • The role on the site still applies. Viewers can only read. Owners and members can change the setup and manage keys. Only the owner can manage the team and delete the site.
  • A key cannot create a key with more scopes than it has.

A call without the scope gets 403:

JSON
{
  "error": { "code": "insufficient_scope", "message": "This site key has the scopes read, but this call needs "write:config" (…).", "required_scope": "write:config", "key_scopes": ["read"] },
  "hint": "This key does not have the scope that the call needs (…).",
  "docs": "https://twelvebit.app/docs/api.md#scopes"
}

Try it

The API reference page has a playground under the title (open "Try it"): choose an operation, fill in the parameters, paste a key and send the request. The page keeps the key in memory only (never in storage, never in the URL), sends it only to this API, and shows the answer and the same call as curl. Use a key with the read scope to explore safely.

Idempotency

Create calls (POST to funnels, alerts, annotations, team, keys, key rolls and sites) take an Idempotency-Key header with 8 to 128 characters. A UUID works. When the same key and the same body come again within 24 hours, the API returns the first answer with the header Idempotent-Replayed: true and creates nothing. The same key with a different body gets 409 idempotency_key_reused. A replay of POST /keys does not show the secret again.

Responses

Success: { "data": …, "meta": { … } }. meta names the site and, for analytics, the time range (range.label, range.from, range.to, range.tz) and the attribution model (last touch: the visit before the payment).

  • meta.warnings: present when a filter value cannot match (code unknown_value for an unknown country, device or channel, no_match when no visit in the range has it). The answer is still computed, so a 0 next to a warning means the filter is probably wrong. See Filters and segments.
  • change_note: the overview and revenue answers compare with the period of the same length right before. When that period holds too little data (it starts before the site's first data, or it has fewer than 20 visitors or under 5% of the current visitors), every change is null and change_note says why ("Not enough data before this range: …"). The dashboard KPI tiles then show "new" or "–" with the same note.
  • revenue_model: breakdowns say how revenue is counted. Most dimensions are last touch and add up to the attributed revenue; page credits the last page viewed before the payment; goal rows are the revenue of the people who completed the goal and overlap. See Revenue in reports.

Error: { "error": { "code": "site_required", "message": "…" }, "hint": "…", "docs": "…" } with a matching HTTP status (400, 401, 403, 404, 409, 422, 429, 500). The hint says what to do next.

Deleting a site

DELETE /api/v1/sites/{siteId} removes the site and all its data for good. Only the owner can do it, with the admin scope, and the body must name the domain: {"confirm": "example.com"}. Without it the API answers 400 confirm_required and deletes nothing.

Billing

Billing belongs to the account that owns the sites. Starter and Growth plans, monthly or yearly, are paid on the Dodo Payments page; every account starts with a 14-day free trial with no card (up to 500k events), and a checkout charges the plan at once (card on the checkout page). After the trial, the dashboard asks for a plan; the billing page suggests the plan that fits the trial's traffic. Plans count events per monthly cycle from the trial or plan start, not per calendar month. A local or self-hosted server without Dodo Payments keys has no billing, and these calls say so (billing_live: false, 409 billing_off).

  • GET /api/v1/billing (read): the plan, status (trialing, active, past_due, canceled, expired, exempt), the trial end, price_usd (lower when the account has a discount) and price_usd_full, usage (events since the start of the monthly cycle, sites, people), limits, dashboard_locked with lock_reason, and meta.catalog (plans, event tiers and prices). With a site key or ?site=, the account of that site's owner; a member or viewer gets only dashboard_locked and the owner's name.
  • POST /api/v1/billing/checkout (admin, owner only): body {"plan": "starter"|"growth", "tier": "10k"…"10m", "interval": "month"|"year"}. Returns checkout_url for the person to open: they pay on Dodo's page (the checkout charges at once; trial_days is 0), and no card data passes through the API or a chat. With an active plan it changes the plan (kind: "plan_change"), Dodo bills the difference (nothing during the free trial, which keeps its end date). An account with a discount keeps it on a change to another plan at 10k, 100k or 200k; a larger tier ends it. Takes Idempotency-Key.

Tracking, public dashboards and API reads never stop, whatever the plan state. Over a limit, adding a site or a person answers 402 plan_limit with the reason.

Rate limit

120 requests per minute per key. Above that the API answers 429 with a Retry-After header in seconds. Wait that long, then try again.

Common query parameters

ParameterValuesNotes
periodtoday, yesterday, 24h, 7d, 30d, 90d, 12m, wtd, mtd, ytd, all, customDefault 30d. Days are in the site's time zone.
from, toYYYY-MM-DDBoth together make a custom range. to is included.
f_<key>one or more valuesFilter "is", for example f_country=DE, f_channel=Organic Search, f_page=/pricing, f_goal=signup. Comma-separated values mean any of them: f_country=PT,ES. Keys: channel, referrer, campaign, keyword, source, hostname, entry, exit, country, region, city, browser, os, device, page, goal, visitor (new or returning).
fx_<key>, fc_<key>, fxc_<key>one or more values"is not", "contains" and "does not contain", for example fx_channel=Direct, fc_page=/blog. Different filters combine with AND. See Filters and segments.
siteid, public id or domainNeeded for account tokens and sessions when you have more than one site.

Revenue in breakdowns is attributed with the model last touch: the visit before the payment (see revenue_model in each answer).

Time series default to hourly for ranges of up to seven calendar days. Longer ranges use daily, weekly or monthly buckets. Daily-only imported history uses daily buckets and returns an interval_note explaining the fallback. Hourly bucket keys include the site's UTC offset (for example 2026-11-01T01:00-04:00 and 2026-11-01T01:00-05:00 are two separate hours). Day, week and month keys keep the YYYY-MM-DDTHH:MM format. A period's unique visitors are calculated independently; adding hourly unique counts can count the same person more than once.

Funnel steps (GET /api/v1/funnels?steps=…, POST /api/v1/funnels): page:/path, page:*text* (contains), page:/prefix* (starts with), goal:name, or not:goal_name for a "did not complete" step (as an object: { "kind": "goal", "value": "signup", "not": true }). A "did not complete" step is never the first step. Each step in the answer has did_not, revenue and revenue_stopped_here. See Funnel steps.

Endpoints

MethodPathSummary
GET/api/v1/sitesList sites
POST/api/v1/sitesAdd a site
GET/api/v1/sites/{siteId}Get a site
PATCH/api/v1/sites/{siteId}Change site settings
DELETE/api/v1/sites/{siteId}Delete a site
GET/api/v1/overviewKPIs for a range
GET/api/v1/timeseriesVisitors and revenue over time
GET/api/v1/breakdownTop values of one dimension
GET/api/v1/realtimeWho is on the site now
GET/api/v1/goalsGoals and their completions
GET/api/v1/funnelsList or compute funnels
POST/api/v1/funnelsSave a funnel
GET/api/v1/peopleList visitors
GET/api/v1/people/{visitorId}One visitor's journey
GET/api/v1/tracking-planGet the tracking plan
PUT/api/v1/tracking-planReplace the tracking plan
GET/api/v1/install-checkInstall check and drift
GET/api/v1/annotationsList annotations
POST/api/v1/annotationsAdd an annotation
GET/api/v1/segmentsList saved segments
POST/api/v1/segmentsSave a segment
DELETE/api/v1/segmentsDelete a segment
POST/api/v1/eventsSend a goal from your server
POST/api/v1/identifyIdentify a visitor from your server
GET/api/v1/paymentsList payments
POST/api/v1/paymentsRecord a payment
GET/api/v1/botsCrawler traffic
POST/api/v1/botsRecord a crawler hit
POST/api/v1/cli/bootstrapFind or create a site and mint a key (CLI)
POST/api/v1/extension/deviceStart the browser extension's sign-in
POST/api/v1/extension/tokenFinish the browser extension's sign-in
DELETE/api/v1/extension/tokenSign the browser extension out
GET/api/v1/salesPaid sales by customer type and order source
GET/api/v1/sales/segmentsSaved paid sales segments
POST/api/v1/sales/segmentsSave a paid sales segment
DELETE/api/v1/sales/segmentsDelete a paid sales segment
GET/api/v1/sites/{siteId}/exclusionsGet the exclusion lists
POST/api/v1/sites/{siteId}/exclusionsAdd and remove exclusions
GET/api/v1/funnels/{funnelId}Get a saved funnel
PATCH/api/v1/funnels/{funnelId}Change a saved funnel
DELETE/api/v1/funnels/{funnelId}Delete a saved funnel
GET/api/v1/alertsList alerts
POST/api/v1/alertsCreate an alert
GET/api/v1/alerts/{alertId}Get an alert
PATCH/api/v1/alerts/{alertId}Change an alert
DELETE/api/v1/alerts/{alertId}Delete an alert
GET/api/v1/annotations/{annotationId}Get an annotation
PATCH/api/v1/annotations/{annotationId}Change an annotation
DELETE/api/v1/annotations/{annotationId}Delete an annotation
GET/api/v1/teamList the team
POST/api/v1/teamInvite a person
PATCH/api/v1/team/{email}Change a member's role
DELETE/api/v1/team/{email}Remove a member
GET/api/v1/keysList site keys
POST/api/v1/keysCreate a site key
DELETE/api/v1/keys/{keyId}Revoke a site key
GET/api/v1/goals/{name}Get a goal's display settings
PATCH/api/v1/goals/{name}Customise a goal
POST/api/v1/keys/{keyId}/rollRoll a site key
GET/api/v1/alerts/deliveriesAlert delivery history
GET/api/v1/integrationsIntegration status
GET/api/v1/integrations/{provider}One integration's status
DELETE/api/v1/integrations/{provider}Disconnect an integration
GET/api/v1/billingThe account's plan, usage and limits
POST/api/v1/billing/checkoutMake a checkout link (or change the plan)
GET/api/v1/usageUsage this month
GET/api/v1/openapi.jsonThis document
GET/api/v1/openapi.yamlThis document as YAML

GET /api/v1/sites

List sites.

Every site the key can read. A site key returns only its own site.

Scope: read.

Shell
curl -sS "https://twelvebit.app/api/v1/sites" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 401 Missing or invalid key · 429 Rate limited (see Retry-After).

POST /api/v1/sites

Add a site.

Account tokens and sessions only (not site keys). If you already own a site with the domain, it comes back with 200 and meta.created false. Safe to retry with Idempotency-Key.

Scope: admin.

ParameterInTypeRequiredDescription
Idempotency-KeyheaderstringnoMakes a create safe to retry for 24 hours: a repeat with the same key and body returns the first answer (header Idempotent-Replayed: true) and creates nothing. The same key with another body is a 409.

Request body:

JSON
{
  "domain": "example.com",
  "timezone": "Europe/Berlin",
  "currency": "EUR"
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/sites" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"domain":"example.com","timezone":"Europe/Berlin","currency":"EUR"}'

Responses: 200 You already own a site with this domain · 201 Created · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 409 Error · 429 Rate limited (see Retry-After).

GET /api/v1/sites/{siteId}

Get a site.

One site by id, public id or domain, with its script tag.

Scope: read.

ParameterInTypeRequiredDescription
siteIdpathstringyesSite id, public id (tb_…) or domain.
Shell
curl -sS "https://twelvebit.app/api/v1/sites/tb_YOUR_SITE_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

PATCH /api/v1/sites/{siteId}

Change site settings.

Send only the fields to change. is_public, public_slug and public_visibility control the public dashboard at /share/<slug> and need the admin scope; the other fields need write:config. Owners and members only.

Scope: write:config.

ParameterInTypeRequiredDescription
siteIdpathstringyesSite id, public id (tb_…) or domain.

Request body:

JSON
{
  "timezone": "Europe/Berlin",
  "currency": "EUR",
  "kpi": "goal:signup"
}
Shell
curl -sS -X PATCH "https://twelvebit.app/api/v1/sites/tb_YOUR_SITE_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"timezone":"Europe/Berlin","currency":"EUR","kpi":"goal:signup"}'

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

DELETE /api/v1/sites/{siteId}

Delete a site.

Owner only. Deletes the site and all its data for good. The body must be {"confirm": "<the site's domain>"}; anything else is a 400 confirm_required.

Scope: admin.

ParameterInTypeRequiredDescription
siteIdpathstringyesSite id, public id (tb_…) or domain.

Request body:

JSON
{
  "confirm": "example.com"
}
Shell
curl -sS -X DELETE "https://twelvebit.app/api/v1/sites/tb_YOUR_SITE_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"confirm":"example.com"}'

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

GET /api/v1/overview

KPIs for a range.

Visitors, visits, page views, bounce rate, time on site, revenue, customers and conversion, for the range and the previous range of the same length, plus the number of people online now (people who match the filters). When the previous range holds too little data (it starts before the site's first data, or it has fewer than 20 visitors or under 5% of the current visitors), every change is null and change_note says why.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
periodquerytoday | yesterday | 24h | 7d | 30d | 90d | 6m | 12m | wtd | mtd | ytd | all | customno
fromquerystringnoFirst day (YYYY-MM-DD, site time zone). Use with to.
toquerystringnoLast day, inclusive.
f_<key>, fx_<key>, fc_<key>, fxc_<key>querystringnoFilter: is, is not, contains, does not contain. Comma-separated values mean any of them. Keys: channel, referrer, campaign, keyword, source, hostname, entry, exit, country, region, city, browser, os, device, page, goal, visitor, ad, assistant. See Filters and segments.
Shell
curl -sS "https://twelvebit.app/api/v1/overview?period=7d" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/timeseries

Visitors and revenue over time.

One point per hour, day, week or month in the site's time zone. Ranges up to seven days default to hourly. Daily-only imported history falls back to daily with an interval_note. Hourly keys include UTC offsets to distinguish repeated daylight-saving hours.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
periodquerytoday | yesterday | 24h | 7d | 30d | 90d | 6m | 12m | wtd | mtd | ytd | all | customno
fromquerystringnoFirst day (YYYY-MM-DD, site time zone). Use with to.
toquerystringnoLast day, inclusive.
gqueryhour | day | week | monthnoBucket size. Default depends on the range length.
f_<key>, fx_<key>, fc_<key>, fxc_<key>querystringnoFilter: is, is not, contains, does not contain. Comma-separated values mean any of them. Keys: channel, referrer, campaign, keyword, source, hostname, entry, exit, country, region, city, browser, os, device, page, goal, visitor, ad, assistant. See Filters and segments.
Shell
curl -sS "https://twelvebit.app/api/v1/timeseries?period=7d" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/breakdown

Top values of one dimension.

Visitors and attributed revenue (last touch: the visit before the payment) per value, sorted by visitors descending by default. dim=goal adds completions; dim=referrer adds the channel; dim=region and dim=city add the country. dim=page adds scroll: median maximum depth (percent), measured/tracked page-view counts, coverage and 25/50/75/100% reach fractions. Missing depth is null, never zero; imported history is excluded from scroll measurements. Scroll measures content exposure, not reading.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
periodquerytoday | yesterday | 24h | 7d | 30d | 90d | 6m | 12m | wtd | mtd | ytd | all | customno
fromquerystringnoFirst day (YYYY-MM-DD, site time zone). Use with to.
toquerystringnoLast day, inclusive.
dimquerychannel | referrer | campaign | keyword | source | hostname | entry | exit | country | region | city | browser | os | device | page | goal | outboundno
limitqueryintegerno
sortqueryname | visitors | revenue | scroll_depthnoscroll_depth requires dim=page and sorts page medians before limiting. Unknown depths stay last in both directions.
sort_dirqueryasc | descno
f_<key>, fx_<key>, fc_<key>, fxc_<key>querystringnoFilter: is, is not, contains, does not contain. Comma-separated values mean any of them. Keys: channel, referrer, campaign, keyword, source, hostname, entry, exit, country, region, city, browser, os, device, page, goal, visitor, ad, assistant. See Filters and segments.
Shell
curl -sS "https://twelvebit.app/api/v1/breakdown?period=7d" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/realtime

Who is on the site now.

People active in the last 5 minutes (with page, source, place and goals), visitors per minute for the last 30 minutes (oldest first), and the last 30 minutes of events and payments.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/realtime" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/goals

Goals and their completions.

Visitors, completions and revenue of those visitors per goal. declared says whether the goal is in the tracking plan; undeclared and not_seen show drift.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
periodquerytoday | yesterday | 24h | 7d | 30d | 90d | 6m | 12m | wtd | mtd | ytd | all | customno
fromquerystringnoFirst day (YYYY-MM-DD, site time zone). Use with to.
toquerystringnoLast day, inclusive.
f_<key>, fx_<key>, fc_<key>, fxc_<key>querystringnoFilter: is, is not, contains, does not contain. Comma-separated values mean any of them. Keys: channel, referrer, campaign, keyword, source, hostname, entry, exit, country, region, city, browser, os, device, page, goal, visitor, ad, assistant. See Filters and segments.
Shell
curl -sS "https://twelvebit.app/api/v1/goals?period=7d" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/funnels

List or compute funnels.

With steps, computes that funnel: each step counts visitors who reached it after the step before. Without steps, lists every funnel saved in the dashboard (with its id) and every funnel in the tracking plan (id null), each with its result (name picks one).

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
periodquerytoday | yesterday | 24h | 7d | 30d | 90d | 6m | 12m | wtd | mtd | ytd | all | customno
fromquerystringnoFirst day (YYYY-MM-DD, site time zone). Use with to.
toquerystringnoLast day, inclusive.
stepsquerystringno2 to 8 comma-separated steps: page:/path (use * as a wildcard), goal:name (a bare name is a goal) or not:goal_name (did not complete: people who did not do the goal before the next step; never the first step).
namequerystringnoName of a saved or planned funnel.
f_<key>, fx_<key>, fc_<key>, fxc_<key>querystringnoFilter: is, is not, contains, does not contain. Comma-separated values mean any of them. Keys: channel, referrer, campaign, keyword, source, hostname, entry, exit, country, region, city, browser, os, device, page, goal, visitor, ad, assistant. See Filters and segments.
Shell
curl -sS "https://twelvebit.app/api/v1/funnels?period=7d" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/funnels

Save a funnel.

Saves a funnel in the dashboard. Names are unique per site (409 funnel_exists). At most 50 per site. Safe to retry with Idempotency-Key.

Scope: write:config.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Idempotency-KeyheaderstringnoMakes a create safe to retry for 24 hours: a repeat with the same key and body returns the first answer (header Idempotent-Replayed: true) and creates nothing. The same key with another body is a 409.

Request body:

JSON
{
  "name": "Blog to purchase",
  "steps": [
    {
      "kind": "page",
      "value": "blog",
      "match": "contains"
    },
    "page:/pricing*",
    "goal:signup",
    "goal:purchase"
  ]
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/funnels" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Blog to purchase","steps":[{"kind":"page","value":"blog","match":"contains"},"page:/pricing*","goal:signup","goal:purchase"]}'

Responses: 201 Created · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

GET /api/v1/people

List visitors.

Visitors seen in the range, newest first or by revenue. Anonymous visitors get a stable friendly name like amber-fox-4821. With f_* filters, a person counts when one of their visits in the range matches every filter (the same rule as the dashboard).

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
periodquerytoday | yesterday | 24h | 7d | 30d | 90d | 6m | 12m | wtd | mtd | ytd | all | customno
fromquerystringnoFirst day (YYYY-MM-DD, site time zone). Use with to.
toquerystringnoLast day, inclusive.
filterqueryall | customers | identifiedno
qquerystringnoSearch email or name (contains), or an exact visitor id or user id.
sortqueryrecent | person | location | source | visits | first_seen | last_seen | revenue | total_time | email | user_id | device | browser | osno
sort_dirqueryasc | descnoDefaults to highest/newest first for numbers/dates, A to Z for text.
cursorquerystringnoUse meta.next_cursor for the next page, retaining the range, filters and sort. Avoids deep offsets.
limitqueryintegerno
offsetqueryintegerno
f_<key>, fx_<key>, fc_<key>, fxc_<key>querystringnoFilter: is, is not, contains, does not contain. Comma-separated values mean any of them. Keys: channel, referrer, campaign, keyword, source, hostname, entry, exit, country, region, city, browser, os, device, page, goal, visitor, ad, assistant. See Filters and segments.
Shell
curl -sS "https://twelvebit.app/api/v1/people?period=7d" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/people/{visitorId}

One visitor's journey.

Profile, attribution (first touch and the credited visit: last touch: the visit before the payment), every visit with its events, and payments. Each pageview event includes scroll_depth_percent (0–100, null when unavailable), specific to that view. Scroll measures content exposure, not reading.

Scope: read.

ParameterInTypeRequiredDescription
visitorIdpathstringyesVisitor id (_tb_vid) or the user_id from identify.
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/people/VISITOR_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/tracking-plan

Get the tracking plan.

The stored plan as JSON and YAML. Send Accept: text/yaml (or ?format=yaml) to get only the YAML text. The YAML is rebuilt from the stored plan, so comments are not kept.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
formatqueryjson | yamlno
Shell
curl -sS "https://twelvebit.app/api/v1/tracking-plan" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

PUT /api/v1/tracking-plan

Replace the tracking plan.

Send analytics.yaml as the body (Content-Type: text/yaml), or the same plan as JSON. The schema is strict: unknown keys are errors. The response lists added, removed and changed events. ?dry_run=1 validates without saving.

Scope: write:config.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
dry_runquerybooleanno

Request body:

YAML
version: 1
project: example.com
events:
  signup:
    description: A visitor creates an account
    props:
      plan: { type: string, enum: [free, pro] }
Shell
curl -sS -X PUT "https://twelvebit.app/api/v1/tracking-plan" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: text/yaml" --data-binary @analytics.yaml

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 422 Invalid tracking plan · 429 Rate limited (see Retry-After).

GET /api/v1/install-check

Install check and drift.

What the site has sent: first and last event, the last 10 events, counts by type in the last 24 hours, host names seen, and for each event in the tracking plan whether it has been seen in the last 30 days. undeclared lists goals that were sent but are not in the plan. next_steps says what to fix.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/install-check" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/annotations

List annotations.

Notes shown on the time charts in the range.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
periodquerytoday | yesterday | 24h | 7d | 30d | 90d | 6m | 12m | wtd | mtd | ytd | all | customno
fromquerystringnoFirst day (YYYY-MM-DD, site time zone). Use with to.
toquerystringnoLast day, inclusive.
Shell
curl -sS "https://twelvebit.app/api/v1/annotations?period=7d" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/annotations

Add an annotation.

Mark a launch, a deploy or a price change on the charts. ts defaults to now.

Scope: write:config.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.

Request body:

JSON
{
  "label": "Launched on Product Hunt",
  "ts": "2026-10-01T09:00:00Z",
  "url": "https://www.producthunt.com/posts/example"
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/annotations" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"label":"Launched on Product Hunt","ts":"2026-10-01T09:00:00Z","url":"https://www.producthunt.com/posts/example"}'

Responses: 201 Created · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/segments

List saved segments.

Named sets of filters saved in the dashboard or through the API. query is the same filters as URL parameters: append it to any analytics endpoint.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/segments" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/segments

Save a segment.

Save filters under a name. A segment with the same name (case-insensitive) is replaced (200); a new one is 201. A filter value is a string (is), a list (is any of) or an object with is, is_not, contains or not_contains. Members and owners only; at most 50 per site.

Scope: write:config.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.

Request body:

JSON
{
  "name": "Paid traffic outside the US",
  "filters": {
    "channel": [
      "Paid Search",
      "Paid Social"
    ],
    "country": {
      "is_not": "US"
    },
    "page": {
      "contains": "/pricing"
    }
  }
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/segments" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Paid traffic outside the US","filters":{"channel":["Paid Search","Paid Social"],"country":{"is_not":"US"},"page":{"contains":"/pricing"}}}'

Responses: 200 Replaced · 201 Created · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

DELETE /api/v1/segments

Delete a segment.

Pass the segment id or its name. Members and owners only.

Scope: write:config.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
idquerystringno
namequerystringno
Shell
curl -sS -X DELETE "https://twelvebit.app/api/v1/segments" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/events

Send a goal from your server.

Records a goal for a visitor that the browser script has already seen. Pass visitor_id (the _tb_vid cookie) or user_id (sent earlier with identify). The goal joins the visitor's latest visit. Names are lowercased; use snake_case.

Scope: write:events.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.

Request body:

JSON
{
  "name": "subscription_started",
  "user_id": "user_123",
  "props": {
    "plan": "pro"
  }
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/events" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"subscription_started","user_id":"user_123","props":{"plan":"pro"}}'

Responses: 202 Recorded · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/identify

Identify a visitor from your server.

Attaches your user id, email, name, avatar and traits to a visitor. Later server-side events can then use user_id.

Scope: write:events.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.

Request body:

JSON
{
  "visitor_id": "k3j5h2g7f9d1s8a4q6w0e2r5",
  "user_id": "user_123",
  "email": "ada@example.com",
  "name": "Ada",
  "traits": {
    "plan": "pro"
  }
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/identify" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"visitor_id":"k3j5h2g7f9d1s8a4q6w0e2r5","user_id":"user_123","email":"ada@example.com","name":"Ada","traits":{"plan":"pro"}}'

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/payments

List payments.

Payments in a time window, newest first, with the channel of the credited visit. Account tokens pass site_id.

Scope: read.

ParameterInTypeRequiredDescription
site_idquerystringnoOnly for account tokens.
fromquerystringnoDefault: 30 days ago.
toquerystringnoDefault: now.
limitqueryintegerno
offsetqueryintegerno
Shell
curl -sS "https://twelvebit.app/api/v1/payments" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/payments

Record a payment.

For payment providers without a built-in connection. Safe to repeat: transaction_id makes it idempotent. The payment is credited to a visit (last touch: the visit before the payment) through visitor_id/session_id, or through the email or customer id of an identified visitor. An amount of 0 is a free trial and is not counted. Account tokens pass site_id in the body.

Scope: write:events.

Request body:

JSON
{
  "amount": 49,
  "currency": "USD",
  "transaction_id": "inv_1042",
  "visitor_id": "k3j5h2g7f9d1s8a4q6w0e2r5",
  "email": "ada@example.com",
  "plan": "Pro"
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/payments" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"amount":49,"currency":"USD","transaction_id":"inv_1042","visitor_id":"k3j5h2g7f9d1s8a4q6w0e2r5","email":"ada@example.com","plan":"Pro"}'

Responses: 200 Already recorded (duplicate transaction_id), or a free trial · 201 Recorded · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/bots

Crawler traffic.

Hits from AI and search crawlers in the range, by kind (ai_answer, indexing, training) and by bot, and browser visits from cloud and hosting networks (AWS, Google Cloud, Azure and others; likely bots). cloud_networks.left_out visits are in no report and no usage count; counted visits came while the site's count_cloud_visits was on.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
periodquerytoday | yesterday | 24h | 7d | 30d | 90d | 6m | 12m | wtd | mtd | ytd | all | customno
fromquerystringnoFirst day (YYYY-MM-DD, site time zone). Use with to.
toquerystringnoLast day, inclusive.
Shell
curl -sS "https://twelvebit.app/api/v1/bots?period=7d" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/bots

Record a crawler hit.

Crawlers do not run JavaScript, so your server reports them. Send the user agent and path of a request; known crawlers are stored as ai_answer (an assistant fetches the page for a person now), indexing (search engines) or training (model training). Unknown user agents are ignored. Fire and forget: do not make the page wait.

Scope: write:events.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.

Request body:

JSON
{
  "user_agent": "Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot",
  "path": "/pricing"
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/bots" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"user_agent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko); compatible; ChatGPT-User/1.0; +https://openai.com/bot","path":"/pricing"}'

Responses: 202 Accepted · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/cli/bootstrap

Find or create a site and mint a key (CLI).

Used by twelvebit init after the device sign-in. Needs a session (the device flow's access token as a Bearer). Finds the user's site for the domain, or creates it, and returns a new site key named after the machine.

Request body:

JSON
{
  "domain": "example.com",
  "timezone": "Europe/Berlin",
  "hostname": "ada-mbp"
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/cli/bootstrap" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"domain":"example.com","timezone":"Europe/Berlin","hostname":"ada-mbp"}'

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 429 Rate limited (see Retry-After).

POST /api/v1/extension/device

Start the browser extension's sign-in.

Used by the twelvebit browser extension. Starts a device sign-in (RFC 8628) for the extension: the person approves user_code on verification_uri_complete, then the extension calls POST /api/v1/extension/token. No authentication.

Shell
curl -sS -X POST "https://twelvebit.app/api/v1/extension/device" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 A device code · 429 Rate limited (see Retry-After).

POST /api/v1/extension/token

Finish the browser extension's sign-in.

Poll with the device_code. Before the approval: 400 with error authorization_pending (or slow_down, expired_token, access_denied). After it: a read-only account token (tbt_…, scope read, named Browser extension). The session of the device flow ends at once.

Request body:

JSON
{
  "device_code": "…"
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/extension/token" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"device_code":"…"}'

Responses: 200 The read-only token · 400 Invalid input.

DELETE /api/v1/extension/token

Sign the browser extension out.

Deletes the account token that the request sends as a Bearer. Only an account token can delete itself here.

Shell
curl -sS -X DELETE "https://twelvebit.app/api/v1/extension/token" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 204 Deleted · 401 Missing or invalid key.

GET /api/v1/sales

Paid sales by customer type and order source.

Paid orders and refunds, including sales without a website visit. Customer type and order source are independent payment filters. Historical classification uses current Shopify tags; it does not reconstruct past tag values. Website visit filters are not accepted.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
periodquerytoday | yesterday | 24h | 7d | 30d | 90d | 6m | 12m | wtd | mtd | ytd | all | customno
fromquerystringnoFirst day (YYYY-MM-DD, site time zone). Use with to.
toquerystringnoLast day, inclusive.
gqueryhour | day | week | monthnoBucket size. Default depends on the range length.
customer_typequerywholesale | distributor | d2c | unknownno
order_sourcequeryonline_checkout | draft_order | other | unknownno
Shell
curl -sS "https://twelvebit.app/api/v1/sales?period=7d" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/sales/segments

Saved paid sales segments.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/sales/segments" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/sales/segments

Save a paid sales segment.

Scope: write:config.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.

Request body:

JSON
{
  "name": "string",
  "filters": {
    "customer_type": "wholesale",
    "order_source": "online_checkout"
  }
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/sales/segments" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"string","filters":{"customer_type":"wholesale","order_source":"online_checkout"}}'

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

DELETE /api/v1/sales/segments

Delete a paid sales segment.

Scope: write:config.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
idquerystringyes
Shell
curl -sS -X DELETE "https://twelvebit.app/api/v1/sales/segments" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/sites/{siteId}/exclusions

Get the exclusion lists.

The IP addresses and ranges, paths, hostnames, excluded countries and hidden countries of a site (Settings → Exclusions).

Scope: read.

ParameterInTypeRequiredDescription
siteIdpathstringyesSite id, public id (tb_…) or domain.
Shell
curl -sS "https://twelvebit.app/api/v1/sites/tb_YOUR_SITE_ID/exclusions" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/sites/{siteId}/exclusions

Add and remove exclusions.

Adds and removes single entries, with the checks of Settings → Exclusions: IP addresses and CIDR ranges are checked and stored in one form (203.0.113.9/24 is stored as 203.0.113.0/24; IPv4-mapped IPv6 becomes IPv4), countries are ISO codes or English names. A country in hidden_countries is also excluded, and its past data is left out of every report (nothing is deleted); removing it from hidden_countries shows the past data again, and removing it from countries also stops the exclusion. Adding an entry that is there, or removing one that is not, changes nothing, so a repeat is safe; with Idempotency-Key a retry returns the first answer. data.change_note says in one sentence what changed (null when nothing changed). Owners and members only. To replace a whole list, use PATCH /api/v1/sites/{siteId}.

Scope: write:config.

ParameterInTypeRequiredDescription
siteIdpathstringyesSite id, public id (tb_…) or domain.
Idempotency-KeyheaderstringnoMakes a create safe to retry for 24 hours: a repeat with the same key and body returns the first answer (header Idempotent-Replayed: true) and creates nothing. The same key with another body is a 409.

Request body:

JSON
{
  "add": {
    "ips": [
      "203.0.113.0/24"
    ],
    "paths": [
      "/admin/**"
    ],
    "hidden_countries": [
      "RU"
    ]
  },
  "remove": {
    "hostnames": [
      "staging.example.com"
    ]
  }
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/sites/tb_YOUR_SITE_ID/exclusions" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"add":{"ips":["203.0.113.0/24"],"paths":["/admin/**"],"hidden_countries":["RU"]},"remove":{"hostnames":["staging.example.com"]}}'

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

GET /api/v1/funnels/{funnelId}

Get a saved funnel.

The definition of one saved funnel and its result for the range (result).

Scope: read.

ParameterInTypeRequiredDescription
funnelIdpathstringyesSaved funnel id (from GET /api/v1/funnels or /api/v1/funnels/{funnelId}).
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
periodquerytoday | yesterday | 24h | 7d | 30d | 90d | 6m | 12m | wtd | mtd | ytd | all | customno
fromquerystringnoFirst day (YYYY-MM-DD, site time zone). Use with to.
toquerystringnoLast day, inclusive.
Shell
curl -sS "https://twelvebit.app/api/v1/funnels/FUNNEL_ID?period=7d" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

PATCH /api/v1/funnels/{funnelId}

Change a saved funnel.

Rename the funnel or replace all its steps. Send only what changes.

Scope: write:config.

ParameterInTypeRequiredDescription
funnelIdpathstringyesSaved funnel id (from GET /api/v1/funnels or /api/v1/funnels/{funnelId}).
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.

Request body:

JSON
{
  "name": "Pricing to purchase",
  "steps": [
    "page:/pricing",
    "goal:signup",
    "goal:purchase"
  ]
}
Shell
curl -sS -X PATCH "https://twelvebit.app/api/v1/funnels/FUNNEL_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Pricing to purchase","steps":["page:/pricing","goal:signup","goal:purchase"]}'

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

DELETE /api/v1/funnels/{funnelId}

Delete a saved funnel.

Removes the funnel from the dashboard. Visit data stays.

Scope: write:config.

ParameterInTypeRequiredDescription
funnelIdpathstringyesSaved funnel id (from GET /api/v1/funnels or /api/v1/funnels/{funnelId}).
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS -X DELETE "https://twelvebit.app/api/v1/funnels/FUNNEL_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/alerts

List alerts.

Notifications when a goal completes or a payment arrives. Webhook URLs are secrets, so only their start is shown.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/alerts" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/alerts

Create an alert.

trigger is a goal name, or "payment" for every new payment. channel email takes an email address as target; webhook, slack and discord take an https:// URL. At most 20 per site. Safe to retry with Idempotency-Key.

Scope: write:config.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Idempotency-KeyheaderstringnoMakes a create safe to retry for 24 hours: a repeat with the same key and body returns the first answer (header Idempotent-Replayed: true) and creates nothing. The same key with another body is a 409.

Request body:

JSON
{
  "trigger": "signup",
  "channel": "email",
  "target": "founder@example.com"
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/alerts" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"trigger":"signup","channel":"email","target":"founder@example.com"}'

Responses: 201 Created · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

GET /api/v1/alerts/{alertId}

Get an alert.

Scope: read.

ParameterInTypeRequiredDescription
alertIdpathstringyesAlert id (from GET /api/v1/alerts).
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/alerts/ALERT_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

PATCH /api/v1/alerts/{alertId}

Change an alert.

Change trigger, channel or target, or pause it with enabled: false. A new channel needs a new target.

Scope: write:config.

ParameterInTypeRequiredDescription
alertIdpathstringyesAlert id (from GET /api/v1/alerts).
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.

Request body:

JSON
{
  "enabled": false
}
Shell
curl -sS -X PATCH "https://twelvebit.app/api/v1/alerts/ALERT_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"enabled":false}'

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

DELETE /api/v1/alerts/{alertId}

Delete an alert.

Scope: write:config.

ParameterInTypeRequiredDescription
alertIdpathstringyesAlert id (from GET /api/v1/alerts).
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS -X DELETE "https://twelvebit.app/api/v1/alerts/ALERT_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/annotations/{annotationId}

Get an annotation.

Scope: read.

ParameterInTypeRequiredDescription
annotationIdpathstringyesAnnotation id (from GET /api/v1/annotations).
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/annotations/ANNOTATION_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 404 Not found · 429 Rate limited (see Retry-After).

PATCH /api/v1/annotations/{annotationId}

Change an annotation.

Change the label, time or link. url: null removes the link.

Scope: write:config.

ParameterInTypeRequiredDescription
annotationIdpathstringyesAnnotation id (from GET /api/v1/annotations).
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.

Request body:

JSON
{
  "label": "Launched v2 on Product Hunt"
}
Shell
curl -sS -X PATCH "https://twelvebit.app/api/v1/annotations/ANNOTATION_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"label":"Launched v2 on Product Hunt"}'

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

DELETE /api/v1/annotations/{annotationId}

Delete an annotation.

Scope: write:config.

ParameterInTypeRequiredDescription
annotationIdpathstringyesAnnotation id (from GET /api/v1/annotations).
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS -X DELETE "https://twelvebit.app/api/v1/annotations/ANNOTATION_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/team

List the team.

The owner and every invited person, with role and status (active, invited, or expired).

Scope: admin.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/team" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/team

Invite a person.

Owner only. Sends the invite email with a link to the invite page (/invite/…), where the person creates an account or signs in with that address and joins in one step. The response has invite_url, the same page for you to share elsewhere. Invites expire after 14 days. Inviting an existing member changes only the role (200, no email). viewer = read only; member = read and change the setup. Safe to retry with Idempotency-Key.

Scope: admin.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Idempotency-KeyheaderstringnoMakes a create safe to retry for 24 hours: a repeat with the same key and body returns the first answer (header Idempotent-Replayed: true) and creates nothing. The same key with another body is a 409.

Request body:

JSON
{
  "email": "ada@example.com",
  "role": "viewer"
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/team" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"email":"ada@example.com","role":"viewer"}'

Responses: 200 Already a member: the role was updated · 201 Invited · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

PATCH /api/v1/team/{email}

Change a member's role.

Owner only.

Scope: admin.

ParameterInTypeRequiredDescription
emailpathstringyesThe member's email, URL-encoded (ada%40example.com).
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.

Request body:

JSON
{
  "role": "member"
}
Shell
curl -sS -X PATCH "https://twelvebit.app/api/v1/team/ada%40example.com" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"role":"member"}'

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

DELETE /api/v1/team/{email}

Remove a member.

Owner only. The site keys that the person made stop working.

Scope: admin.

ParameterInTypeRequiredDescription
emailpathstringyesThe member's email, URL-encoded (ada%40example.com).
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS -X DELETE "https://twelvebit.app/api/v1/team/ada%40example.com" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/keys

List site keys.

Name, first characters, scopes, creator and last use. Never the secret. Owners and members only.

Scope: admin.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/keys" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/keys

Create a site key.

The secret is in data.key in this response only; store it at once. A key cannot create a key with scopes it does not have. Default scopes: read, write:events, write:config. With Idempotency-Key, a replay returns the key's details with key: null.

Scope: admin.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Idempotency-KeyheaderstringnoMakes a create safe to retry for 24 hours: a repeat with the same key and body returns the first answer (header Idempotent-Replayed: true) and creates nothing. The same key with another body is a 409.

Request body:

JSON
{
  "name": "Read-only dashboard export",
  "scopes": [
    "read"
  ]
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/keys" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"Read-only dashboard export","scopes":["read"]}'

Responses: 201 Created · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

DELETE /api/v1/keys/{keyId}

Revoke a site key.

Requests with the key fail at once. A key can revoke itself.

Scope: admin.

ParameterInTypeRequiredDescription
keyIdpathstringyesKey id (from GET /api/v1/keys). Not the secret.
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS -X DELETE "https://twelvebit.app/api/v1/keys/KEY_ID" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/goals/{name}

Get a goal's display settings.

Display name, colour, hidden, and whether the goal is the #1 KPI.

Scope: read.

ParameterInTypeRequiredDescription
namepathstringyesThe goal (event) name, URL-encoded. GET /api/v1/goals lists them.
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/goals/NAME" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

PATCH /api/v1/goals/{name}

Customise a goal.

Rename a goal for the dashboard, give it a colour, hide it, or make it the #1 KPI. The event name never changes, so code, funnels and alerts keep working. Send only what changes; null resets display_name or color. kpi: false sets the KPI back to revenue when this goal is the KPI. meta.warnings names a goal that was never seen.

Scope: write:config.

ParameterInTypeRequiredDescription
namepathstringyesThe goal (event) name, URL-encoded. GET /api/v1/goals lists them.
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.

Request body:

JSON
{
  "display_name": "Signed up",
  "color": "#6FB8FF",
  "kpi": true
}
Shell
curl -sS -X PATCH "https://twelvebit.app/api/v1/goals/NAME" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"display_name":"Signed up","color":"#6FB8FF","kpi":true}'

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

POST /api/v1/keys/{keyId}/roll

Roll a site key.

Makes a new secret with the same name and scopes and returns it in data.key, once. The old key stops at once, or after grace_seconds (at most 86400, 24 hours) so a deploy can switch over; data.old_key.expires_at says when. Owners can roll any key, members their own. A key in its grace period cannot be rolled again (409 key_expiring). With Idempotency-Key, a replay returns key: null. The MCP tool roll_api_key never returns the secret: the person copies it in the dashboard.

Scope: admin.

ParameterInTypeRequiredDescription
keyIdpathstringyesKey id (from GET /api/v1/keys). Not the secret.
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Idempotency-KeyheaderstringnoMakes a create safe to retry for 24 hours: a repeat with the same key and body returns the first answer (header Idempotent-Replayed: true) and creates nothing. The same key with another body is a 409.

Request body:

JSON
{
  "grace_seconds": 3600
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/keys/KEY_ID/roll" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"grace_seconds":3600}'

Responses: 201 Rolled · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

GET /api/v1/alerts/deliveries

Alert delivery history.

Every alert, test and report message that twelvebit tried to send, newest first. Webhook URLs are shortened because they are secrets. Page with before = meta.next_before.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
alert_idquerystringnoOnly this alert.
statusquerysent | failed | skippednoOnly this status.
kindqueryalert | test | weekly | spikenoOnly this kind.
beforequerystringnoOnly deliveries before this time (meta.next_before).
limitqueryintegernoRows per page.
Shell
curl -sS "https://twelvebit.app/api/v1/alerts/deliveries" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/integrations

Integration status.

For each integration: connected, status, last sync, last event, last error and non-secret details. Never a secret or a token. A person connects an integration in the dashboard (connect_url): the API never takes a secret.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/integrations" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/integrations/{provider}

One integration's status.

Scope: read.

ParameterInTypeRequiredDescription
providerpathstripe | polar | lemonsqueezy | paddle | dodo | shopify | woocommerce | gsc | meta_ads | google_ads | githubyesIntegration id.
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/integrations/PROVIDER" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

DELETE /api/v1/integrations/{provider}

Disconnect an integration.

Deletes the stored secret or token (Search Console also revokes the Google grant; Shopify removes the script and webhooks). Imported payments and orders stay. Connecting again needs a person in the dashboard, so the body must name the provider: {"confirm": "stripe"}. Owners and members only.

Scope: write:config.

ParameterInTypeRequiredDescription
providerpathstripe | polar | lemonsqueezy | paddle | dodo | shopify | woocommerce | gsc | meta_ads | google_ads | githubyesIntegration id.
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.

Request body:

JSON
{
  "confirm": "stripe"
}
Shell
curl -sS -X DELETE "https://twelvebit.app/api/v1/integrations/PROVIDER" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"confirm":"stripe"}'

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

GET /api/v1/billing

The account's plan, usage and limits.

Status (beta, trialing, active, past_due, canceled, expired, exempt), trial end, events since the start of the monthly cycle, site and people limits, whether the dashboard asks for a plan (dashboard_locked, lock_reason; tracking never stops), and meta.catalog with the plans and prices. With a site key or ?site=, the account that owns the site; only the owner gets the details (others get dashboard_locked and owner_name).

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
Shell
curl -sS "https://twelvebit.app/api/v1/billing" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

POST /api/v1/billing/checkout

Make a checkout link (or change the plan).

Owner only. Returns checkout_url, a Dodo Payments page for the person to open and pay; no card data passes through the API. With an active plan, changes the plan instead (kind: plan_change; Dodo bills the difference, or nothing during the free trial; an account with a discount keeps it on a change to another plan at 10k, 100k or 200k, and a larger tier ends it). The plan applies when Dodo confirms the payment. Takes Idempotency-Key. 409 billing_off when billing is not live.

Scope: admin.

ParameterInTypeRequiredDescription
Idempotency-KeyheaderstringnoRepeat the same request safely.

Request body:

JSON
{
  "plan": "growth",
  "tier": "100k",
  "interval": "year"
}
Shell
curl -sS -X POST "https://twelvebit.app/api/v1/billing/checkout" -H "Authorization: Bearer $TWELVEBIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"plan":"growth","tier":"100k","interval":"year"}'

Responses: 200 The plan of the active subscription is changing · 201 A checkout link for a person to open · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 409 Error · 429 Rate limited (see Retry-After).

GET /api/v1/usage

Usage this month.

Events in a calendar month (UTC) by type (page views, goals, pings, bot hits, other), the billable count (page views + goals) with a projection for the month and the plan tier it fits, the top 10 paths and hostnames by event count, and the usage controls in place. Change the controls with PATCH /api/v1/sites/{siteId} (excluded_paths, excluded_hostnames, drop_pings, pageview_sample_rate). The plan counts per monthly cycle from the trial or plan start, not per calendar month: plan.cycle has the count of the current cycle (owner), and GET /api/v1/billing has the full plan.

Scope: read.

ParameterInTypeRequiredDescription
sitequerystringnoSite id, public id (tb_…) or domain. Needed for account tokens with more than one site; site keys ignore it.
monthquerystringnoYYYY-MM (UTC). Default: this month.
Shell
curl -sS "https://twelvebit.app/api/v1/usage" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OK · 400 Invalid input · 401 Missing or invalid key · 403 Not allowed for this key · 404 Not found · 429 Rate limited (see Retry-After).

GET /api/v1/openapi.json

This document.

Shell
curl -sS "https://twelvebit.app/api/v1/openapi.json" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OpenAPI 3.1 document.

GET /api/v1/openapi.yaml

This document as YAML.

Shell
curl -sS "https://twelvebit.app/api/v1/openapi.yaml" -H "Authorization: Bearer $TWELVEBIT_API_KEY"

Responses: 200 OpenAPI 3.1 document.