Skip to main content

Get a branch

GET/repos/{owner}/{repo}/branches/{branch}
Source
github-v3-rest.json
Revision
f5f067c1e6f6
Active snapshot
85e53e3d0d65

Request

Path Parameters
owner string
required
repo string
required
branch string
required

The name of the branch.

Responses

application/json Branch With Protection object

Response

_links object
required
html string
required
self string<uri>
required
commit Commit object
required

Commit

author Simple User object
requirednullable

Simple User

avatar_url string<uri>
required

Example: https://github.com/images/error/octocat_happy.gif

email string
optionalnullable
events_url string
required

Example: https://api.github.com/users/octocat/events{/privacy}

followers_url string<uri>
required

Example: https://api.github.com/users/octocat/followers

following_url string
required

Example: https://api.github.com/users/octocat/following{/other_user}

gists_url string
required

Example: https://api.github.com/users/octocat/gists{/gist_id}

gravatar_id string
requirednullable

Example: 41d064eb2195891e12d0413f63227ea7

html_url string<uri>
required

Example: https://github.com/octocat

id integer
required

Example: 1

login string
required

Example: octocat

name string
optionalnullable
node_id string
required

Example: MDQ6VXNlcjE=

organizations_url string<uri>
required

Example: https://api.github.com/users/octocat/orgs

received_events_url string<uri>
required

Example: https://api.github.com/users/octocat/received_events

repos_url string<uri>
required

Example: https://api.github.com/users/octocat/repos

site_admin boolean
required
starred_at string
optional

Example: "2020-07-09T00:17:55Z"

starred_url string
required

Example: https://api.github.com/users/octocat/starred{/owner}{/repo}

subscriptions_url string<uri>
required

Example: https://api.github.com/users/octocat/subscriptions

type string
required

Example: User

url string<uri>
required

Example: https://api.github.com/users/octocat

comments_url string<uri>
required
Example:
https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments
commit object
required
author Git User object
requirednullable

Metaproperties for Git author/committer information.

date string
optional

Example: "2007-10-29T02:42:39.000-07:00"

email string
optional

Example: "[email protected]"

name string
optional

Example: "Chris Wanstrath"

comment_count integer
required

Example: 0

committer Git User object
requirednullable

Metaproperties for Git author/committer information.

date string
optional

Example: "2007-10-29T02:42:39.000-07:00"

email string
optional

Example: "[email protected]"

name string
optional

Example: "Chris Wanstrath"

message string
required

Example: Fix all the bugs

tree object
required
sha string
required

Example: 827efc6d56897b048c772eb4087f854f46256132

url string<uri>
required

Example: https://api.github.com/repos/octocat/Hello-World/tree/827efc6d56897b048c772eb4087f854f46256132

url string<uri>
required
Example:
https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e
verification Verification object
optional
payload string
requirednullable
reason string
required
signature string
requirednullable
verified boolean
required
committer Simple User object
requirednullable

Simple User

avatar_url string<uri>
required

Example: https://github.com/images/error/octocat_happy.gif

email string
optionalnullable
events_url string
required

Example: https://api.github.com/users/octocat/events{/privacy}

followers_url string<uri>
required

Example: https://api.github.com/users/octocat/followers

following_url string
required

Example: https://api.github.com/users/octocat/following{/other_user}

gists_url string
required

Example: https://api.github.com/users/octocat/gists{/gist_id}

gravatar_id string
requirednullable

Example: 41d064eb2195891e12d0413f63227ea7

html_url string<uri>
required

Example: https://github.com/octocat

id integer
required

Example: 1

login string
required

Example: octocat

name string
optionalnullable
node_id string
required

Example: MDQ6VXNlcjE=

organizations_url string<uri>
required

Example: https://api.github.com/users/octocat/orgs

received_events_url string<uri>
required

Example: https://api.github.com/users/octocat/received_events

repos_url string<uri>
required

Example: https://api.github.com/users/octocat/repos

site_admin boolean
required
starred_at string
optional

Example: "2020-07-09T00:17:55Z"

starred_url string
required

Example: https://api.github.com/users/octocat/starred{/owner}{/repo}

subscriptions_url string<uri>
required

Example: https://api.github.com/users/octocat/subscriptions

type string
required

Example: User

url string<uri>
required

Example: https://api.github.com/users/octocat

files array[Diff Entry object]
optional
items Diff Entry object

