For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inTry it free
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
DocsGuidesSDKsIntegrationsAPI docsTutorialsFlagship blog
  • REST API overview
    • Access Tokens
    • Account Members
    • Account Usage Beta
    • AI Configs
    • Announcements
    • Applications Beta
    • Approvals
    • Approvals Beta
    • Audit Log
    • Code References
      • POSTCreate extinction
      • POSTCreate repository
      • POSTDelete branches
      • DELDelete repository
      • GETGet branch
      • GETGet code references statistics for flags
      • GETGet links to code reference repositories for each project
      • GETGet repository
      • GETList branches
      • GETList extinctions
      • GETList repositories
      • PATCHUpdate repository
      • PUTUpsert branch
    • Contexts
    • Context Settings
    • Custom Roles
    • Data Export Destinations
    • Environments
    • Experiments
    • Feature Flags
    • Feature Flags Beta
    • Flag Import Configurations Beta
    • Flag Links Beta
    • Flag Triggers
    • Follow Flags
    • Holdouts Beta
    • Insights Charts Beta
    • Insights Deployments Beta
    • Insights Flag Events Beta
    • Insights Pull Requests Beta
    • Insights Repositories Beta
    • Insights Scores Beta
    • Integration Audit Log Subscriptions
    • Integration Delivery Configurations Beta
    • Integrations Beta
    • Layers
    • Metrics
    • Metrics Beta
    • OAuth2 Clients
    • Persistent Store Integrations Beta
    • Projects
    • Relay Proxy Configurations
    • Release Pipelines Beta
    • Releases Beta
    • Scheduled Changes
    • Segments
    • Tags
    • Teams
    • Teams Beta
    • Users
    • Users Beta
    • User Settings
    • Views Beta
    • Webhooks
    • Workflows
    • Workflow Templates
    • Other
Sign inTry it free
LogoLogo
REST API overviewCode References

Get branch

GET
/api/v2/code-refs/repositories/:repo/branches/:branch
GET
/api/v2/code-refs/repositories/:repo/branches/:branch
$curl https://app.launchdarkly.com/api/v2/code-refs/repositories/repo/branches/branch \
> -H "Authorization: <apiKey>"
1{
2 "name": "main",
3 "head": "a94a8fe5ccb19ba61c4c0873d391e987982fbbd3",
4 "syncTime": 1636558831870,
5 "_links": {},
6 "updateSequenceId": 25,
7 "references": [
8 {
9 "path": "/main/index.js",
10 "hunks": [
11 {
12 "startingLineNumber": 45,
13 "lines": "var enableFeature = 'enable-feature';",
14 "projKey": "default",
15 "flagKey": "enable-feature",
16 "aliases": [
17 "enableFeature",
18 "EnableFeature"
19 ]
20 }
21 ],
22 "hint": "javascript"
23 }
24 ]
25}
Get a specific branch in a repository.
Was this page helpful?
Previous

Get code references statistics for flags

Next
Built with

Authentication

Authorizationstring
API Key authentication via header

Path parameters

repostringRequiredformat: "string"
The repository name
branchstringRequiredformat: "string"

The url-encoded branch name

Query parameters

projKeystringOptionalformat: "string"
Filter results to a specific project
flagKeystringOptionalformat: "string"
Filter results to a specific flag key

Response

Branch response
namestring
The branch name
headstring
An ID representing the branch HEAD. For example, a commit SHA.
syncTimelong
A timestamp indicating when the branch was last synced
_linksmap from strings to any
The location and content type of related resources
updateSequenceIdlong
An optional ID used to prevent older data from overwriting newer data
referenceslist of objects
An array of flag references found on the branch

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
429
Too Many Requests Error