Users

Interact with and view information about users and also current user.

Operations

MethodEndpointDescription
GET/userGet the authenticated user
PATCH/userUpdate the authenticated user
GET/user/blocksList users blocked by the authenticated user
GET/user/blocks/{username}Check if a user is blocked by the authenticated user
PUT/user/blocks/{username}Block a user
DELETE/user/blocks/{username}Unblock a user
PATCH/user/email/visibilitySet primary email visibility for the authenticated user
GET/user/emailsList email addresses for the authenticated user
POST/user/emailsAdd an email address for the authenticated user
DELETE/user/emailsDelete an email address for the authenticated user
GET/user/followersList followers of the authenticated user
GET/user/followingList the people the authenticated user follows
GET/user/following/{username}Check if a person is followed by the authenticated user
PUT/user/following/{username}Follow a user
DELETE/user/following/{username}Unfollow a user
GET/user/gpg_keysList GPG keys for the authenticated user
POST/user/gpg_keysCreate a GPG key for the authenticated user
GET/user/gpg_keys/{gpg_key_id}Get a GPG key for the authenticated user
DELETE/user/gpg_keys/{gpg_key_id}Delete a GPG key for the authenticated user
GET/user/keysList public SSH keys for the authenticated user
POST/user/keysCreate a public SSH key for the authenticated user
GET/user/keys/{key_id}Get a public SSH key for the authenticated user
DELETE/user/keys/{key_id}Delete a public SSH key for the authenticated user
GET/user/public_emailsList public email addresses for the authenticated user
GET/user/social_accountsList social accounts for the authenticated user
POST/user/social_accountsAdd social accounts for the authenticated user
DELETE/user/social_accountsDelete social accounts for the authenticated user
GET/user/ssh_signing_keysList SSH signing keys for the authenticated user
POST/user/ssh_signing_keysCreate a SSH signing key for the authenticated user
GET/user/ssh_signing_keys/{ssh_signing_key_id}Get an SSH signing key for the authenticated user
DELETE/user/ssh_signing_keys/{ssh_signing_key_id}Delete an SSH signing key for the authenticated user
GET/user/{account_id}Get a user using their ID
GET/usersList users
GET/users/{username}Get a user
POST/users/{username}/attestations/bulk-listList attestations by bulk subject digests
POST/users/{username}/attestations/delete-requestDelete attestations in bulk
DELETE/users/{username}/attestations/digest/{subject_digest}Delete attestations by subject digest
DELETE/users/{username}/attestations/{attestation_id}Delete attestations by ID
GET/users/{username}/attestations/{subject_digest}List attestations
GET/users/{username}/followersList followers of a user

The full set of 47 operations is in the API reference.

Example

Get the authenticated user, with the TypeScript SDK:

ts
import { GitHubV3REST } from "github";

const client = new GitHubV3REST({
  baseUrl: "https://api.github.com",
});

const result = await client.users.getAuthenticated();
console.log(result);
Nine more languages

The same call exists in every SDK. See SDKs for the other nine.