Skip to content

Get a public SSH key for the authenticated user

GET
/user/keys/{key_id}

View extended details for a single public SSH key.

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

API method documentation

key_id
required
integer

The unique identifier of the key.

Response

Media type application/json
Key

Key

object
key
required
string
id
required
integer format: int64
url
required
string
title
required
string
created_at
required
string format: date-time
verified
required
boolean
read_only
required
boolean
last_used
string format: date-time
nullable
Examples
Example default
{
"key": "2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234",
"id": 2,
"url": "https://api.github.com/user/keys/2",
"title": "ssh-rsa AAAAB3NzaC1yc2EAAA",
"created_at": "2020-06-11T21:31:57Z",
"verified": false,
"read_only": false
}

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"
}