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

# Get branch

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

Get a specific branch in a repository.

## Path parameters

- `repo` string, string, required — The repository name
- `branch` string, string, required — The url-encoded branch name

## Query parameters

- `projKey` string, string — Filter results to a specific project
- `flagKey` string, string — Filter results to a specific flag key

## Response `200`

Branch response

- BranchRep
  - `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)
