Authentication and keys
3x has four kinds of credentials. Each has a recognizable prefix, so secret scanners (GitHub, GitLab) can find leaked keys, and a checksum, so a mistyped key is rejected before any database lookup.
| Credential | Prefix | Belongs to | Where it is used |
|---|---|---|---|
| Publishable key | pk_3x_ | one project | Browser SDK (data-key, ?k=), POST /v1/e, POST /v1/cb, GET /v1/c/{pk} – public by design |
| Secret key | sk_3x_ | an organization, optionally narrowed to projects | Your server, CI, Claude Code (Authorization: Bearer sk_3x_…) |
| Proxy key | sk_3x_ with scope ingest:proxy | one project | The first-party proxy (x-3x-proxy-key) |
| Dashboard session | x3s_ | a user | The dashboard; scripts that log in as a user |
OAuth access tokens (x3oat_…) exist as well. Tokens of MCP clients such as Claude are only
accepted on /mcp – see claude.ai connector. Tokens of the X3 App reach a
fixed part of the REST API – see X3 App.
Publishable keys
A publishable key identifies the project of a tracking request. It can only send data, and only from the origins in the project's tracking config (Settings › Installation & status › Allowed origins). Requests from any other origin get 403 and are not stored. Because the key is public, every conversion that browser traffic can trigger is guarded (engaged session, once per session and definition, daily cap, optional server confirmation – see Server-side conversions).
# list and create publishable keys (project:admin)
curl -H "Authorization: Bearer $X3_SECRET_KEY" https://api.3x.example/v1/projects/my-site/publishable-keys
curl -X POST -H "Authorization: Bearer $X3_SECRET_KEY" -H "content-type: application/json" \
-d '{"name":"staging"}' https://api.3x.example/v1/projects/my-site/publishable-keysRolling a publishable key (POST …/publishable-keys/{id}/roll) issues a new key and keeps the old
one valid for an overlap period, so cached pages keep tracking while you deploy.
Secret keys
Secret keys belong to an organization and carry scopes. Create them in the dashboard
(Organization → API keys) or with POST /v1/orgs/{org}/keys. The value is shown once; 3x
stores only a SHA-256 hash.
curl -X POST https://api.3x.example/v1/orgs/acme/keys \
-H "Authorization: Bearer $X3_SESSION" -H "content-type: application/json" \
-d '{"name":"reporting job","scopes":["analytics:read"],"projectIds":["9b3c…"],"expiresAt":"2027-01-01T00:00:00Z"}'| Field | Meaning |
|---|---|
scopes | What the key may do – see Scopes and roles. Ask for the least you need. |
projectIds | Optional narrowing to some projects. A narrowed key never holds org:admin. |
expiresAt | Optional expiry. |
note | Free text for your colleagues (where the key is deployed). |
Rules that keep keys from escalating privileges:
- You can only grant scopes you hold yourself; a request for more is refused with **403
insufficient_scope** listing the scopes – nothing is silently dropped. - A key created by a narrowed key is narrowed the same way (or further).
- Keys created through another key or through an OAuth grant are derived: they stop working as soon as their parent key or grant is revoked, and they cannot create keys themselves.
- Creating, rolling and revoking keys from the dashboard needs a recent re-authentication ("sudo", 15 minutes).
Rolling (POST /v1/orgs/{org}/keys/{id}/roll) returns a new value with the same scopes and
keeps the old value valid for expireOldInHours (default 168 = one week, 0 = immediately) – deploy the new value, then let the old one
expire. Keys derived from the rolled key move to the new key (if they fit its scopes and projects), so
a rotation does not break them. Revoking (DELETE /v1/orgs/{org}/keys/{id}) is immediate on the instance that handles
the request; other API instances notice within 10 seconds (credential cache).
Keep secret keys in server-side environment variables (X3_SECRET_KEY), never in client bundles
or NEXT_PUBLIC_* variables, and never in git.
Proxy keys
The first-party proxy forwards the visitor's IP and country to 3x. 3x only trusts
those forwarded values when the request carries a valid proxy key in x-3x-proxy-key – a
secret key with the single scope ingest:proxy, bound to one project. Create it under
Settings → Tracking → Proxy or with POST /v1/projects/{project}/proxy-keys; store it as
X3_PROXY_KEY on the server that runs the proxy.
Dashboard sessions
POST /v1/auth/login with e-mail and password (or a magic link) returns an x3s_… session token.
Its scopes follow the member's role in each organization; personal-data scopes (leads:*)
additionally need the member's PII flag. Sessions expire after inactivity; POST /v1/auth/logout
ends them. Sensitive actions (keys, destinations, deleting projects) need POST /v1/auth/sudo
within the last 15 minutes.
Public sign-in endpoints (rate-limited, see Rate limits):
| Endpoint | Purpose |
|---|---|
POST /v1/auth/login | e-mail + password → session |
POST /v1/auth/magic-link | sends a sign-in link (same answer whether the account exists) |
POST /v1/auth/magic-link/verify | exchanges the link's token for a session |
POST /v1/auth/password-reset | „Passwort vergessen?“: mails a link to set a new password (same answer whether the account exists; 10 per IP and 15 minutes, then 429) |
POST /v1/auth/password-reset/confirm | the link's token and the new password → session; the token is single use and valid 15 minutes, every other session, OAuth connection and the API sign-in of the account end |
POST /v1/auth/signup | creates a user – with an invitation token, or self-signup when X3_ALLOW_SIGNUP=1 |
GET /v1/invitations/{token} | invitation details for the accept page; POST /v1/invitations/{token}/accept (signed in) joins the organization |
POST /v1/auth/demo | read-only viewer session for 2 hours, only when X3_DEMO_LOGIN=1 (Demo) |
Password reset
The reset mail links to /reset-password/<token> on the dashboard (or the neutral account area for people
without a Growth Intelligence project). Opening the page uses nothing; only its form (POST) sets the
password, so mail scanners that fetch links do not burn the token. The sign-in page of the API host (X3 App,
Sales Engine, Claude) offers „Passwort vergessen?“ too, and every failed password sign-in shows „Kein
Passwort gesetzt oder vergessen?“ with the reset and the sign-in link, for unknown addresses alike.
When an address is confirmed in a different browser than the one of the registration, the password chosen at the registration is removed for security (someone else could have registered the address). X3 then mails „Dein X3-Passwort wurde aus Sicherheitsgründen entfernt“ with a reset link.
X3 App
The X3 App for iOS and Android signs in with OAuth (client x3-mobile, Authorization Code with
PKCE in the system browser) and holds an x3oat_… access token per device. How the sign-in works:
- Client:
x3-mobileis built into the server (a public client without secret; it is not registered dynamically). Its redirect URIs come fromX3_MOBILE_REDIRECTSand are compared as exact strings – no loopback ports, no other hosts. Production allows the https callbackhttps://<dashboard>/oauth/mobile/callback(Android verified App Link) and exactly one app scheme,io.x3growth.app:/oauth/callback(iOS, a private-use URI scheme per RFC 8252 §7.1 named after the bundle id). The scheme needs no domain association; another app claiming it gains nothing, because the code is bound to the app's PKCE verifier, valid 60 seconds and single use. The dev and preview builds use their own app schemes against staging. - Audience: the app asks for
resource=<issuer>/v1(metadata at/.well-known/oauth-protected-resource/v1). Only built-in clients get this audience; every other client is answeredinvalid_target, and app tokens are not accepted on/mcp. - Consent: always one explicit tap („X3 App auf diesem Gerät anmelden“);
prompt=noneis answeredconsent_required. The person can release all or only some organizations and projects. - Device: the app sends
device_namewith the code exchange; it appears inGET /v1/auth/oauth-grants(deviceLabel) and under KI-Apps, where „Gerät abmelden“ revokes the grant at once. - Refresh: tokens rotate on every refresh. A refresh token presented again after its rotation
normally ends the grant (reuse detection); for the app a lost answer is tolerated: as long as no
token of that rotation was ever used, the request gets a fresh pair instead. An app grant ends
after 90 days without use and one year after the sign-in at the latest.
POST /oauth/revokewith the refresh token signs the device out. - Sign-in by e-mail: the sign-in mail of the OAuth page also carries a 6 digit code that can be typed into the page where the sign-in started (5 tries per code).
What the token may do:
- Scopes: at most
analytics:read,ads:read,ads:write,conversions:read,conversions:write,leads:summary,leads:read,leads:status,leads:write,recordings:read,crm:readandconfig:write– neverproject:admin,org:admin,crm:write,events:write,ingest:proxyorproject:create. In each organization the token holds no more than the person's own membership allows today. - Reads: every
GETendpoint with secret-key or session auth, except exports, endpoints that return credentials, billing and admin endpoints. - Changes: only the endpoints marked X3 App in the API reference
(lead status, notes and contact reveal, marking sessions seen, alerts, tasks and notices,
pausing or stopping experiments, ad sync and a few more). Everything else answers **403
not_available_in_app**; endpoints that need a re-authentication (sudo) are never reachable with an app token. - Admin:
/v1/admin/*answers 404, andplatformAdminis alwaysfalsefor an app token.
GET /v1/app/me returns the start data of the app for the signed-in person: the organizations and
projects the token covers (with the membership role per project and whether the person administers
it), the scopes in effect per organization, which features are locked and the dates of the Free
pageview lock – no plan names, no prices. grantNarrowed is true when the person released only
some organizations or projects to the app. The endpoint works with a dashboard session too.
Push notifications
The app registers its push token with PUT /v1/me/notifications/devices. A device is bound to the
app's sign-in on it: signing out, „überall abmelden“, a password change or deleting the account
ends that sign-in and the device gets no more pushes. Before every push the API checks again what
that sign-in reaches today, so a person who left an organization or lost a permission gets nothing
more from it. Which pushes a person gets (new leads, daily and weekly summary, unusually many
interested visitors, quieter than usual, problems, tracking, budget, experiments, good news,
account, news from X3), quiet hours and what the lock screen shows are set under
/v1/me/notifications/settings and /v1/me/notifications/rules – the same settings as the web page
Konto › Mitteilungen.
Pushes carry ids only (lead, task, project) plus a text without visitor data: the project name,
counts and a channel such as „Google Ads“. With „Mit Details“ on the lock screen they add the lead's
fit, country, page path and campaign name, never names, contact data, messages or answers. „1 Tag
stumm“ on a push calls POST /v1/notifications/actions/mute with the signed token of that push; it
needs no sign-in and can do nothing but mute that project's category for 24 hours.
Widgets
The app's home and lock screen widgets run outside the app and never see its sign-in. The app asks
POST /v1/app/widgets/token for a widget token (x3w_…, 30 days, renewed whenever the app starts or
goes to the background) and keeps it in the device's protected storage shared with its widgets. The
widgets send it as Authorization: Bearer x3w_… to GET /v1/widgets/summary (visitors, leads, ad
spend and cost per lead today, yesterday and the last 7 days per project) and GET /v1/widgets/projects
(the projects to choose from). The token can do nothing else, reads exactly what the app's sign-in
reaches at that moment and stops working when that sign-in ends (sign-out, „überall abmelden“,
password change); then the routes answer 401 invalid_token.
Other X3 products
The Sales Engine and X3 Konto are products of their own with their own APIs (https://api.crm.x3growth.io,
https://identity.x3growth.io). Their tokens are issued for their own audiences; a token of their clients is no
token of this API (401). Requests to their old paths on this host are forwarded to them during a transition period.
Sending credentials
GET /v1/projects/my-site/analytics/overview?from=2026-10-01&to=2026-10-14 HTTP/1.1
Host: api.3x.example
Authorization: Bearer sk_3x_…- Projects can be addressed by id or slug (
my-site); slugs are unique per organization, andorg-slug/project-slugis always unambiguous. In a URL path, encode the slash:/v1/projects/acme%2Fmy-site/…. A bare slug that exists in several of your organizations answers 404 – use theorg-slug/project-slugform or the id. Credential-less feed URLs (Google Ads CSV) always use the project id. - No access to a project at all → 404 (3x does not reveal that it exists). Access without the
required scope → **403
insufficient_scope** withrequired. - A missing or malformed header → 401 with
WWW-Authenticate: Bearer.
All error shapes: Errors.