Get-GitHubUserById
SYNOPSIS
Get a user using their ID
SYNTAX
__AllParameterSets
Get-GitHubUserById [-AccountId] <long> [-Accept <string>]
ALIASES
This cmdlet has the following aliases,
- Get-GHUserById
DESCRIPTION
The Get-GitHubUserById cmdlet invokes the GET method of the /user/{account_id} endpoint (Get a user using their 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.
If you are requesting information about an Enterprise Managed User (https://docs.github.com/enterprise-cloud@latest/admin/managing-iam/understanding-iam-for-enterprises/about-enterprise-managed-users), or a GitHub App bot that is installed in an organization that uses Enterprise Managed Users, your requests must be authenticated as a user or GitHub App that has access to the organization to view that account’s information. If you are not authorized, the request will return a ‘404 Not Found’ status.
The ‘email’ key in the following response is the publicly visible email address from your GitHub profile page (https://github.com/settings/profile). 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 (https://docs.github.com/rest/guides/getting-started-with-the-rest-api#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 (https://docs.github.com/rest/users/emails).
Endpoint: GET /user/{account_id} API version: 2026-03-10
EXAMPLES
EXAMPLE 1
Get-GitHubUserById -AccountId 1
Invokes GET /user/{account_id}
PARAMETERS
-Accept
The Accept header (media type) of the request Default value: application/vnd.github+json
Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: Named
IsRequired: false
ValueFromPipeline: false
ValueFromPipelineByPropertyName: false
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
-AccountId
account_id parameter
Path parameter [ account_id ]
Type: System.Int64
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
Position: 0
IsRequired: true
ValueFromPipeline: false
ValueFromPipelineByPropertyName: true
ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
Objects with properties named like the path parameters can be piped to this function
{{ Fill in the Description }}
System.Int64
{{ Fill in the Description }}
OUTPUTS
The response of the GitHub API (objects
{{ Fill in the Description }}
NOTES
OperationId: users/get-by-id Category: users / users