This version of GitHub Enterprise was discontinued on 2021-06-09. No patch releases will be made, even for critical security issues. For better performance, improved security, and new features, upgrade to the latest version of GitHub Enterprise. For help with the upgrade, contact GitHub Enterprise support.

Users

The Users API allows to get public and private information about the authenticated user.

Many of the resources on the users API provide a shortcut for getting information about the currently authenticated user. If a request URL does not include a {username} parameter then the response will be for the logged in user (and you must pass authentication information with your request). Additional private information, such as whether a user has two-factor authentication enabled, is included when authenticated through basic auth or OAuth with the user scope.

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.

get /user

Code samples

Shell
curl \
  -H "Accept: application/vnd.github.v3+json" \
  http(s)://{hostname}/api/v3/user
JavaScript (@octokit/core.js)
await octokit.request('GET /user')

Response with public and private profile information

Status: 200 OK
{