This version of GitHub Enterprise will be discontinued on This version of GitHub Enterprise was discontinued on 2020-08-20. 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.

Article version: Enterprise Server 2.18

GitHub Enterprise administration

In this article

You can use these endpoints to administer your enterprise account.

Endpoint URLs

REST API endpoints—except Management Console API endpoints—are prefixed with the following URL:

http(s)://hostname/api/v3/

Management Console API endpoints are only prefixed with a hostname:

http(s)://hostname/

Authentication

Your GitHub Enterprise installation's API endpoints accept the same authentication methods as the GitHub.com API. You can authenticate yourself with OAuth tokens (which can be created using the Authorizations API) or basic authentication. OAuth tokens must have the site_admin OAuth scope when used with Enterprise-specific endpoints.

Enterprise administration API endpoints are only accessible to authenticated GitHub Enterprise site administrators, except for the Management Console API, which requires the Management Console password.

Version information

The current version of a GitHub Enterprise instance is returned in the response header of every API: X-GitHub-Enterprise-Version: 2.18.0 You can also read the current version by calling the meta endpoint.

Admin stats

The Admin Stats API provides a variety of metrics about your installation. It is only available to authenticated site administrators. Normal users will receive a 404 response if they try to access it.

Global webhooks

Global webhooks are installed on a GitHub Enterprise instance. You can use global webhooks to automatically monitor, respond to, or enforce rules for users, organizations, teams, and repositories on your instance. Global webhooks can subscribe to the organization, user, repository, team, member, membership, fork, and ping event types.

This API is only available to authenticated site administrators. Normal users will receive a 404 response if they try to access it. To learn how to configure global webhooks, see About global webhooks.

LDAP

You can use the LDAP API to update account relationships between a GitHub Enterprise Server user or team and its linked LDAP entry or queue a new synchronization.

With the LDAP mapping endpoints, you're able to update the Distinguished Name (DN) that a user or team maps to. Note that the LDAP endpoints are generally only effective if your GitHub Enterprise Server appliance has LDAP Sync enabled. The Update LDAP mapping for a user endpoint can be used when LDAP is enabled, even if LDAP Sync is disabled.

Update LDAP mapping for a team

Updates the distinguished name (DN) of the LDAP entry to map to a team. LDAP synchronization must be enabled to map LDAP entries to a team. Use the Create a team endpoint to create a team with LDAP mapping.

If you pass the hellcat-preview media type, you can also update the LDAP mapping of a child team.

patch /admin/ldap/teams/{team_id}/mapping

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

See preview notice.
team_id integer path
ldap_dn string body

The distinguished name (DN) of the LDAP entry to map to a team.

Code samples

Shell
curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/ldap/teams/42/mapping \
  -d '{"ldap_dn":"ldap_dn"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /admin/ldap/teams/{team_id}/mapping', {
  team_id: 42,
  ldap_dn: 'ldap_dn'
})

Default response

Status: 200 OK
{
  "ldap_dn": "cn=Enterprise Ops,ou=teams,dc=github,dc=com",
  "id": 1,
  "node_id": "MDQ6VGVhbTE=",
  "url": "https://api.github.com/teams/1",
  "html_url": "https://api.github.com/teams/justice-league",
  "name": "Justice League",
  "slug": "justice-league",
  "description": "A great team.",
  "privacy": "closed",
  "permission": "admin",
  "members_url": "https://api.github.com/teams/1/members{/member}",
  "repositories_url": "https://api.github.com/teams/1/repos",
  "parent": null
}

Preview notice

The Nested Teams API is currently available for developers to preview. See the blog post for full details. To access the API, you must provide a custom media type in the Accept header:

application/vnd.github.hellcat-preview+json

Sync LDAP mapping for a team

Note that this API call does not automatically initiate an LDAP sync. Rather, if a 201 is returned, the sync job is queued successfully, and is performed when the instance is ready.

post /admin/ldap/teams/{team_id}/sync

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

team_id integer path

Code samples

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/ldap/teams/42/sync
JavaScript (@octokit/core.js)
await octokit.request('POST /admin/ldap/teams/{team_id}/sync', {
  team_id: 42
})

Response

Status: 201 Created
{
  "status": "queued"
}

patch /admin/ldap/users/{username}/mapping

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

username string path
ldap_dn string body

The distinguished name (DN) of the LDAP entry to map to a team.

Code samples

Shell
curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/ldap/users/USERNAME/mapping \
  -d '{"ldap_dn":"ldap_dn"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /admin/ldap/users/{username}/mapping', {
  username: 'username',
  ldap_dn: 'ldap_dn'
})

Default response

Status: 200 OK
{
  "ldap_dn": "uid=asdf,ou=users,dc=github,dc=com",
  "login": "octocat",
  "id": 1,
  "node_id": "MDQ6VXNlcjE=",
  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
  "gravatar_id": "",
  "url": "https://api.github.com/users/octocat",
  "html_url": "https://github.com/octocat",
  "followers_url": "https://api.github.com/users/octocat/followers",
  "following_url": "https://api.github.com/users/octocat/following{/other_user}",
  "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
  "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
  "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
  "organizations_url": "https://api.github.com/users/octocat/orgs",
  "repos_url": "https://api.github.com/users/octocat/repos",
  "events_url": "https://api.github.com/users/octocat/events{/privacy}",
  "received_events_url": "https://api.github.com/users/octocat/received_events",
  "type": "User",
  "site_admin": false
}

Sync LDAP mapping for a user

Note that this API call does not automatically initiate an LDAP sync. Rather, if a 201 is returned, the sync job is queued successfully, and is performed when the instance is ready.

post /admin/ldap/users/{username}/sync

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

username string path

Code samples

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/ldap/users/USERNAME/sync
JavaScript (@octokit/core.js)
await octokit.request('POST /admin/ldap/users/{username}/sync', {
  username: 'username'
})

Response

Status: 201 Created
{
  "status": "queued"
}

License

The License API provides information on your Enterprise license. It is only available to authenticated site administrators. Normal users will receive a 404 response if they try to access it.

get /enterprise/settings/license

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

Code samples

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

Default response

Status: 200 OK
{
  "seats": 1400,
  "seats_used": 1316,
  "seats_available": 84,
  "kind": "standard",
  "days_until_expiration": 365,
  "expire_at": "2016/02/06 12:41:52 -0600"
}

Management console

The Management Console API helps you manage your GitHub Enterprise Server installation.

You must explicitly set the port number when making API calls to the Management Console. If TLS is enabled on your Enterprise instance, the port number is 8443; otherwise, the port number is 8080.

If you don't want to provide a port number, you'll need to configure your tool to automatically follow redirects.

You may also need to add the -k flag when using curl, since GitHub Enterprise Server uses a self-signed certificate before you add your own TLS certificate.

Authentication

You need to pass your Management Console password as an authentication token to every Management Console API endpoint except /setup/api/start.

Use the api_key parameter to send this token with each request. For example:

$ curl -L 'https://hostname:admin_port/setup/api?api_key=your-amazing-password'

You can also use standard HTTP authentication to send this token. For example:

$ curl -L 'https://api_key:your-amazing-password@hostname:admin_port/setup/api'

Organizations

The Organization Administration API allows you to create organizations on a GitHub Enterprise Server appliance. It is only available to authenticated site administrators. Normal users will receive a 404 response if they try to access it.

post /admin/organizations

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

login string body

Required. The organization's username.

admin string body

Required. The login of the user who will manage this organization.

profile_name string body

The organization's display name.

Code samples

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/organizations \
  -d '{"login":"login","admin":"admin"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /admin/organizations', {
  login: 'login',
  admin: 'admin'
})

Default response

Status: 201 Created
{
  "login": "github",
  "id": 1,
  "node_id": "MDEyOk9yZ2FuaXphdGlvbjE=",
  "url": "https://api.github.com/orgs/github",
  "repos_url": "https://api.github.com/orgs/github/repos",
  "events_url": "https://api.github.com/orgs/github/events",
  "hooks_url": "https://api.github.com/orgs/github/hooks",
  "issues_url": "https://api.github.com/orgs/github/issues",
  "members_url": "https://api.github.com/orgs/github/members{/member}",
  "public_members_url": "https://api.github.com/orgs/github/public_members{/member}",
  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
  "description": "A great organization"
}

patch /admin/organizations/{org}

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

org string path
login string body

Required. The organization's new name.

Code samples

Shell
curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/organizations/ORG \
  -d '{"login":"login"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /admin/organizations/{org}', {
  org: 'org',
  login: 'login'
})

Response

Status: 202 Accepted
{
  "message": "Job queued to rename organization. It may take a few minutes to complete.",
  "url": "https://<hostname>/api/v3/organizations/1"
}

Organization pre-receive hooks

The Organization Pre-receive Hooks API allows you to view and modify enforcement of the pre-receive hooks that are available to an organization.

Object attributes

NameTypeDescription
namestringThe name of the hook.
enforcementstringThe state of enforcement for the hook on this repository.
allow_downstream_configurationbooleanWhether repositories can override enforcement.
configuration_urlstringURL for the endpoint where enforcement is set.

Possible values for enforcement are enabled, disabled andtesting. disabled indicates the pre-receive hook will not run. enabled indicates it will run and reject any pushes that result in a non-zero status. testing means the script will run but will not cause any pushes to be rejected.

configuration_url may be a link to this endpoint or this hook's global configuration. Only site admins are able to access the global configuration.

Pre-receive environments

The Pre-receive Environments API allows you to create, list, update and delete environments for pre-receive hooks. It is only available to authenticated site administrators. Normal users will receive a 404 response if they try to access it.

Object attributes

Pre-receive Environment

NameTypeDescription
namestringThe name of the environment as displayed in the UI.
image_urlstringURL to the tarball that will be downloaded and extracted.
default_environmentbooleanWhether this is the default environment that ships with GitHub Enterprise Server.
downloadobjectThis environment's download status.
hooks_countintegerThe number of pre-receive hooks that use this environment.

Pre-receive Environment Download

NameTypeDescription
statestringThe state of the most recent download.
downloaded_atstringThe time when the most recent download started.
messagestringOn failure, this will have any error messages produced.

Possible values for state are not_started, in_progress, success, failed.

Pre-receive hooks

The Pre-receive Hooks API allows you to create, list, update and delete pre-receive hooks. It is only available to authenticated site administrators. Normal users will receive a 404 response if they try to access it.

Object attributes

Pre-receive Hook

NameTypeDescription
namestringThe name of the hook.
scriptstringThe script that the hook runs.
script_repositoryobjectThe GitHub repository where the script is kept.
environmentobjectThe pre-receive environment where the script is executed.
enforcementstringThe state of enforcement for this hook.
allow_downstream_configurationbooleanWhether enforcement can be overridden at the org or repo level.

Possible values for enforcement are enabled, disabled andtesting. disabled indicates the pre-receive hook will not run. enabled indicates it will run and reject any pushes that result in a non-zero status. testing means the script will run but will not cause any pushes to be rejected.

Repository pre-receive hooks

The Repository Pre-receive Hooks API allows you to view and modify enforcement of the pre-receive hooks that are available to a repository.

Object attributes

NameTypeDescription
namestringThe name of the hook.
enforcementstringThe state of enforcement for the hook on this repository.
configuration_urlstringURL for the endpoint where enforcement is set.

Possible values for enforcement are enabled, disabled andtesting. disabled indicates the pre-receive hook will not run. enabled indicates it will run and reject any pushes that result in a non-zero status. testing means the script will run but will not cause any pushes to be rejected.

configuration_url may be a link to this repository, it's organization owner or global configuration. Authorization to access the endpoint at configuration_url is determined at the owner or site admin level.

Search indexing

The Search Indexing API allows you to queue up a variety of search indexing tasks. It is only available to authenticated site administrators. Normal users will receive a 404 response if they try to access it.

Users

The User Administration API allows you to promote, demote, suspend, and unsuspend users on a GitHub Enterprise Server appliance. It is only available to authenticated site administrators. Normal users will receive a 403 response if they try to access it.

get /admin/keys

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

Code samples

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

Default response

