API tokens
What is it for
Section titled “What is it for”An API token lets a script or a CI pipeline use the REST API without a browser session: create monitors from Terraform-like tooling, pause monitors during a deploy, list incidents for a report.
When to use it
Section titled “When to use it”Use tokens for automation. Use your normal sign-in for everything else. Tokens are a plan feature: Free none, Pro 5, Enterprise 50.
Create a token
Section titled “Create a token”You need the admin role. Choose:
| Field | Rule |
|---|---|
| Name | 1 to 80 characters. |
| Role | viewer, member or admin. Never higher than your own role. The token can only do what that role can, see Members and roles. |
| Expires in | 1 to 365 days, or empty for no expiry. |
The secret looks like cb_pat_.... It is shown once. CronBeat stores only a hash and a short prefix to
recognise the token in the list. Put it in your secret store, never in a repository.
A token belongs to one project and cannot be used for another one.
Use it
Section titled “Use it”curl -sS https://api.cronbeat.dev/api/monitors \ -H "Authorization: Bearer cb_pat_YOUR_TOKEN"No CSRF token is needed with a Bearer token.
What tokens can reach
Section titled “What tokens can reach”Only these paths: /api/monitors, /api/channels, /api/maintenance-windows, /api/status-pages,
/api/incidents, /api/agents, /api/schedule/preview and /api/project. Anything else (members, invitations,
other tokens, the audit log, billing, account, projects list) answers 403 with API tokens cannot use this endpoint. A token therefore cannot manage members, billing, the account or other tokens. The role of the token
still applies on the paths it can reach, for example a member token cannot create channels.
Example: post an incident from a pipeline
Section titled “Example: post an incident from a pipeline”A token with the admin role can post status page incidents, manage
maintenance windows and more, for example from a deploy job:
curl -sS -X POST https://api.cronbeat.dev/api/status-pages/PAGE_ID/incidents \ -H "Authorization: Bearer cb_pat_YOUR_TOKEN" \ -H "Content-Type: application/json" \ -d '{"title": "Deploy in progress", "impact": "none", "status": "monitoring", "message": "Short interruptions are possible."}'Records a token creates have no creator person, the audit log shows API token.
Revoke
Section titled “Revoke”Revoke a token in the app (or DELETE /api/api-tokens/{id}, which needs a signed-in admin) and it stops working at
once. Revoke immediately if a token leaks, then create a new one. Expired tokens are rejected as well. The list
shows the prefix, the role, the expiry and when the token was last used.
What happens when
Section titled “What happens when”| Situation | Result |
|---|---|
| The token is unknown, revoked or expired | 401 with Invalid or expired API token. |
| It calls a path outside the list | 403. |
It sends an X-Project-Id of another project |
404. |
| A member changes something with a token | The audit log (Enterprise) shows the actor as API token. |
| The token expires | It stops working at once, does not count against the plan limit and is deleted 30 days after it expired. |
| You revoke a token | It is deleted at once. |
| The plan allows fewer tokens | Only the oldest tokens that fit the new limit keep working, the others answer 401. Free has 0, so none work. Nothing is deleted, upgrading again brings them back. Creating new ones beyond the limit is refused. |

