GitHub v3 REST API

Get a repository

When you pass the scarlet-witch-preview media type, requests to get a repository will also return the repository’s code of conduct if it can be detected from the repository’s code of conduct file.

The parent and source objects are present when the repository is a fork. parent is the repository this repository was forked from, source is the ultimate source for the network.

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}

Path Parameters

ownerstringrequired
repostringrequired

Response

application/json

Response

Full Repository

Full Repository

idintegerrequired

Example:1296269

node_idstringrequired

Example:MDEwOlJlcG9zaXRvcnkxMjk2MjY5

namestringrequired

Example:Hello-World

full_namestringrequired

Example:octocat/Hello-World

ownerobjectrequired

Simple User

Show Child Parameters
privatebooleanrequired
html_urlstring(uri)required

Example:https://github.com/octocat/Hello-World

descriptionstring | nullrequired

Example:This your first repo!

forkbooleanrequired
urlstring(uri)required

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

archive_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}

assignees_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/assignees{/user}

blobs_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}

branches_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/branches{/branch}

collaborators_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}

comments_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/comments{/number}

commits_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/commits{/sha}

compare_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}

contents_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/contents/{+path}

contributors_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/contributors

deployments_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/deployments

downloads_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/downloads

events_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/events

forks_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/forks

git_commits_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}

git_refs_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}

git_tags_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}

git_urlstringrequired

Example:git:github.com/octocat/Hello-World.git

issue_comment_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}

issue_events_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/issues/events{/number}

issues_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/issues{/number}

keys_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/keys{/key_id}

labels_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/labels{/name}

languages_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/languages

merges_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/merges

milestones_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/milestones{/number}

notifications_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}

pulls_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/pulls{/number}

releases_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/releases{/id}

ssh_urlstringrequired

Example:git@github.com:octocat/Hello-World.git

stargazers_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/stargazers

statuses_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/statuses/{sha}

subscribers_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/subscribers

subscription_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/subscription

tags_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/tags

teams_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/teams

trees_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}

clone_urlstringrequired

Example:https://github.com/octocat/Hello-World.git

mirror_urlstring | null(uri)required

Example:git:git.example.com/octocat/Hello-World

hooks_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/hooks

svn_urlstring(uri)required

Example:https://svn.github.com/octocat/Hello-World

homepagestring | null(uri)required

Example:https://github.com

languagestring | nullrequired
forks_countintegerrequired

Example:9

stargazers_countintegerrequired

Example:80

watchers_countintegerrequired

Example:80

sizeintegerrequired

Example:108

default_branchstringrequired

Example:master

open_issues_countintegerrequired

Example:0

is_templateboolean

Example:true

topicsarray[string]

Example:["octocat","atom","electron","API"]

has_issuesbooleanrequired

Example:true

has_projectsbooleanrequired

Example:true

has_wikibooleanrequired

Example:true

has_pagesbooleanrequired
has_downloadsbooleanrequired

Example:true

archivedbooleanrequired
disabledbooleanrequired

Returns whether or not this repository disabled.

visibilitystring

The repository visibility: public, private, or internal.

Example:public

pushed_atstring(date-time)required

Example:2011-01-26T19:06:43Z

created_atstring(date-time)required

Example:2011-01-26T19:01:12Z

updated_atstring(date-time)required

Example:2011-01-26T19:14:43Z

permissionsobject
Show Child Parameters
allow_rebase_mergeboolean

Example:true

template_repositoryobject | null

A git repository

Show Child Parameters
temp_clone_tokenstring | null
allow_squash_mergeboolean

Example:true

delete_branch_on_mergeboolean

Example:false

allow_merge_commitboolean

Example:true

allow_forkingboolean

Example:true

subscribers_countintegerrequired

Example:42

network_countintegerrequired

Example:0

licenseobject | nullrequired

License Simple

Show Child Parameters
organizationobject | null

Simple User

Show Child Parameters
parentobject

A git repository

Show Child Parameters
sourceobject

A git repository

