Skip to main content
Small requests to 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

  1. Sign in at platform.tokenpath.ai.
  2. Open API keys and click Create key. Naming the key is optional.
  3. Copy the key right away. TokenPath shows the secret only once and stores just a hash of it.
Keys look like 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:
The agent asks TokenPath for a key, which stays inactive until you approve it, and shows you a link and a six-digit code. Open the link, sign in or sign up, check that the code matches, and click Approve. The agent saves the key to your project’s .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:
Keep API keys on your server. Never ship them in browser or mobile code, commit them to a repository, or paste them into logs. Read the key from an environment variable or a secrets manager at runtime.

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 with 403 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.
See Errors for the full error format and retry guidance.