GitHub v3 REST API

List public SSH keys for the authenticated user

Lists the public SSH keys for the authenticated user’s GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least read:public_key scope.

get
{protocol}://{hostname}/api/v3/user/keys

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Response

application/json

Response

Key

keystringrequired
idintegerrequired
urlstringrequired
titlestringrequired
created_atstring(date-time)required
verifiedbooleanrequired
read_onlybooleanrequired
get/user/keys
 
application/json

Create a public SSH key for the authenticated user

Adds a public SSH key to the authenticated user’s GitHub account. Requires that you are authenticated via Basic Auth, or OAuth with at least write:public_key scope.

post
{protocol}://{hostname}/api/v3/user/keys

Body

application/json
titlestring

A descriptive name for the new key.

Example:Personal MacBook Air

keystringrequired

The public SSH key to add to your GitHub account.

Match pattern:^ssh-(rsa|dss|ed25519) |^ecdsa-sha2-nistp(256|384|521)

Response

application/json

Response

Key

Key

keystringrequired
idintegerrequired
urlstringrequired
titlestringrequired
created_atstring(date-time)required
verifiedbooleanrequired
read_onlybooleanrequired
post/user/keys

Body

{ "key": "key" }
 
application/json

Get a public SSH key for the authenticated user

View extended details for a single public SSH key. Requires that you are authenticated via Basic Auth or via OAuth with at least read:public_key scope.

get
{protocol}://{hostname}/api/v3/user/keys/{key_id}

Path Parameters

key_idintegerrequired

key_id parameter

Response

application/json

Response

Key

Key

keystringrequired
idintegerrequired
urlstringrequired
titlestringrequired
created_atstring(date-time)required
verifiedbooleanrequired
read_onlybooleanrequired
get/user/keys/{key_id}
 
application/json

Delete a public SSH key for the authenticated user

Removes a public SSH key from the authenticated user’s GitHub account. Requires that you are authenticated via Basic Auth or via OAuth with at least admin:public_key scope.

delete
{protocol}://{hostname}/api/v3/user/keys/{key_id}

Path Parameters

key_idintegerrequired

key_id parameter

Response

Response

delete/user/keys/{key_id}
 

List public email addresses for the authenticated user

Lists your publicly visible email address, which you can set with the Set primary email visibility for the authenticated user endpoint. This endpoint is accessible with the user:email scope.

get
{protocol}://{hostname}/api/v3/user/public_emails

Query Parameters

per_pageinteger

Results per page (max 100)

Default:30

pageinteger

Page number of the results to fetch.

Default:1

Response

application/json

Response

Email

emailstring(email)required

Example:octocat@github.com

primarybooleanrequired

Example:true

verifiedbooleanrequired

Example:true

visibilitystring | nullrequired

Example:public

get/user/public_emails
 
application/json