Show Child Parameters
forksintegerrequired
master_branchstring
open_issuesintegerrequired
watchersintegerrequired
anonymous_access_enabledboolean

Whether anonymous git access is allowed.

Default:true

code_of_conductobject

Code of Conduct Simple

Show Child Parameters
get/repos/{owner}/{repo}
 
application/json

Update a repository

Note: To edit a repository’s topics, use the Replace all repository topics endpoint.

patch
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}

Path Parameters

ownerstringrequired
repostringrequired

Body

application/json
namestring

The name of the repository.

descriptionstring

A short description of the repository.

homepagestring

A URL with more information about the repository.

privateboolean

Either true to make the repository private or false to make it public. Default: false.
Note: You will get a 422 error if the organization restricts changing repository visibility to organization owners and a non-owner tries to change the value of private. Note: You will get a 422 error if the organization restricts changing repository visibility to organization owners and a non-owner tries to change the value of private.

Default:false

visibilitystring

Can be public or private. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, visibility can also be internal."

Allowed values:publicprivateinternal

has_issuesboolean

Either true to enable issues for this repository or false to disable them.

Default:true

has_projectsboolean

Either true to enable projects for this repository or false to disable them. Note: If you’re creating a repository in an organization that has disabled repository projects, the default is false, and if you pass true, the API returns an error.

Default:true

has_wikiboolean

Either true to enable the wiki for this repository or false to disable it.

Default:true

is_templateboolean

Either true to make this repo available as a template repository or false to prevent it.

Default:false

default_branchstring

Updates the default branch for this repository.

allow_squash_mergeboolean

Either true to allow squash-merging pull requests, or false to prevent squash-merging.

Default:true

allow_merge_commitboolean

Either true to allow merging pull requests with a merge commit, or false to prevent merging pull requests with merge commits.

Default:true

allow_rebase_mergeboolean

Either true to allow rebase-merging pull requests, or false to prevent rebase-merging.

Default:true

delete_branch_on_mergeboolean

Either true to allow automatically deleting head branches when pull requests are merged, or false to prevent automatic deletion.

Default:false

archivedboolean

true to archive this repository. Note: You cannot unarchive repositories through the API.

Default:false

allow_forkingboolean

Either true to allow private forks, or false to prevent private forks.

Default:false

Response

application/json

Response

Full Repository

Full Repository

idintegerrequired

Example:1296269

node_idstringrequired

Example:MDEwOlJlcG9zaXRvcnkxMjk2MjY5

namestringrequired

Example:Hello-World

full_namestringrequired

Example:octocat/Hello-World

ownerobjectrequired

Simple User

Show Child Parameters
privatebooleanrequired
html_urlstring(uri)required

Example:https://github.com/octocat/Hello-World

descriptionstring | nullrequired

Example:This your first repo!

forkbooleanrequired
urlstring(uri)required

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

archive_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}

assignees_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/assignees{/user}

blobs_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}

branches_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/branches{/branch}

collaborators_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}

comments_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/comments{/number}

commits_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/commits{/sha}

compare_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}

contents_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/contents/{+path}

contributors_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/contributors

deployments_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/deployments

downloads_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/downloads

events_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/events

forks_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/forks

git_commits_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/commits{/sha}

git_refs_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/refs{/sha}

git_tags_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/tags{/sha}

git_urlstringrequired

Example:git:github.com/octocat/Hello-World.git

issue_comment_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/issues/comments{/number}

issue_events_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/issues/events{/number}

issues_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/issues{/number}

keys_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/keys{/key_id}

labels_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/labels{/name}

languages_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/languages

merges_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/merges

milestones_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/milestones{/number}

notifications_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}

pulls_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/pulls{/number}

releases_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/releases{/id}

ssh_urlstringrequired

Example:git@github.com:octocat/Hello-World.git

stargazers_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/stargazers

statuses_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/statuses/{sha}

subscribers_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/subscribers

subscription_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/subscription

tags_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/tags

teams_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/teams

trees_urlstringrequired

Example:http://api.github.com/repos/octocat/Hello-World/git/trees{/sha}

clone_urlstringrequired

