Skip to content

List GPG keys for the authenticated user

GET
/user/gpg_keys

Lists the current user’s GPG keys.

OAuth app tokens and personal access tokens (classic) need the read:gpg_key scope to use this endpoint.

API method documentation

per_page
integer
default: 30

The number of results per page (max 100). For more information, see “Using pagination in the REST API.”

page
integer
default: 1

The page number of the results to fetch. For more information, see “Using pagination in the REST API.”

Response

Media type application/json
Array<object>
GPG Key

A unique encryption key

object
id
required
integer format: int64
name
string
nullable
primary_key_id
required
integer
nullable
key_id
required
string
public_key
required
string
emails
required
Array<object>
object
email
string
verified
boolean
subkeys
required
Array<object>
object
id
integer format: int64
primary_key_id
integer
key_id
string
public_key
string
emails
Array<object>
object
email
string
verified
boolean
subkeys
Array
can_sign
boolean
can_encrypt_comms
boolean
can_encrypt_storage
boolean
can_certify
boolean
created_at
string
expires_at
string
nullable
raw_key
string
nullable
revoked
boolean
can_sign
required
boolean
can_encrypt_comms
required
boolean
can_encrypt_storage
required
boolean
can_certify
required
boolean
created_at
required
string format: date-time
expires_at
required
string format: date-time
nullable
revoked
required
boolean
raw_key
required
string
nullable
Examples
Example default
[
{
"id": 3,
"name": "Octocat's GPG Key",
"primary_key_id": 2,
"key_id": "3262EFF25BA0D270",
"public_key": "xsBNBFayYZ...",
"emails": [
{
"email": "octocat@users.noreply.github.com",
"verified": true
}
],
"subkeys": [
{
"id": 4,
"primary_key_id": 3,
"key_id": "4A595D4C72EE49C7",
"public_key": "zsBNBFayYZ...",
"emails": [],
"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": "2016-03-24T11:31:04-07:00",
"revoked": false
}
],
"can_sign": true,
"can_encrypt_comms": false,
"can_encrypt_storage": false,
"can_certify": true,
"created_at": "2016-03-24T11:31:04-06:00",
"expires_at": "2016-03-24T11:31:04-07:00",
"revoked": false,
"raw_key": "string"
}
]
Link
string
Example
<https://api.github.com/resource?page=2>; rel="next", <https://api.github.com/resource?page=5>; rel="last"

Not modified

Requires authentication

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Forbidden

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Resource not found

Media type application/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Example generated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}