Skip to main content
Retrieve branches in a repository with pagination.
GET /api/v1/repos/branches?cursor=CURSOR&limit=20
Authorization: Bearer YOUR_JWT_TOKEN

Parameters

ParameterTypeDescription
cursorOptionalPagination cursor from previous response
limitOptionalMaximum number of branches to return (default: 20)

JWT Requirements

  • The JWT must include the repository in the repo claim
  • Requires git:read scope

Response

{
  "branches": [
    {
      "cursor": "b_123abc",
      "name": "main",
      "head_sha": "a1b2c3d4e5f6...",
      "created_at": "2024-01-15T10:30:00Z"
    },
    {
      "cursor": "b_456def",
      "name": "feature/auth",
      "head_sha": "f6e5d4c3b2a1...",
      "created_at": "2024-01-16T14:20:00Z"
    }
  ],
  "next_cursor": "b_456def",
  "has_more": true
}

Notes

  • The cursor field is an opaque pagination token for each branch
  • The next_cursor value should be used for fetching the next page
  • Branches are ordered by creation time

Error Responses

StatusDescription
401 UnauthorizedInvalid JWT or missing git:read scope