create-service-account-token
dci create-service-account-token [body] [flags]
Mints an API token for the service account and returns its accessToken once. The token
inherits the service account's permissions as they stand at creation; there is no per-token
scoping. Returns 409 when the service account already has a token of the same name, and
422 at the cap of 10 tokens.
dryRun=true checks the name bounds only, then returns a preview without creating anything.
It does not verify that the service account exists, that the name is unused, or that the
account is under the token cap, so a dry run can succeed where the real create then returns
404, 409 or 422. Requires the serviceAccountCreator permission.
Pass the request body as name: value arguments or pipe JSON on stdin — see Command structure.
The accessToken in the create response is the credential that authenticates as the service
account. It is returned only by this operation and can never be retrieved again, so store it
somewhere safe on receipt and treat it like a password. Later get and list calls never
include it; if it is lost, create a new token and delete the old one.
name is required (1-100 characters, no leading or trailing whitespace) and unique among
the account's tokens (409). The token inherits the service account's permissions as they
stand at creation; there is no per-token scoping. An account holds at most 10 tokens (422
at the cap). Requires the serviceAccountCreator permission, and the API requires an
Idempotency-Key on every real call.
--dry-run sends the API's dryRun=true, which checks only the name bounds: it does not
verify that the service account exists, that the name is unused, or that the account is
under the cap, so a dry run can succeed where the real create returns 404, 409 or 422.
The preview response has accessToken as an empty string.
Examples
# Mint a token that expires on a given date. Run it with --output json and store the `accessToken` in a secret manager at once.
dci create-service-account-token <service-account-id> name: ci-pipeline-prod, expiresTime: "2027-09-01T08:00:00Z" --idempotency-key "$(uuidgen)" --output json
# Mint a token with the server's default expiry.
dci create-service-account-token <service-account-id> name: ci-pipeline-prod --idempotency-key "$(uuidgen)"
# Check the name server-side first; nothing is created.
dci create-service-account-token <service-account-id> name: ci-pipeline-prod --dry-run