- Creating a project access token
- Project bot users
- Revoking a project access token
- Limiting scopes of a project access token
Project access tokens are scoped to a project and can be used to authenticate with the GitLab API.
You can also use project access tokens with Git to authenticate over HTTP or SSH.
Project access tokens expire on the date you define, at midnight UTC.
For examples of how you can use a project access token to authenticate with the API, see the following section from our API Docs.
- Log in to GitLab.
- Navigate to the project you would like to create an access token for.
- In the Settings menu choose Access Tokens.
- Choose a name and optional expiry date for the token.
- Choose the desired scopes.
- Click the Create project access token button.
- Save the project access token somewhere safe. Once you leave or refresh the page, you won’t be able to access it again.
For each project access token created, a bot user will also be created and added to the project with “Maintainer” level permissions. API calls made with a project access token will be associated to the corresponding bot user.
These users will appear in Members but can not be modified. Furthermore, the bot user can not be added to any other project.
At any time, you can revoke any project access token by clicking the respective Revoke button in Settings > Access Tokens.
Project access tokens can be created with one or more scopes that allow various actions that a given token can perform. The available scopes are depicted in the following table.
|Grants complete read/write access to the scoped project API.|
|Grants read access to the scoped project API.|
|Allows read-access (pull) to container registry images if a project is private and authorization is required.|
|Allows write-access (push) to container registry.|
|Allows read-only access (pull) to the repository.|
|Allows read-write access (pull, push) to the repository.|
Project access tokens is an Alpha feature and is not recommended for production use. It is deployed behind a feature flag that is disabled by default. GitLab administrators with access to the GitLab Rails console can enable it for your instance.
To enable it:
To disable it: