Add an email address for the authenticated user

This endpoint is accessible with the user scope.

octokit.users.addEmailForAuthenticated({
emails,
});

Parameters

namerequireddescription
emailsyes

Adds one or more email addresses to your GitHub account. Must contain at least one email address. Note: Alternatively, you can pass a single email address or an array of emails addresses directly, but we recommend that you pass an object using the emails key.

See also: GitHub Developer Guide documentation.

Block a user

octokit.users.block({
username,
});

Parameters

namerequireddescription
usernameyes

See also: GitHub Developer Guide documentation.

Check if a user is blocked by the authenticated user

octokit.users.checkBlocked({
username,
});

Parameters

namerequireddescription
usernameyes

See also: GitHub Developer Guide documentation.

Check if a user follows another user

octokit.users.checkFollowingForUser({
username,
target_user,
});

Parameters

namerequireddescription
usernameyes
target_useryes

See also: GitHub Developer Guide documentation.

Check if a person is followed by the authenticated user

octokit.users.checkPersonIsFollowedByAuthenticated({
username,
});

Parameters

namerequireddescription
usernameyes

See also: GitHub Developer Guide documentation.

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.

octokit.users.createGpgKeyForAuthenticated({
armored_public_key,
});

Parameters

namerequireddescription
armored_public_keyyes

A GPG key in ASCII-armored format.

See also: GitHub Developer Guide documentation.

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.

octokit.users.createPublicSshKeyForAuthenticated({
key,
});

Parameters

namerequireddescription
titleno

A descriptive name for the new key.

keyyes

The public SSH key to add to your GitHub account.

See also: GitHub Developer Guide documentation.

Delete an email address for the authenticated user

This endpoint is accessible with the user scope.

octokit.users.deleteEmailForAuthenticated({
emails,
});

Parameters

namerequireddescription
emailsyes

Email addresses associated with the GitHub user account.

See also: GitHub Developer Guide documentation.

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.

octokit.users.deleteGpgKeyForAuthenticated({
gpg_key_id,
});

Parameters

namerequireddescription
gpg_key_idyes

gpg_key_id parameter

See also: GitHub Developer Guide documentation.

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.

octokit.users.deletePublicSshKeyForAuthenticated({
key_id,
});

Parameters

namerequireddescription
key_idyes

key_id parameter

See also: GitHub Developer Guide documentation.

Follow a user

Note that you'll need to set Content-Length to zero when calling out to this endpoint. For more information, see "HTTP verbs."

Following a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope.

octokit.users.follow({
username,
});

Parameters

namerequireddescription
usernameyes

See also: GitHub Developer Guide documentation.

Get the authenticated user

If the authenticated user is authenticated through basic authentication or OAuth with the user scope, then the response lists public and private profile information.

If the authenticated user is authenticated through OAuth without the user scope, then the response lists only public profile information.

octokit.users.getAuthenticated();

Parameters

This endpoint has no parameters

See also: GitHub Developer Guide documentation.

Get a user

Provides publicly available information about someone with a GitHub account.

GitHub Apps with the Plan user permission can use this endpoint to retrieve information about a user's GitHub plan. The GitHub App must be authenticated as a user. See "Identifying and authorizing users for GitHub Apps" for details about authentication. For an example response, see 'Response with GitHub plan information' below"

The email key in the following response is the publicly visible email address from your GitHub profile page. When setting up your profile, you can select a primary email address to be “public” which provides an email entry for this endpoint. If you do not set a public email address for email, then it will have a value of null. You only see publicly visible email addresses when authenticated with GitHub. For more information, see Authentication.

The Emails API enables you to list all of your email addresses, and toggle a primary email to be visible publicly. For more information, see "Emails API".

octokit.users.getByUsername({
username,
});

Parameters

namerequireddescription
usernameyes

See also: GitHub Developer Guide documentation.

Get contextual information for a user

Provides hovercard information when authenticated through basic auth or OAuth with the repo scope. You can find out more about someone in relation to their pull requests, issues, repositories, and organizations.

The subject_type and subject_id parameters provide context for the person's hovercard, which returns more information than without the parameters. For example, if you wanted to find out more about octocat who owns the Spoon-Knife repository via cURL, it would look like this:

curl -u username:token
https://api.github.com/users/octocat/hovercard?subject_type=repository&subject_id=1300192
octokit.users.getContextForUser({
username,
});

Parameters

namerequireddescription
usernameyes
subject_typeno

Identifies which additional information you'd like to receive about the person's hovercard. Can be organization, repository, issue, pull_request. Required when using subject_id.

subject_idno

Uses the ID for the subject_type you specified. Required when using subject_type.

See also: GitHub Developer Guide documentation.

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.

octokit.users.getGpgKeyForAuthenticated({
gpg_key_id,
});

Parameters

namerequireddescription
gpg_key_idyes

gpg_key_id parameter

See also: GitHub Developer Guide documentation.

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.

octokit.users.getPublicSshKeyForAuthenticated({
key_id,
});

Parameters

namerequireddescription
key_idyes

key_id parameter

See also: GitHub Developer Guide documentation.

List users

Lists all users, in the order that they signed up on GitHub. 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.

octokit.users.list();

Parameters

namerequireddescription
sinceno

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

per_pageno

Results per page (max 100)

See also: GitHub Developer Guide documentation.

List users blocked by the authenticated user

List the users you've blocked on your personal account.

octokit.users.listBlockedByAuthenticated();

Parameters

This endpoint has no parameters

See also: GitHub Developer Guide documentation.

List email addresses for the authenticated user

Lists all of your email addresses, and specifies which one is visible to the public. This endpoint is accessible with the user:email scope.

octokit.users.listEmailsForAuthenticated();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List the people the authenticated user follows

Lists the people who the authenticated user follows.

octokit.users.listFollowedByAuthenticated();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List followers of the authenticated user

Lists the people following the authenticated user.

octokit.users.listFollowersForAuthenticatedUser();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List followers of a user

Lists the people following the specified user.

octokit.users.listFollowersForUser({
username,
});

Parameters

namerequireddescription
usernameyes
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List the people a user follows

Lists the people who the specified user follows.

octokit.users.listFollowingForUser({
username,
});

Parameters

namerequireddescription
usernameyes
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List GPG keys for the authenticated user

Lists the current user's GPG keys. Requires that you are authenticated via Basic Auth or via OAuth with at least read:gpg_key scope.

octokit.users.listGpgKeysForAuthenticated();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List GPG keys for a user

Lists the GPG keys for a user. This information is accessible by anyone.

octokit.users.listGpgKeysForUser({
username,
});

Parameters

namerequireddescription
usernameyes
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

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.

octokit.users.listPublicEmailsForAuthenticated();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

List public keys for a user

Lists the verified public SSH keys for a user. This is accessible by anyone.

octokit.users.listPublicKeysForUser({
username,
});

Parameters

namerequireddescription
usernameyes
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

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.

octokit.users.listPublicSshKeysForAuthenticated();

Parameters

namerequireddescription
per_pageno

Results per page (max 100)

pageno

Page number of the results to fetch.

See also: GitHub Developer Guide documentation.

Set primary email visibility for the authenticated user

Sets the visibility for your primary email addresses.

octokit.users.setPrimaryEmailVisibilityForAuthenticated({
email,
visibility,
});

Parameters

namerequireddescription
emailyes

An email address associated with the GitHub user account to manage.

visibilityyes

Denotes whether an email is publically visible.

See also: GitHub Developer Guide documentation.

Unblock a user

octokit.users.unblock({
username,
});

Parameters

namerequireddescription
usernameyes

See also: GitHub Developer Guide documentation.

Unfollow a user

Unfollowing a user requires the user to be logged in and authenticated with basic auth or OAuth with the user:follow scope.

octokit.users.unfollow({
username,
});

Parameters

namerequireddescription
usernameyes

See also: GitHub Developer Guide documentation.

Update the authenticated user

Note: If your email is set to private and you send an email parameter as part of this request to update your profile, your privacy settings are still enforced: the email address will not be displayed on your public profile or via the API.

octokit.users.updateAuthenticated();

Parameters

namerequireddescription
nameno

The new name of the user.

emailno

The publicly visible email address of the user.

blogno

The new blog URL of the user.

twitter_usernameno

The new Twitter username of the user.

companyno

The new company of the user.

locationno

The new location of the user.

hireableno

The new hiring availability of the user.

biono

The new short biography of the user.

See also: GitHub Developer Guide documentation.