POST /v1/attributions work without an API key. Omit the Authorization header for free, best-effort keyless access. A supplied key always undergoes the normal status, scope, and billing checks; invalid keys never fall back to keyless access.
Generation, raw heatmaps, and account endpoints need an API key. GET /health is public. Send your key as a Bearer token:
Create a key
- Sign in at platform.tokenpath.ai.
- Open API keys and click Create key. Naming the key is optional.
- Copy the key right away. TokenPath shows the secret only once and stores just a hash of it.
tpk_live_ followed by a short public ID and a long secret. The dashboard lists each key by its public prefix and shows when it was last used.
Get a key from a coding agent
A coding agent can get a key for you without you copying it anywhere. Paste this into Claude Code, Cursor, or Codex:.env as TOKENPATH_API_KEY. The key never appears in the browser or the chat. It shows up on the API keys page as Agent · <project folder> with both scopes, and you can revoke it there like any other key. Unapproved links expire after 15 minutes.
To do this without an agent, run the same helper yourself from your project root:
Scopes
Each key carries scopes that decide which endpoints it can call. Keys created in the dashboard get both scopes.
A request with a key that lacks the scope fails with
403 missing_scope. details.missing_scopes lists what is missing:
Revoke and rotate keys
To revoke a key, click Revoke next to it in the dashboard. Requests that use it fail with403 api_key_inactive straight away.
To rotate without downtime, create a new key, deploy it, confirm traffic has moved (the old key’s Last used time stops changing), and then revoke the old key.
Authentication errors
invalid_api_key covers both malformed keys and keys that do not exist. The API does not tell them apart, so it never reveals which key prefixes are real.