Get a project repository branches

GET /projects/{id}/repository/branches

Get a project repository branches

Path parameters

  • id string Required

    The ID or URL-encoded path of the project

Query parameters

  • page integer(int32)

    Current page number

    Default value is 1.

  • per_page integer(int32)

    Number of items per page

    Default value is 20.

  • regex string

    Return list of branches matching the regex

  • sort string

    Return list of branches sorted by the given field

    Values are name_asc, updated_asc, or updated_desc.

  • page_token string

    Name of branch to start the pagination from

Responses

  • 200 application/json

    Get a project repository branches

    Hide response attributes Show response attributes object
    • name string
    • commit object
      Hide commit attributes Show commit attributes object
      • id string
      • short_id string
      • created_at string(date-time)
      • parent_ids array[string]
      • title string
      • message string
      • author_name string
      • author_email string
      • authored_date string(date-time)
      • committer_name string
      • committer_email string
      • committed_date string(date-time)
      • trailers object
      • web_url string
    • merged boolean
    • protected boolean
    • developers_can_push boolean
    • developers_can_merge boolean
    • can_push boolean
    • default boolean
    • web_url string
  • 404

    404 Project Not Found

GET /projects/{id}/repository/branches
curl \
 --request GET 'https://www.gitlab.com/api/v4/projects/{id}/repository/branches' \
 --header "Private-Token: $API_KEY"
Response examples (200)
[
  {
    "name": "master",
    "commit": {
      "id": "2695effb5807a22ff3d138d593fd856244e155e7",
      "short_id": "2695effb",
      "created_at": "2017-07-26T11:08:53+02:00",
      "parent_ids": [
        "2a4b78934375d7f53875269ffd4f45fd83a84ebe"
      ],
      "title": "Initial commit",
      "message": "Initial commit",
      "author_name": "John Smith",
      "author_email": "john@example.com",
      "authored_date": "2012-05-28T04:42:42-07:00",
      "committer_name": "Jack Smith",
      "committer_email": "jack@example.com",
      "committed_date": "2012-05-28T04:42:42-07:00",
      "trailers": "{ \"Merged-By\": \"Jane Doe janedoe@gitlab.com\" }",
      "web_url": "https://gitlab.example.com/janedoe/gitlab-foss/-/commit/ed899a2f4b50b4370feeea94676502b42383c746"
    },
    "merged": true,
    "protected": true,
    "developers_can_push": true,
    "developers_can_merge": true,
    "can_push": true,
    "default": true,
    "web_url": "https://gitlab.example.com/Commit921/the-dude/-/tree/master"
  }
]