---
title: "List all repository branches"
method: GET
path: "/api/v4/projects/{id}/repository/branches"
tags: ["branches"]
---

# List all repository branches

`GET /api/v4/projects/{id}/repository/branches`

## Request

- Base URL: `https://gitlab.com`
- URL: `https://gitlab.com/api/v4/projects/{id}/repository/branches`
- Auth: none declared

Lists all repository branches from a specified project, sorted alphabetically by name. Search by name, or use regular expressions to find specific branch patterns. Returns detailed information about the branch, including its protection status, merge status, and commit details.

## Path parameters

- `id` string, required

## Query parameters

- `page` integer
- `per_page` integer
- `search` string
- `regex` string
- `sort` 'name_asc' | 'updated_asc' | 'updated_desc'
- `page_token` string

## Response `200`

List all repository branches

- APIEntitiesBranch[]
  - `name` string, required
  - `commit` APIEntitiesCommit, required: API_Entities_Commit model
    - `id` string, required
    - `short_id` string, required
    - `created_at` string, date-time, required
    - `parent_ids` string[], required
    - `title` string, required
    - `message` string, required
    - `author_name` string, required
    - `author_email` string, required
    - `authored_date` string, date-time, required
    - `committer_name` string, required
    - `committer_email` string, required
    - `committed_date` string, date-time, required
    - `trailers` object, required
    - `extended_trailers` object, required
    - `web_url` string, required
  - `merged` boolean, required
  - `protected` boolean, required
  - `developers_can_push` boolean, required
  - `developers_can_merge` boolean, required
  - `can_push` boolean, required
  - `default` boolean, required
  - `web_url` string, required

## Other responses

- `404`: 404 Project Not Found

---

[API](https://skmtc.dev/gitlab/apis/gitlab-api.md) - [All operations](https://skmtc.dev/gitlab/apis/gitlab-api/llms.txt) - [OpenAPI document](https://skmtc.dev/gitlab/apis/gitlab-api/revisions/b234947ef3f2?raw)
