Create a replacement for one job
For a planned rotation, create the replacement while the old token is still active. This gives you time to test the new credential before swapping the runner secret. If a credential was exposed, revoke it first in Account → AI agents.
Open Account → AI agents with a verified account and give the new token a name that identifies its consumer, such as release-ci-production. For a job that requests deploys and checks the result, select the target deployment and grant read and deploy. A status-only job needs read. A separate job that links a CLI workspace and uploads files needs read and manage. Choose an expiry and store the replacement in the runner’s secret manager. Developer access and permissions.
Prove the new token sees only its intended deployment
Run these two read requests with the replacement value loaded privately as BH_API_TOKEN. Set BH_PORTAL_URL to the HTTPS dashboard origin and BH_DEPLOYMENT_ID to the public ID you selected. The example checks a release token with exactly two scopes and one deployment. Each command prints true when its check passes.
set -euo pipefail
api() {
printf 'Authorization: Bearer %s\n' "$BH_API_TOKEN" |
curl --proto '=https' --silent --show-error --fail-with-body --max-time 30 --header @- "$BH_PORTAL_URL/api/v1/$1"
}
api me | jq -e '(.scopes | sort) == ["deploy", "read"]'
api deployments | jq -e --arg id "$BH_DEPLOYMENT_ID" '[.deployments[].id] == [$id]'A 401 response means the credential may be missing, expired, invalid or revoked. Check which secret the runner loaded and which dashboard it called. For an unexpected scope or deployment, review the selection on the token you created. Keep the credential in the runner that needs it and share only the error code when asking for help.
Switch the runner secret and revoke the old token
- Update the runner’s
BH_API_TOKENsecret and repeat the read checks from the job itself. - Watch the next approved deployment run and verify its outcome. The GitHub Actions guide shows how to check the active commit.
- Revoke the old token in Account → AI agents, then remove any previous copies from your secret manager. Use the token names and last-used times to identify the right entry.
A nonempty BH_API_TOKEN takes precedence over saved browser access in the CLI. For a local CLI session or an MCP client that uses OAuth, review the browser grant in Account → AI agents and reconnect with the desired permissions. The account grant controls developer access. App credentials such as Slack or Discord tokens are managed separately in the deployment’s Variables. MCP connection setup.