Example:https://github.com/octocat/Hello-World.git

mirror_urlstring | null(uri)required

Example:git:git.example.com/octocat/Hello-World

hooks_urlstring(uri)required

Example:http://api.github.com/repos/octocat/Hello-World/hooks

svn_urlstring(uri)required

Example:https://svn.github.com/octocat/Hello-World

homepagestring | null(uri)required

Example:https://github.com

languagestring | nullrequired
forks_countintegerrequired

Example:9

stargazers_countintegerrequired

Example:80

watchers_countintegerrequired

Example:80

sizeintegerrequired

Example:108

default_branchstringrequired

Example:master

open_issues_countintegerrequired

Example:0

is_templateboolean

Example:true

topicsarray[string]

Example:["octocat","atom","electron","API"]

has_issuesbooleanrequired

Example:true

has_projectsbooleanrequired

Example:true

has_wikibooleanrequired

Example:true

has_pagesbooleanrequired
has_downloadsbooleanrequired

Example:true

archivedbooleanrequired
disabledbooleanrequired

Returns whether or not this repository disabled.

visibilitystring

The repository visibility: public, private, or internal.

Example:public

pushed_atstring(date-time)required

Example:2011-01-26T19:06:43Z

created_atstring(date-time)required

Example:2011-01-26T19:01:12Z

updated_atstring(date-time)required

Example:2011-01-26T19:14:43Z

permissionsobject
Show Child Parameters
allow_rebase_mergeboolean

Example:true

template_repositoryobject | null

A git repository

Show Child Parameters
temp_clone_tokenstring | null
allow_squash_mergeboolean

Example:true

delete_branch_on_mergeboolean

Example:false

allow_merge_commitboolean

Example:true

allow_forkingboolean

Example:true

subscribers_countintegerrequired

Example:42

network_countintegerrequired

Example:0

licenseobject | nullrequired

License Simple

Show Child Parameters
organizationobject | null

Simple User

Show Child Parameters
parentobject

A git repository

Show Child Parameters
sourceobject

A git repository

Show Child Parameters
forksintegerrequired
master_branchstring
open_issuesintegerrequired
watchersintegerrequired
anonymous_access_enabledboolean

Whether anonymous git access is allowed.

Default:true

code_of_conductobject

Code of Conduct Simple

Show Child Parameters
patch/repos/{owner}/{repo}

Body

{ "name": "Hello-World", "description": "This is your first repository", "homepage": "https://github.com", "private": true, "has_issues": true, "has_projects": true, "has_wiki": true }
 
application/json

Delete a repository

Deleting a repository requires admin access. If OAuth is used, the delete_repo scope is required.

If an organization owner has configured the organization to prevent members from deleting organization-owned
repositories, you will get a 403 Forbidden response.

delete
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}

Path Parameters

ownerstringrequired
repostringrequired

Response

Response

delete/repos/{owner}/{repo}
 

List branches

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/branches

Query Parameters

protectedboolean

Setting to true returns only protected branches. When set to false, only unprotected branches are returned. Omitting this parameter returns all branches.

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

ownerstringrequired
repostringrequired

Response

application/json

Response

Short Branch

namestringrequired
commitobjectrequired
Show Child Parameters
protectedbooleanrequired
protectionobject

Branch Protection

Show Child Parameters
protection_urlstring(uri)
get/repos/{owner}/{repo}/branches
 
application/json

Get a branch

get
{protocol}://{hostname}/api/v3/repos/{owner}/{repo}/branches/{branch}

Path Parameters

ownerstringrequired
repostringrequired
branchstringrequired

The name of the branch.

Response

application/json

Response

Branch With Protection

Branch With Protection

namestringrequired
commitobjectrequired

Commit

Show Child Parameters
_linksobjectrequired
Show Child Parameters
protectedbooleanrequired
protectionobjectrequired

Branch Protection

Show Child Parameters
protection_urlstring(uri)required
patternstring

Example:"mas*"

required_approving_review_countinteger

Example:1

get/repos/{owner}/{repo}/branches/{branch}
 
application/json