# Get the merge queue

> A repository's merge queue: the pull requests waiting to land, in order, each with the state it is being tested in (the default branch with the pull requests ahead of it merged in) and how that went; then those that recently landed or left.

<div class="g1t-endpoint"><span class="g1t-method" data-method="get">GET</span><code>/repos/{owner}/{name}/queue</code></div>

With the queue on, merging a pull request adds it here.

An entry's `state` is `waiting`, `testing`, `passed`, `failed`, `landed` or `removed`. `active` is in queue order; `recent` holds at most 20, newest first.

- **Authentication:** Optional. Public data can be read without a token; send one to see what is private.
- **MCP tool:** [`pull_request`](/reference/mcp/#pull_request) with `action` `merge_queue`, and the same inputs
- **Scope:** An access token needs [`pull_requests:read`](/guides/authentication/#scopes).

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `owner` | string | Yes | The workspace that owns the repository. |
| `name` | string | Yes | The repository's name. |

## Example request

```sh
curl https://api.g1t.sh/repos/flagon-io/hello/queue \
  -H "Authorization: Bearer $G1T_TOKEN"
```

## Example response

A successful request answers `200` with:

```json
{
  "enabled": true,
  "active": [
    {
      "id": "qen_01m43rn0qsft1tpap1awkewzbb",
      "number": 14,
      "title": "Greeting should name the caller",
      "agent": "claude-code",
      "state": "testing",
      "ahead": [],
      "base_commit": "3a7e9c1b5d2f4a6c8e0b2d4f6a8c0e2b4d6f8a1c",
      "combined_commit": null,
      "error": null,
      "results": [],
      "enqueued_by": "syntaqx",
      "created_at": "2026-10-04T15:31:20.441Z",
      "finished_at": null
    }
  ],
  "recent": [
    {
      "id": "qen_01m43khqjmeb5a1magayrnk63z",
      "number": 11,
      "title": "Fix trailing newline in greeting",
      "agent": "g1t-agent",
      "state": "landed",
      "ahead": [],
      "base_commit": "4b1d7e9c2a5f8e3d6c0b9a7e5d3c1b8a6f4e2d0c",
      "combined_commit": "c3e8a1f6d4b2097e5c3a1f8d6b4e2c0a9f7d5b3e",
      "error": null,
      "results": [
        {
          "command": "cargo test",
          "passed": true,
          "exit_code": 0,
          "output": "test result: ok. 12 passed; 0 failed\n",
          "duration_ms": 48211
        }
      ],
      "enqueued_by": "g1t",
      "created_at": "2026-10-04T14:02:09.876Z",
      "finished_at": "2026-10-04T14:09:55.102Z"
    }
  ]
}
```

## Errors

A failed request answers with one of these statuses and a body like `{"error": {"code": "not_found", "message": "Repository not found."}}`. See [errors](/reference/api/#errors).

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthenticated` | A token is required, or the one sent is not valid. |
| 403 | `forbidden` | The token is valid but not allowed to do this, such as a member-only change or an agent token outside its repository. |
| 404 | `not_found` | It does not exist, or you cannot see it. |
| 422 | `invalid` | The input is not valid. `message` says which field and why. |
