Authentication and connection options
Lists global security advisories from the GitHub Advisory Database.
GET /advisories
Optionalparams: AdvisoriesParamsOptional filters: ghsa_id, cve_id, ecosystem, severity, cwe_id, is_withdrawn, sort, direction, per_page, page
Optionalsignal: AbortSignalA paged response of global advisories
Fetches a single global security advisory by its GHSA ID.
GET /advisories/{ghsa_id}
The GHSA identifier (e.g., 'GHSA-xxxx-xxxx-xxxx')
Optionalsignal: AbortSignalThe advisory object
Fetches a global security advisory by its CVE ID.
GET /advisories?cve_id={cveId}
The CVE identifier (e.g., 'CVE-2021-44228')
Optionalsignal: AbortSignalThe advisory object, or null if no advisory is found for the given CVE ID
Creates a new gist.
POST /gists
Gist files and optional description/visibility
Optionalsignal: AbortSignalFetches the authenticated user's profile.
GET /user
Optionalsignal: AbortSignalThe authenticated user object
Returns a GistResource for a given gist ID.
The returned resource can be awaited directly to fetch the gist, or chained to access nested resources (comments, forks, star).
The gist ID
A chainable gist resource
Executes an arbitrary GitHub GraphQL query.
POST https://api.github.com/graphql
The GraphQL query string
Optionalvariables: Record<string, unknown>Optional query variables
Optionalsignal: AbortSignalOptional AbortSignal
The data field of the GraphQL response
Lists issues assigned to the authenticated user across all repositories.
GET /issues
Note: GitHub returns pull requests as issues in this endpoint.
Filter them out by checking for the absence of pull_request on each item.
Optionalparams: IssuesParamsOptional filters: filter, state, labels, sort, direction, since, per_page, page
Optionalsignal: AbortSignalA paged response of issues
Lists gists for the authenticated user (or publicly if unauthenticated).
GET /gists
Optionalparams: GistsParamsOptional filters: since, per_page, page
Optionalsignal: AbortSignalMarks a single notification thread as read.
PATCH /notifications/threads/{thread_id}
Returns void — GitHub responds with 205 No Content on success.
The numeric thread ID (from GitHubNotification.id)
Optionalsignal: AbortSignalLists notifications for the authenticated user.
GET /notifications
Optionalparams: NotificationsParamsOptional filters: all, participating, since, before, per_page, page
Optionalsignal: AbortSignalA paged response of notification threads
Subscribes to a client event.
Returns an OrganizationResource for a given GitHub organization, providing access to organization data and its repositories.
The returned resource can be awaited directly to fetch organization info, or chained to access nested resources.
The organization's login name (e.g., 'github')
A chainable organization resource
Returns a RepositoryResource for a given owner and repository name.
Shortcut that works for both user repositories and organization repositories.
The owner login (user or organization)
The repository name
A chainable repository resource
Searches for code using GitHub's search syntax.
GET /search/code
Search query and optional sort/order. q is required.
Optionalsignal: AbortSignalA paged response of code results with totalCount
Searches for issues and pull requests using GitHub's search syntax.
GET /search/issues
Search query and optional sort/order. q is required.
Optionalsignal: AbortSignalA paged response of issues/PRs with totalCount
// Open PRs authored by a user
const results = await gh.searchIssues({ q: 'is:pr is:open author:octocat' });
console.log(`Found ${results.totalCount} pull requests`);
// Stale issues not updated in 30+ days
const stale = await gh.searchIssues({ q: 'is:issue is:open updated:<2024-01-01', sort: 'updated' });
Searches for repositories using GitHub's search syntax.
GET /search/repositories
Search query and optional filters. q is required.
Optionalsignal: AbortSignalA paged response of repositories with totalCount
Searches for users using GitHub's search syntax.
GET /search/users
Search query and optional sort/order. q is required.
Optionalsignal: AbortSignalA paged response of users with totalCount
Returns a UserResource for a given GitHub login, providing access to user data and their repositories.
The returned resource can be awaited directly to fetch user info, or chained to access nested resources.
The user's login name (e.g., 'octocat')
A chainable user resource
Main entry point for the GitHub REST API client.
Example