API Directory › 🛠️ Developer Tools › GitLab API
No authHTTPSCORS

GitLab API

Manage projects, issues, merge requests and CI/CD on GitLab.

Auth
No auth needed
HTTPS
Yes
CORS
Yes
Open GitLab API docs ↗

What it does

The GitLab API (v4, REST) manages projects, groups, issues, merge requests, pipelines, the container and package registries, users and more — on gitlab.com or any self-managed instance. A GraphQL API is also available.

Base URL

https://gitlab.com/api/v4

Authentication

Create a personal, project or group access token in your settings. Send it as PRIVATE-TOKEN: YOUR_TOKEN or Authorization: Bearer YOUR_TOKEN. Some read endpoints on public projects work unauthenticated. For a self-managed instance, swap the host in the base URL.

Code examples

curl
curl -H "PRIVATE-TOKEN: $GITLAB_TOKEN" \
  "https://gitlab.com/api/v4/projects/gitlab-org%2Fgitlab/issues?per_page=5"
Python
import requests

r = requests.get(
    "https://gitlab.com/api/v4/projects",
    headers={"PRIVATE-TOKEN": TOKEN},
    params={"membership": "true", "per_page": 20},
    timeout=10)
print([p["path_with_namespace"] for p in r.json()])

Rate limits & quotas

gitlab.com enforces per-user and per-IP limits — authenticated API traffic is roughly 2,000 requests/minute, unauthenticated far lower, with stricter caps on expensive endpoints. Self-managed instances set their own. Watch RateLimit-Remaining and Retry-After headers.

Key response fields

idNumeric project/issue id — or URL-encode the path (group%2Fproject)
path_with_namespacee.g. gitlab-org/gitlab
iidInternal id — the number shown in the UI for issues/MRs
Link header + <code>x-total</code>Pagination and total count

Common errors

401Missing or invalid token.
403Token lacks the required scope (e.g. api vs read_api).
404Also returned for private resources you can’t see (GitLab hides existence).
429Rate limited — honour Retry-After.

When to use it (and alternatives)

Use it for GitLab-hosted code and CI/CD automation. The concepts mirror the GitHub API but note GitLab’s iid vs id distinction and the URL-encoded project path trick.

FAQ

How do I reference a project without knowing its numeric id?

URL-encode the full path: gitlab-org/gitlab becomes gitlab-org%2Fgitlab. Use that anywhere the docs show :id.

What is the difference between id and iid?

id is globally unique across the instance; iid is the per-project number users see (issue #42). Most project-scoped endpoints take iid.

Does this work with a self-hosted GitLab?

Yes — replace gitlab.com in the base URL with your instance host. The API surface is the same, subject to your version.

New to APIs?

Short guides for working with this API — and any other.

🛠️ Handy LarzOS tools

Free tools to help you work with this API.

JSON FormatterJWT DecoderBase64

Related Developer Tools APIs

← Back

More Developer Tools APIs · All 196 APIs