GitHub v3 REST API

Delete a GPG key for the authenticated user

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

delete
http://HOSTNAME/api/v3/user/gpg_keys/{gpg_key_id}

Path Parameters

gpg_key_idintegerrequired

gpg_key_id parameter

Response

Response

delete/user/gpg_keys/{gpg_key_id}
 

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
http://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
http://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
http://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
http://HOSTNAME/api/v3/user/keys/{key_id}

Path Parameters

key_idintegerrequired

key_id parameter

Response

Response

delete/user/keys/{key_id}