Status: 200 OK
[
  {
    "key_id": "012345678912345678",
    "key": "2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234",
    "user_id": 232,
    "repository_id": null
  },
  {
    "key_id": "012345678912345678",
    "key": "2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvv1234",
    "user_id": null,
    "repository_id": 2333,
    "id": "2",
    "url": "https://api.github.com/repos/octocat/Hello-World/keys/2"
  }
]

delete /admin/keys/{key_ids}

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

key_ids string path

Code samples

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/keys/KEY_IDS
JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/keys/{key_ids}', {
  key_ids: 'key_ids'
})

Default Response

Status: 204 No Content

List personal access tokens

Lists personal access tokens for all users, including admin users.

get /admin/tokens

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

per_page integer query

Results per page (max 100)

page integer query

Page number of the results to fetch.

Code samples

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

Default response

Status: 200 OK
[
  {
    "id": 2,
    "url": "https://enterprise.octocat.com/api/v3/authorizations/2",
    "app": {
      "name": "My personal access token",
      "url": "https://developer.github.com/enterprise/v3/enterprise-admin/users/#list-personal-access-tokens",
      "client_id": "00000000000000000000"
    },
    "token": "",
    "hashed_token": "23cffb2fab1b0a62747863eba88cb9327e561f2f7a0c8661c0d9b83146cb8d45",
    "token_last_eight": "848f9f8a",
    "note": "My personal access token",
    "note_url": null,
    "created_at": "2019-04-24T21:49:02Z",
    "updated_at": "2019-04-24T21:49:02Z",
    "scopes": [
      "admin:business",
      "admin:gpg_key",
      "admin:org",
      "admin:org_hook",
      "admin:pre_receive_hook",
      "admin:public_key",
      "admin:repo_hook",
      "delete_repo",
      "gist",
      "notifications",
      "repo",
      "user",
      "write:discussion"
    ],
    "fingerprint": null
  }
]

Delete a personal access token

Deletes a personal access token. Returns a 403 - Forbidden status when a personal access token is in use. For example, if you access this endpoint with the same personal access token that you are trying to delete, you will receive this error.

delete /admin/tokens/{token_id}

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

token_id integer path

Code samples

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/tokens/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/tokens/{token_id}', {
  token_id: 42
})

Default Response

Status: 204 No Content

Create a user

If an external authentication mechanism is used, the login name should match the login name in the external system. If you are using LDAP authentication, you should also update the LDAP mapping for the user.

The login name will be normalized to only contain alphanumeric characters or single hyphens. For example, if you send "octo_cat" as the login, a user named "octo-cat" will be created.

If the login name or email address is already associated with an account, the server will return a 422 response.

post /admin/users

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

login string body

Required. The user's username.

email string body

Required for built-in authentication. The user's email address. This parameter can be omitted when using CAS, LDAP, or SAML. For details on built-in and centrally-managed authentication, see the the GitHub Enterprise Server authentication guide.

Code samples

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/users \
  -d '{"login":"login"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /admin/users', {
  login: 'login'
})

Default response

Status: 201 Created
{
  "login": "octocat",
  "id": 1,
  "node_id": "MDQ6VXNlcjE=",
  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
  "gravatar_id": "",
  "url": "https://api.github.com/users/octocat",
  "html_url": "https://github.com/octocat",
  "followers_url": "https://api.github.com/users/octocat/followers",
  "following_url": "https://api.github.com/users/octocat/following{/other_user}",
  "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
  "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
  "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
  "organizations_url": "https://api.github.com/users/octocat/orgs",
  "repos_url": "https://api.github.com/users/octocat/repos",
  "events_url": "https://api.github.com/users/octocat/events{/privacy}",
  "received_events_url": "https://api.github.com/users/octocat/received_events",
  "type": "User",
  "site_admin": false
}

patch /admin/users/{username}

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

username string path
login string body

Required. The user's new username.

Code samples

Shell
curl \
  -X PATCH \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/users/USERNAME \
  -d '{"login":"login"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /admin/users/{username}', {
  username: 'username',
  login: 'login'
})

Response

Status: 202 Accepted
{
  "message": "Job queued to rename user. It may take a few minutes to complete.",
  "url": "https://api.github.com/user/1"
}

Delete a user

