Skip to main content

This version of GitHub Enterprise was discontinued on 2023-07-06. 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.

Managing enterprise accounts

You can manage your enterprise account and the organizations it owns with the GraphQL API.

About managing enterprise accounts with GraphQL

To help you monitor and make changes in your organizations and maintain compliance, you can use the Enterprise Accounts API and the Audit Log API, which are only available as GraphQL APIs.

The enterprise account endpoints work for both GitHub Enterprise Cloud and for GitHub Enterprise Server.

GraphQL allows you to request and return just the data you specify. For example, you can create a GraphQL query, or request for information, to see all the new organization members added to your organization. Or you can make a mutation, or change, to invite an administrator to your enterprise account.

With the Audit Log API, you can monitor when someone:

  • Accesses your organization or repository settings.
  • Changes permissions.
  • Adds or removes users in an organization, repository, or team.
  • Promotes users to admin.
  • Changes permissions of a GitHub App.

The Audit Log API enables you to keep copies of your audit log data. For queries made with the Audit Log API, the GraphQL response can include data for up to 90 to 120 days. For a list of the fields available with the Audit Log API, see the "Interfaces."

With the Enterprise Accounts API, you can:

  • List and review all of the organizations and repositories that belong to your enterprise account.
  • Change Enterprise account settings.
  • Configure policies for settings on your enterprise account and its organizations.
  • Invite administrators to your enterprise account.
  • Create new organizations in your enterprise account.

For a list of the fields available with the Enterprise Accounts API, see "Managing enterprise accounts."

Getting started using GraphQL for enterprise accounts

Follow these steps to get started using GraphQL to manage your enterprise accounts:

  • Authenticating with a personal access token
  • Choosing a GraphQL client or using the GraphQL Explorer
  • Setting up Insomnia to use the GraphQL API

For some example queries, see "An example query using the Enterprise Accounts API."

1. Authenticate with your personal access token

  1. To authenticate with GraphQL, you need to generate a personal access token from developer settings. For more information, see "Managing your personal access tokens."

  2. Grant admin and full control permissions to your personal access token for areas of your enterprise you'd like to access. For full permission to private repositories, organizations, teams, user data, and access to enterprise billing and profile data, we recommend you select these scopes for your personal access token: