> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/code-scanning/connect-your-source-code/connect-gitlab-account-to-aikido/code-scanning-with-a-service-account-access-token.md).

# Code Scanning with a Service Account Access Token

### ⚠️ Disclaimer

This guide is only available for **Gitlab Premium &** **Gitlab Ultimate** users. Check out our the setup with [personal access tokens](/code-scanning/connect-your-source-code/connect-gitlab-account-to-aikido/code-scanning-with-a-personal-access-token.md) for **Gitlab Free** users

### Introduction

You can use service account tokens which Aikido uses to perform the code scanning. You can update this token on the [update workspace access token](https://app.aikido.dev/onboarding/gitlab/update-workspace-access-token) page.

### Creating a Service Account and Access Token <a href="#creating-a-personal-access-token" id="creating-a-personal-access-token"></a>

1. Navigate to the "Service Accounts" settings page. Group > Settings > Service accounts

   <figure><img src="/files/Vo8925b18zVaSjQhmWBv" alt="Gitlab group sidebar: highlighting &#x22;Service accounts&#x22; under the &#x22;Settings&#x22; option"><figcaption></figcaption></figure>
2. Click on "**Add service account**"
3. Give a **Name** and **Username** to the Service Account and click **Create**
4. Click the options of the newly created service account and select **Manage access tokens**

   <figure><img src="/files/6UsjHXcsaZJZiRbADtmb" alt="Gitlab Service Accounts overview"><figcaption></figcaption></figure>
5. Click on "**Add new token**"
6. Enter a name for the token, remove the expiration date or set it to the max value and select the **api** scope

   <figure><img src="/files/HGyT92eWZvCwD0f8BKnT" alt=""><figcaption></figcaption></figure>
7. Click on "**Create token**"

   <figure><img src="/files/wqIAuVBmpfkgaGEXdFuX" alt=""><figcaption></figcaption></figure>
8. Copy the token and keep it for the "[update workspace access token](https://app.aikido.dev/onboarding/gitlab/update-workspace-access-token)" page
9. Go to the members page: **Group** > **Manage** > **Members**

   <figure><img src="/files/EQwPHUdhnjgr7l9Qo9ny" alt="Gitlab Group sidebar; showing members under the manage option"><figcaption></figcaption></figure>
10. Click "**Invite Members**"
11. Search for your new Service account created earlier and set role to "**Maintainer**"

    <figure><img src="/files/sknOKeI1Oyb65Onc2jBa" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/code-scanning/connect-your-source-code/connect-gitlab-account-to-aikido/code-scanning-with-a-service-account-access-token.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
