Skip to main content
GET
/
api
/
github
/
branches
curl --location 'https://cloud.blackbox.ai/api/github/branches?owner=example-user&repo=example-repo' \
--header 'Authorization: Bearer bb_YOUR_API_KEY'
[
    {
        "name": "main",
        "protected": true,
        "isDefault": true
    },
    {
        "name": "feature/new-api",
        "protected": false,
        "isDefault": false
    },
    {
        "name": "develop",
        "protected": true,
        "isDefault": false
    },
    {
        "name": "hotfix/security-patch",
        "protected": false,
        "isDefault": false
    }
]
This endpoint returns a list of all branches in a specified GitHub repository, including branch names, protection status, and default branch information.

Authentication

To use this API, you need a BLACKBOX API Key. Follow these steps to get your API key:
  1. Click on your Profile Image in the top right corner at cloud.blackbox.ai
  2. Click on “BLACKBOX API Token” from the dropdown menu
  3. Copy the existing token or click “Generate” if you don’t have one yet
Your API key will be in the format: bb_xxxxxxxxxxxxxxxxxxxxxx

Headers

Authorization
string
required
API Key of the form Bearer <api_key>.Example: Bearer bb_b41b647ffbfed27f61656049d3eaeef3d903cc503345d9eb80080d98bc0

Query Parameters

owner
string
required
The GitHub username or organization name that owns the repository.Example: example-user or example-org
repo
string
required
The repository name from which to retrieve branches.Example: example-repo

Response

The endpoint returns an array of branch objects.
name
string
The name of the branch.
protected
boolean
Whether the branch is protected from force pushes and deletion.
isDefault
boolean
Whether this is the default branch of the repository (typically main or master).
curl --location 'https://cloud.blackbox.ai/api/github/branches?owner=example-user&repo=example-repo' \
--header 'Authorization: Bearer bb_YOUR_API_KEY'
[
    {
        "name": "main",
        "protected": true,
        "isDefault": true
    },
    {
        "name": "feature/new-api",
        "protected": false,
        "isDefault": false
    },
    {
        "name": "develop",
        "protected": true,
        "isDefault": false
    },
    {
        "name": "hotfix/security-patch",
        "protected": false,
        "isDefault": false
    }
]