GitHub v3 REST API

List deploy keys

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

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Path Parameters

ownerstringrequired
repostringrequired

Response

200 application/json

Response

An SSH key granting access to a single repository.

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

Create a deploy key

You can create a read-only deploy key.

post
{protocol}://{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
{protocol}://{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
{protocol}://{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
{protocol}://{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