Skip to content

API tokens

Scripts, CI and AI agents use API tokens instead of a person’s password. Create one in Settings › API tokens, then send it as a bearer token to any /api route its role allows:

curl -H "Authorization: Bearer bsk_…" https://bullship.example.com/api/connections

The token is shown once, when you make it. Bullship stores only its SHA-256 hash, in auth.db.

A token is a viewer or an operator, never an admin. Connections, alert destinations, settings and people stay with people who are signed in, and a token can’t make or revoke tokens.

  • Everyone makes their own tokens, at most their own role.
  • A token never acts above its owner’s current role: demoting someone demotes their tokens, and removing them revokes their tokens.
  • Admins see everyone’s tokens and can make service tokens, which belong to the instance rather than to a person.
  • Tokens expire after 30, 90 or 365 days, or never.

Every change a token makes is in Settings › Activity, as “Ada via token “ci””.

A token that is wrong, expired or revoked answers 401; a token below the role a route needs answers 403:

curl -H "Authorization: Bearer bsk_nope" https://bullship.example.com/api/connections
# {"error":"This API token is wrong, expired or revoked"}

Read the queue list of the connection production as JSON, with a viewer token:

curl -H "Authorization: Bearer $BULLSHIP_TOKEN" \
https://bullship.example.com/api/c/production/queues

Retry the failed jobs in the email queue from CI, with an operator token (up to 1,000 a call, like the app’s bulk actions):

curl -X POST -H "Authorization: Bearer $BULLSHIP_TOKEN" \
"https://bullship.example.com/api/c/production/queues/email/bulk/retry?state=failed"

Draining a queue or obliterating it also needs the queue’s name in the body, so a mistyped URL can’t delete the wrong queue:

curl -X POST -H "Authorization: Bearer $BULLSHIP_TOKEN" -H "Content-Type: application/json" \
-d '{"confirm":"email"}' \
https://bullship.example.com/api/c/production/queues/email/bulk/drain

Heavy reads such as job filters are capped per caller: past 8 waiting on a connection, a request gets 429 with Retry-After. Wait that many seconds and try again.

The connection id is in the app’s URLs (#/c/<id>/…) and in GET /api/connections.

The same tokens connect AI agents over MCP and Prometheus to /api/metrics.

With BULLSHIP_AUTH=false or viewer, the API needs no token and none can be made.