Authentication

Every call carries a bearer token:

Authorization: Bearer 1|gVJm0rE8ZO...

No other scheme is accepted on the public surface. There is no API key in a query string and no HMAC signing.

A token belongs to one account and never expires. It is revoked from the dashboard, and revocation is immediate: the next call with it returns 401, with no grace period.

Scopes

Two, and a token holds one or both.

Scope Reaches
read Every GET on the public surface
write Everything that changes state, deletes included
workspaces Creating tenants, listing them, setting their business profile

There is no delete scope: withholding destruction is what a read-only token is for. There is no spend scope either, because spending is capped on the account, by its credit balance, not on the credential.

A token created without an explicit scope gets read only.

workspaces, and why it is separate

Most integrations never need it. A workspace is a tenant — its own business, its own leads, its own service list — and a key that can mint them is a platform's key rather than an integration's. So it is opt-in, it is not in the "Read and write" preset, and it implies neither of the other two: a key holding only workspaces can onboard a customer and cannot read a single lead.

You need it only if you serve your own customers through one key. A single business never does: your account already has one workspace, every key reaches it automatically, and no header is involved.

GET  /workspaces                              the ones this key may act for
POST /workspaces                              name, and optionally a profile
PUT  /workspaces/{id}/business-profile        replace the service list

Both calls are free of credits. Deleting a workspace is deliberately not here: it destroys that customer's leads and radars irreversibly, so it stays a dashboard action.

Once a key can act for more than one workspace, every other call has to say which — see Acting for one of several workspaces below.

GET /me reports the scope of the token making the call, under token.abilities, so a client can check what it may do instead of discovering it from a refusal. That one endpoint is reachable by any valid token whatever its scope, for exactly that reason.

Calling a write endpoint with a read-only token:

HTTP 403
{ "message": "Invalid ability provided." }

What no token can reach

A scope is not the only gate. Billing, account deletion, token management and the admin tools are closed to bearer tokens whatever scope they hold:

HTTP 403
{ "message": "This endpoint is not available to API tokens." }

These are not part of the API, so a leaked token must not reach them.

In practice that means an integration cannot: start or cancel a subscription, buy credits, read invoices, delete the account, create or revoke tokens, or change the business profile. Those are browser-session actions.

A read-only token and a read-and-write token get the same 403 here. The scope is irrelevant; the endpoint is simply not part of the API.

Signing in is not part of the API

Nothing under /auth/* is. /auth/google, /auth/email/request and /auth/email/verify issue a session cookie rather than a token, and an integration has no use for them: get a token from the dashboard instead. GET /auth/user is the web app's own user payload, so its shape follows the UI and it is closed to tokens like the rest of them.

GET /me is the whoami. It is written for API clients and its shape is a contract.

Acting for one of several workspaces

A key granted exactly one workspace needs nothing: the server resolves it and every lead lands in the right place. That is every ordinary customer.

A platform's key holds many, so each call names one:

Authorization: Bearer 1|gVJm0rE8ZO...
LeadCubs-Workspace: 42

Omit it with several granted and the call is refused rather than guessed at — a wrong guess would file one customer's leads under another, and nothing downstream would notice:

HTTP 400
{ "message": "This token can act on several workspaces. Name one with the LeadCubs-Workspace header.",
  "workspaces": [41, 42, 43] }

An id the key was not granted is a 404, like every other cross-tenant answer here. The workspace-management calls above are the exception and need no header: they are about workspaces rather than inside one.

Assert the workspace you got. GET /me reports which one answered. The header is doing its job when it sends you somewhere else, so a platform looping over its customers should check once per customer that the workspace coming back is the one it meant — nothing else will tell you.

Choosing a scope

Give each integration its own token, scoped to what it does:

  • A reporting job, a dashboard, an export: read.
  • Anything that queues analyses, starts searches or deletes leads: read and write.
  • A platform onboarding its own customers: add workspaces.

One token per integration, not one per account. When something leaks you revoke one thing, and the other integrations keep running.