GitHub v3 REST API

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

List users

Lists all users, in the order that they signed up on GitHub Enterprise Server. This list includes personal user accounts and organization accounts.

Note: Pagination is powered exclusively by the since parameter. Use the Link header to get the URL for the next page of users.

get
{protocol}://{hostname}/api/v3/users

Query Parameters

sinceinteger

A user ID. Only return users with an ID greater than this ID.

per_pageinteger

Results per page (max 100)

Default:30

Response

application/json

Response

Simple User

namestring | null
emailstring | null
loginstringrequired

Example:octocat

idintegerrequired

Example:1

node_idstringrequired

Example:MDQ6VXNlcjE=

avatar_urlstring(uri)required

Example:https://github.com/images/error/octocat_happy.gif

gravatar_idstring | nullrequired

Example:41d064eb2195891e12d0413f63227ea7

urlstring(uri)required

Example:https://api.github.com/users/octocat

html_urlstring(uri)required

Example:https://github.com/octocat

followers_urlstring(uri)required

Example:https://api.github.com/users/octocat/followers

following_urlstringrequired

Example:https://api.github.com/users/octocat/following{/other_user}

gists_urlstringrequired

Example:https://api.github.com/users/octocat/gists{/gist_id}

starred_urlstringrequired

Example:https://api.github.com/users/octocat/starred{/owner}{/repo}

subscriptions_urlstring(uri)required

Example:https://api.github.com/users/octocat/subscriptions

organizations_urlstring(uri)required

Example:https://api.github.com/users/octocat/orgs

repos_urlstring(uri)required

Example:https://api.github.com/users/octocat/repos

events_urlstringrequired

Example:https://api.github.com/users/octocat/events{/privacy}

received_events_urlstring(uri)required

Example:https://api.github.com/users/octocat/received_events

typestringrequired

Example:User

site_adminbooleanrequired
starred_atstring

Example:"2020-07-09T00:17:55Z"

get/users
 
application/json