Deleting a user will delete all their repositories, gists, applications, and personal settings. Suspending a user is often a better option.

You can delete any user account except your own.

delete /admin/users/{username}

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

username string path

Code samples

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/users/USERNAME
JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/users/{username}', {
  username: 'username'
})

Default Response

Status: 204 No Content

post /admin/users/{username}/authorizations

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

username string path
scopes array of strings body

A list of scopes.

Code samples

Shell
curl \
  -X POST \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/users/USERNAME/authorizations \
  -d '{"scopes":["scopes"]}'
JavaScript (@octokit/core.js)
await octokit.request('POST /admin/users/{username}/authorizations', {
  username: 'username',
  scopes: [
    'scopes'
  ]
})

Default response

Status: 201 Created
{
  "id": 1,
  "url": "https://api.github.com/authorizations/1",
  "scopes": [
    "public_repo"
  ],
  "token": "abcdefgh12345678",
  "token_last_eight": "12345678",
  "hashed_token": "25f94a2a5c7fbaf499c665bc73d67c1c87e496da8985131633ee0a95819db2e8",
  "app": {
    "url": "http://my-github-app.com",
    "name": "my github app",
    "client_id": "abcde12345fghij67890"
  },
  "note": "optional note",
  "note_url": "http://optional/note/url",
  "updated_at": "2011-09-06T20:39:23Z",
  "created_at": "2011-09-06T17:26:27Z",
  "fingerprint": "jklmnop12345678"
}

delete /admin/users/{username}/authorizations

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

username string path

Code samples

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/admin/users/USERNAME/authorizations
JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/users/{username}/authorizations', {
  username: 'username'
})

Default Response

Status: 204 No Content

Promote a user to be a site administrator

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

put /users/{username}/site_admin

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

username string path

Code samples

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/users/USERNAME/site_admin
JavaScript (@octokit/core.js)
await octokit.request('PUT /users/{username}/site_admin', {
  username: 'username'
})

Default Response

Status: 204 No Content

Demote a site administrator

You can demote any user account except your own.

delete /users/{username}/site_admin

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

username string path

Code samples

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/users/USERNAME/site_admin
JavaScript (@octokit/core.js)
await octokit.request('DELETE /users/{username}/site_admin', {
  username: 'username'
})

Default Response

Status: 204 No Content

Suspend a user

If your GitHub Enterprise Server instance uses LDAP Sync with Active Directory LDAP servers, Active Directory LDAP-authenticated users cannot be suspended through this API. If you attempt to suspend an Active Directory LDAP-authenticated user through this API, it will return a 403 response.

You can suspend any user account except your own.

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

put /users/{username}/suspended

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

username string path
reason string body

The reason the user is being suspended. This message will be logged in the audit log. If you don't provide a reason, it will default to "Suspended via API by SITE_ADMINISTRATOR", where SITE_ADMINISTRATOR is the person who performed the action.

Code samples

Shell
curl \
  -X PUT \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/users/USERNAME/suspended \
  -d '{"reason":"reason"}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /users/{username}/suspended', {
  username: 'username',
  reason: 'reason'
})

Default Response

Status: 204 No Content

Unsuspend a user

If your GitHub Enterprise Server instance uses LDAP Sync with Active Directory LDAP servers, this API is disabled and will return a 403 response. Active Directory LDAP-authenticated users cannot be unsuspended using the API.

delete /users/{username}/suspended

Parameters

Name Type In Description
accept string header

Setting to application/vnd.github.v3+json is recommended

username string path
reason string body

The reason the user is being unsuspended. This message will be logged in the audit log. If you don't provide a reason, it will default to "Unsuspended via API by SITE_ADMINISTRATOR", where SITE_ADMINISTRATOR is the person who performed the action.

Code samples

Shell
curl \
  -X DELETE \
  -H "Accept: application/vnd.github.v3+json" \
  http://{hostname}/users/USERNAME/suspended \
  -d '{"reason":"reason"}'
JavaScript (@octokit/core.js)
await octokit.request('DELETE /users/{username}/suspended', {
  username: 'username',
  reason: 'reason'
})

Default Response

Status: 204 No Content

Ask a human

Can't find what you're looking for?

Contact us