# Generate a GitLab API Token

If your GitLab is self-hosted or you simply prefer to connect using a token, you'll first need an access token:

1. In GitLab, navigate to [Access tokens](https://gitlab.com/-/user_settings/personal_access_tokens) in your User settings and click **Add new token.**<br>

   <figure><img src="https://2091741164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvrraExym8pNEUvBDoima%2Fuploads%2FlwsegMO7nKTi7EIU7kmY%2FGitlabToken.png?alt=media&#x26;token=777d3660-eaa4-4f92-b7cc-8ea23dae37c4" alt="" width="375"><figcaption></figcaption></figure>
2. Enter a **Token name** and the latest allowable **Expiration date** (typically one year from token creation)**.**&#x20;
3. Under **Select scopes**, select `api` or `read_api` .
4. Click **Create token,** then copy the token that appears.\ <br>

   <figure><img src="https://2091741164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvrraExym8pNEUvBDoima%2Fuploads%2F4lyLy4Ba0xmoIXD4VoCv%2FGitlabToken-Copy.png?alt=media&#x26;token=5340a12b-ffbd-4ba4-b546-d6ba941592cf" alt="" width="375"><figcaption></figcaption></figure>
5. Back in Violet, navigate to Apps and select <img src="https://2091741164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvrraExym8pNEUvBDoima%2Fuploads%2FcxfqrzhteuJZuB0cqVxw%2Fgitlab.png?alt=media&#x26;token=9e82b8c3-ed93-4706-91b1-974b7e3a3ca3" alt="" data-size="line"> **Gitlab**. Create a new connection, and toggle on **Show other authentication options**. Enter your token and click **Connect with API token.**

<figure><img src="https://2091741164-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FvrraExym8pNEUvBDoima%2Fuploads%2Fz02H3AJNy7uGzVH3gsX8%2FVioletGitlabToken.png?alt=media&#x26;token=99b3875d-3712-4209-b43e-70838a2f2dc5" alt="" width="188"><figcaption></figcaption></figure>

6. Once connected, configure your integration, then click **Create.** You're done!
