---
title: "List branches"
method: GET
path: "/api/v2/code-refs/repositories/{repo}/branches"
tags: ["Code references"]
---

# List branches

`GET /api/v2/code-refs/repositories/{repo}/branches`

Get a list of branches.

## Path parameters

- `repo` string, string, required — The repository name

## Response `200`

Branch collection response

- BranchCollectionRep
  - `_links` object, required — The location and content type of related resources
  - `items` BranchRep[], required — An array of branches
    - `name` string, required — The branch name
    - `head` string, required — An ID representing the branch HEAD. For example, a commit SHA.
    - `updateSequenceId` integer — An optional ID used to prevent older data from overwriting newer data
    - `syncTime` integer, required
    - `references` ReferenceRep[] — An array of flag references found on the branch
      - `path` string, required — File path of the reference
      - `hint` string — Programming language used in the file
      - `hunks` HunkRep[], required
        - `startingLineNumber` integer, required — Line number of beginning of code reference hunk
        - `lines` string — Contextual lines of code that include the referenced feature flag
        - `projKey` string — The project key
        - `flagKey` string — The feature flag key
        - `aliases` string[] — An array of flag key aliases
    - `_links` object, required — The location and content type of related resources

## Other responses

- `400` — Invalid request
- `401` — Invalid access token
- `403` — Forbidden
- `404` — Invalid resource identifier
- `429` — Rate limited

---

[API](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api.md) · [All operations](https://skmtc.dev/launchdarkly/apis/launchdarkly-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/launchdarkly/launchdarkly-rest-api/revisions/69c5c9aafe78/schema)
