GitHub v3 REST API

Create a deploy key

You can create a read-only deploy key.

post
http://HOSTNAME/api/v3/repos/{owner}/{repo}/keys

Path Parameters

ownerstringrequired
repostringrequired

Body

application/json
titlestring

A name for the key.

keystringrequired

The contents of the key.

read_onlyboolean

If true, the key will only be able to read repository contents. Otherwise, the key will be able to read and write.

Deploy keys with write access can perform the same actions as an organization member with admin access, or a collaborator on a personal repository. For more information, see “Repository permission levels for an organization” and “Permission levels for a user account repository.”

Response

application/json

Response

Deploy Key

An SSH key granting access to a single repository.

idintegerrequired
keystringrequired
urlstringrequired
titlestringrequired
verifiedbooleanrequired
created_atstringrequired
read_onlybooleanrequired
post/repos/{owner}/{repo}/keys

Body

{ "title": "octocat@octomac", "key": "ssh-rsa AAA...", "read_only": true }
 
application/json

Get a deploy key

get
http://HOSTNAME/api/v3/repos/{owner}/{repo}/keys/{key_id}

Path Parameters

ownerstringrequired
repostringrequired
key_idintegerrequired

key_id parameter

Response

application/json

Response

Deploy Key

An SSH key granting access to a single repository.

idintegerrequired
keystringrequired
urlstringrequired
titlestringrequired
verifiedbooleanrequired
created_atstringrequired
read_onlybooleanrequired
get/repos/{owner}/{repo}/keys/{key_id}
 
application/json

Delete a deploy key

Deploy keys are immutable. If you need to update a key, remove the key and create a new one instead.

delete
http://HOSTNAME/api/v3/repos/{owner}/{repo}/keys/{key_id}

Path Parameters

ownerstringrequired
repostringrequired
key_idintegerrequired

key_id parameter

Response

204

Response

delete/repos/{owner}/{repo}/keys/{key_id}
 
204

List repository languages

Lists languages for the specified repository. The value shown for each language is the number of bytes of code written in that language.

get
http://HOSTNAME/api/v3/repos/{owner}/{repo}/languages

Path Parameters

ownerstringrequired
repostringrequired

Response

200 application/json

Response

Language

Languageobject

Language

get/repos/{owner}/{repo}/languages
 
200 application/json

Merge a branch

post
http://HOSTNAME/api/v3/repos/{owner}/{repo}/merges

Path Parameters

ownerstringrequired
repostringrequired

Body

application/json
basestringrequired

The name of the base branch that the head will be merged into.

headstringrequired

The head to merge. This can be a branch name or a commit SHA1.

commit_messagestring

Commit message to use for the merge commit. If omitted, a default message will be used.

Response

application/json

Successful Response (The resulting merge commit)

Commit

Commit

urlstring(uri)required

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

shastringrequired

Example:6dcb09b5b57875f334f61aebed695e2e4193db5e

node_idstringrequired

Example:MDY6Q29tbWl0NmRjYjA5YjViNTc4NzVmMzM0ZjYxYWViZWQ2OTVlMmU0MTkzZGI1ZQ==

html_urlstring(uri)required

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

comments_urlstring(uri)required

Example:https://api.github.com/repos/octocat/Hello-World/commits/6dcb09b5b57875f334f61aebed695e2e4193db5e/comments

commitobjectrequired
Show Child Parameters
authorobject | nullrequired

Simple User

Show Child Parameters
committerobject | nullrequired

Simple User

Show Child Parameters
parentsarray[object]required
Show Child Parameters
statsobject
Show Child Parameters
filesarray[object]

Diff Entry

Show Child Parameters
post/repos/{owner}/{repo}/merges

Body

{ "base": "master", "head": "cool_feature", "commit_message": "Shipped cool_feature!" }
 
application/json