- List group access tokens
- Get a group access token
- Create a group access token
- Revoke a group access token
Group access tokens API
You can read more about group access tokens.
List group access tokens
Get a list of group access tokens.
GET groups/:id/access_tokens
Attribute | Type | required | Description |
---|---|---|---|
id
| integer or string | yes | ID or URL-encoded path of the group |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/<group_id>/access_tokens"
[
{
"user_id" : 141,
"scopes" : [
"api"
],
"name" : "token",
"expires_at" : "2021-01-31",
"id" : 42,
"active" : true,
"created_at" : "2021-01-20T22:11:48.151Z",
"revoked" : false,
"access_level": 40
}
]
Get a group access token
Get a group access token by ID.
GET groups/:id/access_tokens/:token_id
Attribute | Type | required | Description |
---|---|---|---|
id
| integer or string | yes | ID or URL-encoded path of the group |
token_id
| integer or string | yes | ID of the group access token |
curl --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/<group_id>/access_tokens/<token_id>"
{
"user_id" : 141,
"scopes" : [
"api"
],
"name" : "token",
"expires_at" : "2021-01-31",
"id" : 42,
"active" : true,
"created_at" : "2021-01-20T22:11:48.151Z",
"revoked" : false,
"access_level": 40
}
Create a group access token
Create a group access token.
POST groups/:id/access_tokens
Attribute | Type | required | Description |
---|---|---|---|
id
| integer or string | yes | ID or URL-encoded path of the group |
name
| String | yes | Name of the group access token |
scopes
| Array[String]
| yes | List of scopes |
access_level
| Integer | no | A valid access level. Default value is 40 (Maintainer). Other allowed values are 10 (Guest), 20 (Reporter), and 30 (Developer). |
expires_at
| Date | no | Token expires at midnight UTC on that date |
curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" \
--header "Content-Type:application/json" \
--data '{ "name":"test_token", "scopes":["api", "read_repository"], "expires_at":"2021-01-31", "access_level": 30 }' \
"https://gitlab.example.com/api/v4/groups/<group_id>/access_tokens"
{
"scopes" : [
"api",
"read_repository"
],
"active" : true,
"name" : "test",
"revoked" : false,
"created_at" : "2021-01-21T19:35:37.921Z",
"user_id" : 166,
"id" : 58,
"expires_at" : "2021-01-31",
"token" : "D4y...Wzr",
"access_level": 30
}
Revoke a group access token
Revoke a group access token.
DELETE groups/:id/access_tokens/:token_id
Attribute | Type | required | Description |
---|---|---|---|
id
| integer or string | yes | ID or URL-encoded path of the group |
token_id
| integer or string | yes | ID of the group access token |
curl --request DELETE --header "PRIVATE-TOKEN: <your_access_token>" "https://gitlab.example.com/api/v4/groups/<group_id>/access_tokens/<token_id>"
Responses
-
204: No Content
if successfully revoked. -
400 Bad Request
or404 Not Found
if not revoked successfully.
Help & feedback
Docs
Edit this page to fix an error or add an improvement in a merge request.Create an issue to suggest an improvement to this page.
Product
Create an issue if there's something you don't like about this feature.Propose functionality by submitting a feature request.
to help shape new features.
Feature availability and product trials
to see all GitLab tiers and features, or to upgrade.with access to all features for 30 days.
Get Help
If you didn't find what you were looking for,
search the docs.
If you want help with something specific and could use community support,
.
For problems setting up or using this feature (depending on your GitLab
subscription).