Skip to content

API tokens for CI

An API token lets a CI job or script use Suta on its own. It belongs to one workspace and gets its permissions from a role.

You need to be an admin.

  1. Go to Settings > API tokens and select Create token.

  2. Enter a Name, such as GitHub Actions, and choose a Role. Pick the role with the least access the job needs; Viewer is the default.

  3. Choose when it Expires: in 30 days, 90 days or 1 year. Never is possible but not recommended.

  4. Create the token, then select Copy token. Suta shows the token only once, so store it in your CI secrets straight away.

Set SUTA_TOKEN and run the CLI as usual:

Terminal window
SUTA_TOKEN="$SUTA_CI_TOKEN" suta device list --json

To update devices from a release pipeline, start a rollout and wait for it. The command fails if the rollout pauses, is cancelled or any device fails:

Terminal window
SUTA_TOKEN="$SUTA_CI_TOKEN" suta rollout start --tag site-london --wait

The token replaces any saved login for that command and always uses its own workspace. While it’s set, suta auth login, suta auth logout and suta workspace use are refused.

To call the API directly, send the token as a bearer token:

Terminal window
curl -H "Authorization: Bearer $SUTA_CI_TOKEN" https://app.suta.dev/v1/organizations

A token can do what its role allows, for these tasks only:

  • List and read devices, rename and tag them, and remove them.
  • Read monitoring data and logs, and change monitoring settings.
  • List reported services.
  • Update the agent on a device, and start and control rollouts.
  • Read activity, operation history and alerts.

Tokens can’t open terminals, run commands, open remote access, or change settings, people, roles, webhooks or other tokens. Those need a person. Everything a token does is recorded in Activity under the token’s name.

Editing the token’s role changes what it can do straight away. To stop a token, find it in Settings > API tokens, select Revoke, then Revoke token. It stops working on its next request.