> For the complete documentation index, see [llms.txt](https://docs.octoxlabs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.octoxlabs.com/adapters/g/gitlab-codes.md).

# Gitlab Codes

This adapter reads the projects of a GitLab instance. For each project it collects branches, merge requests, issues, members, contributors, languages, license and key files. The result appears in the Source Code inventory. The same connector is also published as [Gitlab Codes Self-Hosted](broken://pages/6760039756e2f714442212942a507e3404e15c83).

## Use cases

* List all GitLab projects.

```
Adapters = gitlab-codes
```

* Find archived projects.

```
Adapters = gitlab-codes AND IsArchived = true
```

* Find projects that are publicly visible.

```
Adapters = gitlab-codes AND Visibility = public
```

## Before you begin

### Network

| Source              | Destination | Port                        | Protocol                           |
| ------------------- | ----------- | --------------------------- | ---------------------------------- |
| OctoXLabs connector | GitLab host | 443 (default, configurable) | HTTPS (HTTP when Is secure is off) |

### Required permissions

| Scope or role                          | Permission | Needed for       |
| -------------------------------------- | ---------- | ---------------- |
| Personal access token scope `read_api` | Read       | All project data |

The token only sees the projects that its owner can access.

## Create credentials in GitLab

{% stepper %}
{% step %}

### Open the access tokens page

Select **Edit Profile** from your avatar icon, then open the **Access Token** page.
{% endstep %}

{% step %}

### Create the token

Click **Add New Token**, give it the **read\_api** scope and create it. Copy the token.
{% endstep %}
{% endstepper %}

## Connection parameters

| Parameter             | Required | Type             | Default | Description                                                       |
| --------------------- | -------- | ---------------- | ------- | ----------------------------------------------------------------- |
| Ip                    | Yes      | Text             | None    | IP address or domain of the GitLab host.                          |
| Port                  | No       | Integer          | 443     | Port number.                                                      |
| Personal access token | Yes      | Text (sensitive) | None    | The token.                                                        |
| Is secure             | No       | Boolean          | True    | Use SSL.                                                          |
| Thread count          | No       | Integer          | 32      | Parallel threads. Minimum 1, maximum 32. Advanced.                |
| Sleep time            | No       | Integer          | 0       | Seconds between thread batches. Increase it on rate limit errors. |

## Troubleshooting

| Error message                                                         | Cause                     | Fix                                                 |
| --------------------------------------------------------------------- | ------------------------- | --------------------------------------------------- |
| `Rate limit exceeded for URL: <url>. Retrying after 15 second.` (log) | GitLab answered HTTP 429. | No action needed. Lower Thread count if it repeats. |

## Change history
