Docs
Live demo

Give a CI pipeline a token that does one job

Create a single-purpose custom role and issue a short-lived organization token for CI.

On this page

Before you start: Admin role, or role management and Organization API tokens: change.

  1. In Organizations, click New role under Roles.
  2. Name it (Deploy), tick needed permissions (Rules and templates: apply), click Create role.
  3. In API tokens, create an organization token (CI deploy pipeline).
  4. Pick User, Deploy, short expiry and runner networks.
  5. Store as a masked CI secret.

Other requests return 403. Role edits apply next request.

Through the API#

Role (POST /organizations/{id}/roles, wider than caller returns 403 role_exceeds_caller):

bash
curl -X POST -H "Authorization: Bearer $PRINCIPAL_TOKEN" \
  -H "Content-Type: application/json" \
  https://principal.example.com/api/v2/organizations/$ORG/roles \
  -d '{"name":"Deploy","permissions":["access:read","access:apply"]}'

Token (POST /api-tokens/organization):

json
{"name":"CI deploy pipeline","role":"user",
 "custom_role_id":"<role-id>","expires_at":"2026-12-16T00:00:00Z"}
↑ ↓ to moveEnter to openEsc to close