Diff Entry

additions integer
required

Example: 103

blob_url string<uri>
required

Example: https://github.com/octocat/Hello-World/blob/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt

changes integer
required

Example: 124

contents_url string<uri>
required
Example:
https://api.github.com/repos/octocat/Hello-World/contents/file1.txt?ref=6dcb09b5b57875f334f61aebed695e2e4193db5e
deletions integer
required

Example: 21

filename string
required

Example: file1.txt

patch string
optional

Example: @@ -132,7 +132,7 @@ module Test @@ -1000,7 +1000,7 @@ module Test

previous_filename string
optional

Example: file.txt

raw_url string<uri>
required

Example: https://github.com/octocat/Hello-World/raw/6dcb09b5b57875f334f61aebed695e2e4193db5e/file1.txt

sha string
required

Example: bbcd538c8e72b8c175046e27cc8f907076331401

status string
required

Example: added

html_url string<uri>
required

Example: https://github.com/octocat/Hello-World/commit/6dcb09b5b57875f334f61aebed695e2e4193db5e

node_id string
required

Example: MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==

parents array[object]
required
items object
html_url string<uri>
optional

Example: https://github.com/octocat/Hello-World/commit/7638417db6d59f3c431d3e1f261cc637155684cd

sha string
required

Example: 7638417db6d59f3c431d3e1f261cc637155684cd

url string<uri>
required
Example:
https://api.github.com/repos/octocat/Hello-World/commits/7638417db6d59f3c431d3e1f261cc637155684cd
sha string
required

Example: 6dcb09b5b57875f334f61aebed695e2e4193db5e

stats object
optional
additions integer
optional
deletions integer
optional
total integer
optional
url string<uri>
required
Example:
https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e
name string
required
pattern string
optional

Example: "mas*"

protected boolean
required
protection Branch Protection object
required

Branch Protection

allow_deletions object
optional
enabled boolean
optional
allow_force_pushes object
optional
enabled boolean
optional
enabled boolean
optional
enforce_admins Protected Branch Admin Enforced object
optional

Protected Branch Admin Enforced

enabled boolean
required

Example: true

url string<uri>
required

Example: https://api.github.com/repos/octocat/Hello-World/branches/master/protection/enforce_admins

name string
optional

Example: "branch/with/protection"

protection_url string
optional
Example:
"https://api.github.com/repos/owner-79e94e2d36b3fd06a32bb213/AAA_Public_Repo/branches/branch/with/protection/protection"
required_conversation_resolution object
optional
enabled boolean
optional
required_linear_history object
optional
enabled boolean
optional
required_pull_request_reviews Protected Branch Pull Request Review object
optional

Protected Branch Pull Request Review

dismiss_stale_reviews boolean
required

Example: true

dismissal_restrictions object
optional
teams array
optional

The list of teams with review dismissal access.

teams_url string
optional
Example:
"https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions/teams"
url string
optional
Example:
"https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions"
users array
optional

The list of users with review dismissal access.

users_url string
optional
Example:
"https://api.github.com/repos/the-org/an-org-repo/branches/master/protection/dismissal_restrictions/users"
require_code_owner_reviews boolean
required

Example: true

required_approving_review_count integer
optional

Example: 2

url string<uri>
optional
Example:
https://api.github.com/repos/octocat/Hello-World/branches/master/protection/dismissal_restrictions
required_signatures object
optional
enabled boolean
required

Example: true

url string<uri>
required

Example: https://api.github.com/repos/octocat/Hello-World/branches/master/protection/required_signatures

required_status_checks Protected Branch Required Status Check object
optional

Protected Branch Required Status Check

contexts array[string]
required
contexts_url string
optional
enforcement_level string
optional
strict boolean
optional
url string
optional
restrictions Branch Restriction Policy object
optional

Branch Restriction Policy

apps array[object]
required
apps_url string<uri>
required
teams array[object]
required
teams_url string<uri>
required
url string<uri>
required
users array[object]
required
users_url string<uri>
required
url string
optional
protection_url string<uri>
required
required_approving_review_count integer
optional

Example: 1

application/json Basic Error object

Moved permanently

documentation_url string
optional
message string
optional
status string
optional
url string
optional
application/json Basic Error object

Resource not found

documentation_url string
optional
message string
optional
status string
optional
url string
optional
application/json object

Preview header missing

documentation_url string
required
message string
required