Create a personal access token for a group service account
POST
/api/v4/groups/{id}/service_accounts/{user_id}/personal_access_tokens
Creates a personal access token for a specified group service account. Available only for group Owners and administrators. This feature was introduced in GitLab 16.1.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Media typeapplication/json
object
name
required
The name of the access token
string
Example
My tokendescription
The description of the access token
string
Example
A token used for k8sexpires_at
Expiration date of the access token in ISO format (YYYY-MM-DD). If undefined, the date is set to the maximum allowable lifetime limit.
string format: date
Example
2021-01-31scopes
required
The array of scopes of the personal access token
Array<string>
Responses
Section titled “Responses”Created
Media typeapplication/json
object
id
integer format: int64
name
string
revoked
boolean
created_at
string format: date-time
description
string
scopes
array
user_id
integer format: int64
last_used_at
string format: date-time
active
boolean
granular
boolean
expires_at
string format: date-time
token
string
granular_scopes
Array<object>
object
access
string
permissions
array
project_id
integer format: int64
group_id
integer format: int64
Example
{ "id": 2, "name": "John Doe", "description": "Token to manage api", "scopes": [ "api" ], "user_id": 3, "last_used_at": "2020-08-31T15:53:00.073Z", "expires_at": "2020-08-31T15:53:00.073Z", "granular_scopes": [ { "access": "personal_projects", "permissions": [ "read_job" ], "project_id": 3, "group_id": 5 } ]}Bad Request
Not Found