home | help
glab(1) 								 glab(1)

NAME
     glab-service-account-token-create - Create a token for a service account.

SYNOPSIS
     glab service-account token create	 [flags]

DESCRIPTION
     Create  a	personal  access  token  for a service account of a project or a
     group.

     * The token value is printed only once and cannot be retrieved later. It is
       the only output on stdout, and the token details go to stderr.

     * At least one scope is  required.  For  the  scopes  you	can  grant,  see
       https://docs.gitlab.com/security/tokens/access_token_scopes/.

     * The token expires after --duration, 30 days by default, at 00:00 UTC. Use
       --expires-at for a specific date instead.

     * A numeric account argument is always treated as an ID.

OPTIONS
     --description=""	   Description of the token.

     -D,  --duration=30d       Sets  the  token  lifetime in days. Accepts: days
     (30d), weeks (4w), or hours in multiples of 24 (24h, 168h, 720h).	Maximum:
     365d. The token expires at midnight UTC on the calculated date.

     -E,  --expires-at=       Expiry date of the token, as YYYY-MM-DD. The token
     expires at midnight UTC on that date.

     -g, --group=""	 Create a token for a service account of a group instead
     of a project. Accepts a group ID or full path.

     --jq=""	  Filter JSON output with a jq expression.

     -F, --output="text"      Format output  as  'text'  for  the  token  value,
     'json' for the token with its details.

     -R, --repo=""	Select another repository. You can use either OWNER/REPO
     or GROUP/NAMESPACE/REPO. The full URL or Git URL is also accepted.

     -S, --scope=[]	 Scope to grant the token. Multiple scopes can be comma-
     separated or specified by repeating the flag.

OPTIONS INHERITED FROM PARENT COMMANDS
     -h, --help[=false]      Show help for this command.

EXAMPLE
     # Create a token for service account 42 of the current project
     glab service-account token create 42 ci --scope api

     # Create a read-only token that expires in a week, finding the account by its username
     glab service-account token create release-bot ci-reader --scope read_api,read_repository --duration 7d

     # Create a token for a group's service account that expires at the end of 2027
     glab service-account token create 42 deploy --scope api --expires-at 2027-12-31 --group my-group

     # Create a token and store its value in a variable
     TOKEN=$(glab service-account token create 42 ci --scope api)

SEE ALSO
     glab-service-account-token(1)

Auto generated by spf13/cobra	    Nov 2026				 glab(1)

home | help