GitLab project merge requests
Merge requests of a public gitlab.com project: id, number, title, link, state, author, assignees and reviewers, labels, milestone, source and target branches, dates (created, updated, merged, closed), merged by, merge status, draft flag, votes, comment count and the description (first 4,000 characters). Pass next_page back as page; null on the last page. Pass iid for one merge request with more detail, and include=changes,approvals for its file changes and approvals.
Every response includes credits_used: the credits this call cost.
Parameters
| name | type | description |
|---|---|---|
pathrequired | string | Project path (namespace/project), its gitlab.com link, or the numeric project id. Example: gitlab-org/gitlab-runner |
state | opened | closed | merged | locked | all | opened (default), closed, merged, locked or all. |
q | string | Search words in title and description. |
labels | string | Label names, comma-separated (all must match). |
milestone | string | Milestone title. |
author | string | Author's username. |
assignee | string | Assignee's username. |
created_after | string | ISO 8601 time. |
created_before | string | ISO 8601 time. |
updated_after | string | ISO 8601 time. |
updated_before | string | ISO 8601 time. |
order_by | created_at | updated_at | merged_at | title | label_priority | milestone_due | popularity | priority | Sort field (default created_at). |
sort | desc | asc | desc (default) or asc. |
target_branch | string | Target branch name. |
draft | true | false | true or false. |
page | integer | Page number (default 1). |
limit | integer | Results per page (default 20, max 100). |
iid | integer | One merge request by its number (the number in its URL). The answer then holds it in items and item, with its full reference, number of changed files, conflicts flag, merge and squash commits, diff refs, latest pipeline (status, ref, duration), time tracking and closed by. |
include | string | With iid, comma separated: changes (each changed file: old and new path, new, renamed, deleted or generated flags and the diff, first 20,000 characters per file; up to 100 files) and approvals (approved, approvals required and left, who approved). Each costs one more upstream request. |
Every endpoint also takes fresh, raw, fields (see lean responses and caching).
Example
curl "https://api.api.sh/gitlab/v1/project/merge-requests?path=gitlab-org%2Fgitlab-runner" \
-H "x-api-key: $APISH_KEY" import os, requests
res = requests.get(
"https://api.api.sh/gitlab/v1/project/merge-requests",
params={"path": "gitlab-org/gitlab-runner"},
headers={"x-api-key": os.environ["APISH_KEY"]},
timeout=120,
)
res.raise_for_status()
data = res.json() const url = new URL("https://api.api.sh/gitlab/v1/project/merge-requests");
url.searchParams.set("path", "gitlab-org/gitlab-runner");
const res = await fetch(url, { headers: { "x-api-key": process.env.APISH_KEY } });
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const data = await res.json(); Response
A JSON object with the fields described above, plus raw (the source's own data), cached, fetched_at and credits_used. Errors return {"success": false, "error": "…"} with the HTTP status (see errors). A lookup that ran but found nothing (404) costs the price above; refused calls and errors on our side are free (what's charged).