Skip to content

List repository branches

GET/v1/git-connections/github-app/branches

Returns the branches of a repository the GitHub App can access. The connection used is the one whose GitHub account matches the repository's owner. Only the first 100 branches that GitHub returns are included.

Requires the secrets read permission (owner, admin or developer role).

Authentication

Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.

Query parameters

repostringRequired

Repository in owner/name form, as in full_name from List GitHub repositories. Must not contain spaces.

Headers

X-Workspace-SlugstringRequired

Slug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.

Response

200

The repository's branches.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataarray of objects
Show item attributes
namestringRequired

Branch name.

commit_shastring

SHA of the branch's latest commit.

defaultbooleanRequired

Meant to flag the default branch, but currently always false. Use default_branch from List GitHub repositories instead.

Errors

StatusMeaning
400repo is missing or contains spaces.
401The API key is missing, invalid, expired or revoked.
403You cannot access the workspace, your role does not allow this action, or the account is suspended.
404No GitHub account is connected, or none matches the repository's owner.
500GitHub could not be reached, or the repository is not accessible to the app.

Errors use the standard error format.