GitHub v3 REST API

Create a GPG key for the authenticated user

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

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

Body

application/json
armored_public_keystringrequired

A GPG key in ASCII-armored format.

Response

application/json

Response

GPG Key

A unique encryption key

idintegerrequired

Example:3

primary_key_idinteger | nullrequired
key_idstringrequired

Example:3262EFF25BA0D270

public_keystringrequired

Example:xsBNBFayYZ...

emailsarray[object]required

Example:[{"email":"mastahyeti@users.noreply.github.com","verified":true}]

Show Child Parameters
subkeysarray[object]required

Example:[{"id":4,"primary_key_id":3,"key_id":"4A595D4C72EE49C7","public_key":"zsBNBFayYZ...","emails":[],"subkeys":[],"can_sign":false,"can_encrypt_comms":true,"can_encrypt_storage":true,"can_certify":false,"created_at":"2016-03-24T11:31:04-06:00","expires_at":null}]

Show Child Parameters
can_signbooleanrequired

Example:true

can_encrypt_commsbooleanrequired
can_encrypt_storagebooleanrequired
can_certifybooleanrequired

Example:true

created_atstring(date-time)required

Example:2016-03-24T11:31:04-06:00

expires_atstring | null(date-time)required
raw_keystring | nullrequired
post/user/gpg_keys

Body

{ "armored_public_key": "armored_public_key" }
 
application/json

Get a GPG key for the authenticated user

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

get
{protocol}://{hostname}/api/v3/user/gpg_keys/{gpg_key_id}

Path Parameters

gpg_key_idintegerrequired

gpg_key_id parameter

Response

application/json

Response

GPG Key

A unique encryption key

idintegerrequired

Example:3

primary_key_idinteger | nullrequired
key_idstringrequired

Example:3262EFF25BA0D270

public_keystringrequired

Example:xsBNBFayYZ...

emailsarray[object]required

Example:[{"email":"mastahyeti@users.noreply.github.com","verified":true}]

Show Child Parameters
subkeysarray[object]required

Example:[{"id":4,"primary_key_id":3,"key_id":"4A595D4C72EE49C7","public_key":"zsBNBFayYZ...","emails":[],"subkeys":[],"can_sign":false,"can_encrypt_comms":true,"can_encrypt_storage":true,"can_certify":false,"created_at":"2016-03-24T11:31:04-06:00","expires_at":null}]

Show Child Parameters
can_signbooleanrequired

Example:true

can_encrypt_commsbooleanrequired
can_encrypt_storagebooleanrequired
can_certifybooleanrequired

Example:true

created_atstring(date-time)required

Example:2016-03-24T11:31:04-06:00

expires_atstring | null(date-time)required
raw_keystring | nullrequired
get/user/gpg_keys/{gpg_key_id}
 
application/json

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