GitHub Integration
List Branches
List branches for a GitHub repository. Optionally filter to protected branches only.
GET
This endpoint returns all branches for a given GitHub repository, along with the repository’s default branch. Use the
protected_only parameter to filter to branches with branch protection rules enabled.
This endpoint requires a Pro subscription and a connected GitHub account.
Authentication
To use this API, you need a BLACKBOX API Key. Follow these steps to get your API key:- Go to app.blackbox.ai/agent-api and click Get an API Key (requires a Pro subscription)
- Once provisioning completes, you will be redirected to your Dashboard
- From the Dashboard, create an API key to use with all Agent API requests
sk-xxxxxxxxxxxxxxxxxxxxxx
Headers
API Key of the form
Bearer <api_key>.Example: Bearer sk_b41b647ffbfed27f616560Query Parameters
Repository owner (GitHub username or organization name).Example:
owner=octocatRepository name.Example:
repo=my-appWhen
true, returns only branches with branch protection rules enabled.Default: falseExample: protected_only=trueResponse Fields
Array of branch objects.
The repository’s default branch name (e.g.
"main").Total number of branches returned.
Error Codes
| Status Code | Error | Description |
|---|---|---|
| 200 | Success | Branch list returned |
| 400 | Bad Request | Missing owner or repo query parameters |
| 401 | Unauthorized | Invalid or missing API key |
| 403 | Forbidden | Pro subscription required or no GitHub token stored |
| 500 | Internal Server Error | Failed to fetch branches from GitHub |