# 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="/files/SX5ggmBl6vlGN4b57gag" 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="/files/3c8fP59QSpRBMeIUJb3b" alt="" width="375"><figcaption></figcaption></figure>
5. Back in Violet, navigate to Apps and select <img src="/files/BDMftrAhpR13LsaU19Pm" 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="/files/giJy03nOMgUUrhP2yKdm" alt="" width="188"><figcaption></figcaption></figure>

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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.violetlabs.com/apps/g/gitlab/generate-a-gitlab-api-token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
