Creates an access token for a project

POST /v4/projects/{id}/access_tokens

Creates an access token for a project

Path parameters

  • id integer | string Required

    The ID or URL-encoded path of the project

Query parameters

  • name string Required

    The name of the project access token

  • scopes array[string] Required

    Defines read and write permissions for the token

    Values are api, read_api, read_registry, write_registry, read_repository, or write_repository.

  • Date when the token expires. Time of day is Midnight UTC of that date.

Responses

POST /v4/projects/{id}/access_tokens
curl \
 -X POST https://gitlab.com/api/v4/projects/{id}/access_tokens?name=string&scopes=api
Response examples (200)
{
  "id": 58,
  "name": "test",
  "token": "D4y...Wzr",
  "active": true,
  "scopes": [
    "api",
    "read_repository"
  ],
  "revoked": false,
  "user_id": 166,
  "created_at": "2021-01-20T14:13:35Z",
  "expires_at": "2022-01-31"
}