Skip to content

Automate

API tokens

Give a script, CI job or AI agent its own credential, and choose what it may do.

An API token lets a script, a CI job, the CLI or an AI agent manage your organisation without a person signed in. Use one with the REST API or the MCP server.

What a token is

A token is a secret that starts with sbp_ followed by 43 letters, digits, - or _. It belongs to one organisation and acts for the person who created it.

  • It sees one organisation. Asking for any other organisation gets 404 not_found, the same answer as for one that does not exist.
  • It can do only what its scopes allow and its creator can do today. A token never acts as an owner: the most it can have is the admin role. If its creator is demoted, the token is demoted with them. If its creator is removed from the organisation, their tokens are revoked.
  • It is shown once. Showbug stores only a SHA-256 hash of the token, so nobody, including Showbug, can show it again.
  • It is not a sign-in. It cannot open the dashboard, and it cannot create or revoke tokens. See why.

A token is not a project key

Project keys (pk_…) are public: they sit in your page’s script tag. An API token is a secret that manages your account. Never put one in a web page. See API keys and security for project keys.

Creating a token

  1. Sign in to the dashboard as an owner or admin of the organisation.
  2. Open Settings → API tokens (the address ends in /settings/tokens).
  3. Name the token after what will use it, such as “GitHub Actions deploy” (up to 80 characters). Choose its scopes and how long it lasts.
  4. Copy the token when it appears. It is shown once, so put it in your secret store straight away.

An organisation can have up to 50 active tokens. Past that, creating one fails until you revoke another.

Check that the token works:

curl https://api.showbugai.com/api/v1/me \
  -H "Authorization: Bearer $SHOWBUG_TOKEN"
{
  "user": { "id": "usr_…", "email": "dana@example.com", "name": "Dana", "pictureUrl": null },
  "orgs": [
    { "id": "org_…", "name": "Acme", "slug": "acme", "status": "active", "role": "admin" }
  ],
  "token": {
    "id": "tok_…",
    "name": "GitHub Actions deploy",
    "scopes": ["keys:write", "projects:write"],
    "expiresAt": "2026-12-28T10:15:00Z"
  }
}

The answer names the token’s organisation. Its id is the {org_id} in the other paths, as shown on the REST API page.

Scopes

A scope is a resource and an action, such as projects:write. Choose at least one. write includes read of the same resource, so you never need both.

ScopeAllows
org:readView the organisation.
org:writeRename the organisation.
projects:readView projects, their limits and allowed origins.
projects:writeCreate projects; change names, limits, status and allowed origins.
keys:readView SDK keys.
keys:writeCreate and revoke SDK keys.
members:readView members and pending invites.
members:writeChange roles, remove members, send and revoke invites.
integrations:readView integrations and the delivery log.
integrations:writeConnect, change, test and remove integrations; retry deliveries and tickets.
sessions:readView recorded sessions, replays and tickets.
audit:readRead the audit log.

Scopes only narrow a token; they never widen it. A token made by an admin with members:write can change the roles of people who are not owners, and nobody else’s. A call that needs a scope the token lacks is refused with 403 insufficient_scope.

Scopes for some common jobs:

JobScopes
An agent that explores your account and cannot change itorg:read, projects:read, keys:read, members:read, integrations:read, sessions:read
A CI job that creates a project and prints its keyprojects:write
A job that adds a preview URL to a projectprojects:write
A job that sends reports to a webhookprojects:read, integrations:write
A report on who changed whataudit:read

Which scope each endpoint needs is listed in the endpoint reference. A few actions have no scope because a token can never do them; see Why only a signed-in admin can create one.

Expiry

Every token expires. You choose between 1 and 365 days when you create it; the default is 30. The expiry cannot be changed afterwards.

After the expiry the token answers 401 unauthenticated, exactly like a revoked or unknown token, and shows as expired in the list. Create a new token to carry on.

Revoking and rotating

Revoke a token from Settings → API tokens. It stops working at once and cannot be restored. Revoking one that is already revoked changes nothing. Removing a person from the organisation revokes the tokens they made.

A token’s scopes and expiry cannot be edited, so you rotate by replacing it:

  1. Create a new token with the same scopes.
  2. Give it to the job that used the old one, and run the job once.
  3. When the old token’s last used time stops moving, revoke it.

Last used and the audit log

Each token in the list shows its name, its scopes, the last four characters of the secret (to tell tokens apart), its status (active, expired or revoked), when it expires and when it was last used. The last used time is updated at most once a minute, so it can be up to a minute behind. A token that has never been used has no time.

Every change a token makes is written to the organisation’s audit log, like a change made in the dashboard. The event names the person who created the token as the actor and adds via to say a token made the change:

{
  "id": "aud_…",
  "actor": { "type": "user", "id": "usr_…" },
  "via": { "type": "api_token", "id": "tok_…" },
  "action": "key.revoked",
  "target": { "key_id": "key_…" },
  "meta": null,
  "projectId": "prj_…",
  "at": "2026-11-28T10:15:00Z"
}

Events made in the dashboard have via set to null. Creating and revoking tokens is logged too, as token.created and token.revoked. Admins read the log under Settings, or with an audit:read token. To see everything one token did, filter the events on via.id.

Why only a signed-in admin can create one

Only a person signed in to the dashboard, as an owner or admin, can create, list or revoke tokens. A token cannot do any of these: the API answers 403 session_required. There are two reasons.

  • A token that could create tokens could copy itself. If it leaked, its expiry and revocation would no longer stop whoever held it.
  • Every token traces back to a named person. Their role limits what the token can do, and the audit log names them.

Creating an organisation is also for signed-in people only, because a token belongs to one organisation and cannot make another.

Rate limits

Each token may make 120 requests a minute. The limit is per token, not per organisation, so a busy integration does not use up another’s allowance. A token can burst up to 120 requests at once; the allowance then refills steadily.

Answers to a token carry these headers:

HeaderMeaning
RateLimit-LimitRequests allowed a minute: 120.
RateLimit-RemainingRequests left in the allowance right now.
RateLimit-ResetSeconds until the allowance is full again.
Retry-AfterOnly on a 429: seconds to wait before the next request.

Over the limit the API answers 429 with the code rate_limited. See Rate limits in the REST API page for how to handle it.

Good practice

  • Keep tokens in a secret store. Use your CI’s secrets, your cloud’s secrets manager or a password manager. Do not put a token in source code, a committed .env file, a ticket or a chat. Give a job its token as the environment variable SHOWBUG_TOKEN, which the CLI and the MCP bridge both read.
  • Grant the fewest scopes. A token with only read scopes cannot change anything, so it is safe to give to an agent that is exploring. Add write scopes only for the job that needs them.
  • Choose a short expiry. Use the shortest that fits: a few days for a one-off task or an agent session, the 30-day default for routine automation. Put the renewal in a calendar, as an expired token shows up as 401 errors.
  • Use one token per integration. Name it after what uses it. You can revoke one without breaking the others, and the audit log shows which one acted.
  • Revoke what you do not use. A token whose last used time is long ago is a risk with no benefit.
  • If a token leaks, revoke it first. Then create a replacement and read the audit log for events with the old token’s id in via.