← All tags

Users API Reference

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

47 endpoints tagged users, each listing its parameters and possible responses. Search or scroll the index below to jump to a specific endpoint.

No endpoints match your search.

Get the authenticated user

GET /user

OAuth app tokens and personal access tokens (classic) need the user scope in order for the response to include private profile information.

Parameters

No parameters.

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
403Forbiddenyes
401Requires authenticationyes

Update the authenticated user

PATCH /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.

Parameters

No parameters.

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes
422Validation failed, or the endpoint has been spammed.yes

List users blocked by the authenticated user

GET /user/blocks

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

Parameters

NameInRequiredDescription
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

Check if a user is blocked by the authenticated user

GET /user/blocks/{username}

Returns a 204 if the given user is blocked by the authenticated user. Returns a 404 if the given user is not blocked by the authenticated user, or if the given user account has been identified as spam by GitHub.

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
204If the user is blockedno
404If the user is not blockedyes
304Not modifiedno
403Forbiddenyes
401Requires authenticationyes

Block a user

PUT /user/blocks/{username}

Blocks the given user and returns a 204. If the authenticated user cannot block the given user a 422 is returned.

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
204Responseno
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes
422Validation failed, or the endpoint has been spammed.yes

Unblock a user

DELETE /user/blocks/{username}

Unblocks the given user and returns a 204.

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
204Responseno
304Not modifiedno
403Forbiddenyes
401Requires authenticationyes
404Resource not foundyes

Set primary email visibility for the authenticated user

PATCH /user/email/visibility

Sets the visibility for your primary email addresses.

Parameters

No parameters.

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes
422Validation failed, or the endpoint has been spammed.yes

List email addresses for the authenticated user

GET /user/emails

Lists all of your email addresses, and specifies which one is visible

Parameters

NameInRequiredDescription
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

Add an email address for the authenticated user

POST /user/emails

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

Parameters

No parameters.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Validation failed, or the endpoint has been spammed.yes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

Delete an email address for the authenticated user

DELETE /user/emails

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

Parameters

No parameters.

Responses

StatusDescriptionHas JSON body
204Responseno
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes
422Validation failed, or the endpoint has been spammed.yes

List followers of the authenticated user

GET /user/followers

Lists the people following the authenticated user.

Parameters

NameInRequiredDescription
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
403Forbiddenyes
401Requires authenticationyes

List the people the authenticated user follows

GET /user/following

Lists the people who the authenticated user follows.

Parameters

NameInRequiredDescription
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
403Forbiddenyes
401Requires authenticationyes

Check if a person is followed by the authenticated user

GET /user/following/{username}

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
204if the person is followed by the authenticated userno
404if the person is not followed by the authenticated useryes
304Not modifiedno
403Forbiddenyes
401Requires authenticationyes

Follow a user

PUT /user/following/{username}

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

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
204Responseno
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes
422Validation failed, or the endpoint has been spammed.yes

Unfollow a user

DELETE /user/following/{username}

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

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
204Responseno
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

List GPG keys for the authenticated user

GET /user/gpg_keys

Lists the current user's GPG keys.

Parameters

NameInRequiredDescription
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

Create a GPG key for the authenticated user

POST /user/gpg_keys

Adds a GPG key to the authenticated user's GitHub account.

Parameters

No parameters.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Validation failed, or the endpoint has been spammed.yes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

Get a GPG key for the authenticated user

GET /user/gpg_keys/{gpg_key_id}

View extended details for a single GPG key.

Parameters

NameInRequiredDescription
gpg_key_idpathyesThe unique identifier of the GPG key.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
304Not modifiedno
403Forbiddenyes
401Requires authenticationyes

Delete a GPG key for the authenticated user

DELETE /user/gpg_keys/{gpg_key_id}

Removes a GPG key from the authenticated user's GitHub account.

Parameters

NameInRequiredDescription
gpg_key_idpathyesThe unique identifier of the GPG key.

Responses

StatusDescriptionHas JSON body
204Responseno
404Resource not foundyes
422Validation failed, or the endpoint has been spammed.yes
304Not modifiedno
403Forbiddenyes
401Requires authenticationyes

List public SSH keys for the authenticated user

GET /user/keys

Lists the public SSH keys for the authenticated user's GitHub account.

Parameters

NameInRequiredDescription
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

Create a public SSH key for the authenticated user

POST /user/keys

Adds a public SSH key to the authenticated user's GitHub account.

Parameters

No parameters.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Validation failed, or the endpoint has been spammed.yes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

Get a public SSH key for the authenticated user

GET /user/keys/{key_id}

View extended details for a single public SSH key.

Parameters

NameInRequiredDescription
key_idpathyesThe unique identifier of the key.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
304Not modifiedno
403Forbiddenyes
401Requires authenticationyes

Delete a public SSH key for the authenticated user

DELETE /user/keys/{key_id}

Removes a public SSH key from the authenticated user's GitHub account.

Parameters

NameInRequiredDescription
key_idpathyesThe unique identifier of the key.

Responses

StatusDescriptionHas JSON body
204Responseno
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

List public email addresses for the authenticated user

GET /user/public_emails

Lists your publicly visible email address, which you can set with the

Parameters

NameInRequiredDescription
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

List social accounts for the authenticated user

GET /user/social_accounts

Lists all of your social accounts.

Parameters

NameInRequiredDescription
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

Add social accounts for the authenticated user

POST /user/social_accounts

Add one or more social accounts to the authenticated user's profile.

Parameters

No parameters.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Validation failed, or the endpoint has been spammed.yes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

Delete social accounts for the authenticated user

DELETE /user/social_accounts

Deletes one or more social accounts from the authenticated user's profile.

Parameters

No parameters.

Responses

StatusDescriptionHas JSON body
204Responseno
422Validation failed, or the endpoint has been spammed.yes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

List SSH signing keys for the authenticated user

GET /user/ssh_signing_keys

Lists the SSH signing keys for the authenticated user's GitHub account.

Parameters

NameInRequiredDescription
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

Create a SSH signing key for the authenticated user

POST /user/ssh_signing_keys

Creates an SSH signing key for the authenticated user's GitHub account.

Parameters

No parameters.

Responses

StatusDescriptionHas JSON body
201Responseyes
422Validation failed, or the endpoint has been spammed.yes
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

Get an SSH signing key for the authenticated user

GET /user/ssh_signing_keys/{ssh_signing_key_id}

Gets extended details for an SSH signing key.

Parameters

NameInRequiredDescription
ssh_signing_key_idpathyesThe unique identifier of the SSH signing key.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
304Not modifiedno
403Forbiddenyes
401Requires authenticationyes

Delete an SSH signing key for the authenticated user

DELETE /user/ssh_signing_keys/{ssh_signing_key_id}

Deletes an SSH signing key from the authenticated user's GitHub account.

Parameters

NameInRequiredDescription
ssh_signing_key_idpathyesThe unique identifier of the SSH signing key.

Responses

StatusDescriptionHas JSON body
204Responseno
304Not modifiedno
404Resource not foundyes
403Forbiddenyes
401Requires authenticationyes

Get a user using their ID

GET /user/{account_id}

Provides publicly available information about someone with a GitHub account. This method takes their durable user ID instead of their login, which can change over time.

Parameters

NameInRequiredDescription
account_idpathyesaccount_id parameter

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes

List users

GET /users

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

Parameters

NameInRequiredDescription
sincequerynoA user ID. Only return users with an ID greater than this ID.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno

Get a user

GET /users/{username}

Provides publicly available information about someone with a GitHub account.

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes

List attestations by bulk subject digests

POST /users/{username}/attestations/bulk-list

List a collection of artifact attestations associated with any entry in a list of subject digests owned by a user.

Parameters

NameInRequiredDescription
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
beforequerynoA cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
afterquerynoA cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
200Responseyes

Delete attestations in bulk

POST /users/{username}/attestations/delete-request

Delete artifact attestations in bulk by either subject digests or unique ID.

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.

Responses

StatusDescriptionHas JSON body
200Responseno
404Resource not foundyes

Delete attestations by subject digest

DELETE /users/{username}/attestations/digest/{subject_digest}

Delete an artifact attestation by subject digest.

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.
subject_digestpathyesSubject Digest

Responses

StatusDescriptionHas JSON body
200Responseno
204Responseno
404Resource not foundyes

Delete attestations by ID

DELETE /users/{username}/attestations/{attestation_id}

Delete an artifact attestation by unique ID that is associated with a repository owned by a user.

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.
attestation_idpathyesAttestation ID

Responses

StatusDescriptionHas JSON body
200Responseno
204Responseno
403Forbiddenyes
404Resource not foundyes

List attestations

GET /users/{username}/attestations/{subject_digest}

List a collection of artifact attestations with a given subject digest that are associated with repositories owned by a user.

Parameters

NameInRequiredDescription
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
beforequerynoA cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
afterquerynoA cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."
usernamepathyesThe handle for the GitHub user account.
subject_digestpathyesSubject Digest
predicate_typequerynoOptional filter for fetching attestations with a given predicate type.

Responses

StatusDescriptionHas JSON body
200Responseyes
201Responseyes
204Responseno
404Resource not foundyes

List followers of a user

GET /users/{username}/followers

Lists the people following the specified user.

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes

List the people a user follows

GET /users/{username}/following

Lists the people who the specified user follows.

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes

Check if a user follows another user

GET /users/{username}/following/{target_user}

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.
target_userpathyes

Responses

StatusDescriptionHas JSON body
204if the user follows the target userno
404if the user does not follow the target userno

List GPG keys for a user

GET /users/{username}/gpg_keys

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

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes

Get contextual information for a user

GET /users/{username}/hovercard

Provides hovercard information. You can find out more about someone in relation to their pull requests, issues, repositories, and organizations.

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.
subject_typequerynoIdentifies 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_idquerynoUses the ID for the subject_type you specified. Required when using subject_type.

Responses

StatusDescriptionHas JSON body
200Responseyes
404Resource not foundyes
422Validation failed, or the endpoint has been spammed.yes

List public keys for a user

GET /users/{username}/keys

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

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes

List social accounts for a user

GET /users/{username}/social_accounts

Lists social media accounts for a user. This endpoint is accessible by anyone.

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes

List SSH signing keys for a user

GET /users/{username}/ssh_signing_keys

Lists the SSH signing keys for a user. This operation is accessible by anyone.

Parameters

NameInRequiredDescription
usernamepathyesThe handle for the GitHub user account.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
pagequerynoThe page number of the results to fetch. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes