You can use these endpoints to administer your enterprise.
Endpoint URLs
REST API endpoints are prefixed with the following URL:
https://api.[hostname]
Authentication
Your GitHub AE installation's API endpoints accept the same authentication methods as the GitHub.com API. You can authenticate yourself with OAuth tokens or basic authentication.
Enterprise administration API endpoints are only accessible to authenticated GitHub AE site administrators.
Version information
The current version of your enterprise is returned in the response header of every API:
X-GitHub-Enterprise-Version: github-ae@latest.0
You can also read the current version by calling the meta endpoint.
GitHub Actions
Note: GitHub Actions is currently in beta for GitHub AE.
Get GitHub Actions permissions for an enterprise
Gets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
get /enterprises/{enterprise}/actions/permissions
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/permissions
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/permissions', {
enterprise: 'enterprise'
})
Default response
Status: 200 OK
{
"enabled_organizations": "all",
"allowed_actions": "selected",
"selected_actions_url": "https://api.github.com/enterprises/2/actions/permissions/selected-actions"
}
Set GitHub Actions permissions for an enterprise
Sets the GitHub Actions permissions policy for organizations and allowed actions in an enterprise.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
put /enterprises/{enterprise}/actions/permissions
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
enabled_organizations |
string | body |
Required. The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: |
allowed_actions |
string | body |
The permissions policy that controls the actions that are allowed to run. Can be one of: |
Code samples
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/permissions \
-d '{"enabled_organizations":"enabled_organizations"}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/permissions', {
enterprise: 'enterprise',
enabled_organizations: 'enabled_organizations'
})
Default Response
Status: 204 No Content
List selected organizations enabled for GitHub Actions in an enterprise
Lists the organizations that are selected to have GitHub Actions enabled in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations
must be configured to selected
. For more information, see "Set GitHub Actions permissions for an enterprise."
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
get /enterprises/{enterprise}/actions/permissions/organizations
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
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" \
https://api.github.com/enterprises/ENTERPRISE/actions/permissions/organizations
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/permissions/organizations', {
enterprise: 'enterprise'
})
Default response
Status: 200 OK
{
"total_count": 1,
"organizations": [
{
"login": "octocat",
"id": 161335,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"url": "https://api.github.com/orgs/octo-org",
"repos_url": "https://api.github.com/orgs/octo-org/repos",
"events_url": "https://api.github.com/orgs/octo-org/events",
"hooks_url": "https://api.github.com/orgs/octo-org/hooks",
"issues_url": "https://api.github.com/orgs/octo-org/issues",
"members_url": "https://api.github.com/orgs/octo-org/members{/member}",
"public_members_url": "https://api.github.com/orgs/octo-org/public_members{/member}",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"description": "A great organization"
}
]
}
Set selected organizations enabled for GitHub Actions in an enterprise
Replaces the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations
must be configured to selected
. For more information, see "Set GitHub Actions permissions for an enterprise."
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
put /enterprises/{enterprise}/actions/permissions/organizations
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
selected_organization_ids |
array of integers | body |
Required. List of organization IDs to enable for GitHub Actions. |
Code samples
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/permissions/organizations \
-d '{"selected_organization_ids":[42]}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/permissions/organizations', {
enterprise: 'enterprise',
selected_organization_ids: [
42
]
})
Default Response
Status: 204 No Content
Enable a selected organization for GitHub Actions in an enterprise
Adds an organization to the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations
must be configured to selected
. For more information, see "Set GitHub Actions permissions for an enterprise."
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
put /enterprises/{enterprise}/actions/permissions/organizations/{org_id}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
org_id |
integer | path | Unique identifier of an organization. |
Code samples
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/permissions/organizations/42
JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/permissions/organizations/{org_id}', {
enterprise: 'enterprise',
org_id: 42
})
Default Response
Status: 204 No Content
Disable a selected organization for GitHub Actions in an enterprise
Removes an organization from the list of selected organizations that are enabled for GitHub Actions in an enterprise. To use this endpoint, the enterprise permission policy for enabled_organizations
must be configured to selected
. For more information, see "Set GitHub Actions permissions for an enterprise."
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
delete /enterprises/{enterprise}/actions/permissions/organizations/{org_id}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
org_id |
integer | path | Unique identifier of an organization. |
Code samples
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/permissions/organizations/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprises/{enterprise}/actions/permissions/organizations/{org_id}', {
enterprise: 'enterprise',
org_id: 42
})
Default Response
Status: 204 No Content
Get allowed actions for an enterprise
Gets the selected actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for allowed_actions
must be configured to selected
. For more information, see "Set GitHub Actions permissions for an enterprise."
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
get /enterprises/{enterprise}/actions/permissions/selected-actions
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/permissions/selected-actions
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/permissions/selected-actions', {
enterprise: 'enterprise'
})
Default response
Status: 200 OK
{
"github_owned_allowed": true,
"verified_allowed": false,
"patterns_allowed": [
"monalisa/octocat@*",
"docker/*"
]
}
Set allowed actions for an enterprise
Sets the actions that are allowed in an enterprise. To use this endpoint, the enterprise permission policy for allowed_actions
must be configured to selected
. For more information, see "Set GitHub Actions permissions for an enterprise."
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
put /enterprises/{enterprise}/actions/permissions/selected-actions
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
github_owned_allowed |
boolean | body |
Required. Whether GitHub-owned actions are allowed. For example, this includes the actions in the |
verified_allowed |
boolean | body |
Required. Whether actions in GitHub Marketplace from verified creators are allowed. Set to |
patterns_allowed |
array of strings | body |
Required. Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, |
Code samples
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/permissions/selected-actions \
-d '{"github_owned_allowed":true,"patterns_allowed":["patterns_allowed"],"verified_allowed":true}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/permissions/selected-actions', {
enterprise: 'enterprise',
github_owned_allowed: true,
patterns_allowed: [
'patterns_allowed'
],
verified_allowed: true
})
Default Response
Status: 204 No Content
List self-hosted runner groups for an enterprise
Lists all self-hosted runner groups for an enterprise.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
get /enterprises/{enterprise}/actions/runner-groups
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
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" \
https://api.github.com/enterprises/ENTERPRISE/actions/runner-groups
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runner-groups', {
enterprise: 'enterprise'
})
Default response
Status: 200 OK
{
"total_count": 3,
"runner_groups": [
{
"id": 1,
"name": "Default",
"visibility": "all",
"default": true,
"runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner_groups/1/runners",
"allows_public_repositories": false
},
{
"id": 2,
"name": "octo-runner-group",
"visibility": "selected",
"default": false,
"selected_organizations_url": "https://api.github.com/enterprises/octo-corp/actions/runner_groups/2/organizations",
"runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner_groups/2/runners",
"allows_public_repositories": true
},
{
"id": 3,
"name": "expensive-hardware",
"visibility": "private",
"default": false,
"runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner_groups/3/runners",
"allows_public_repositories": true
}
]
}
Create a self-hosted runner group for an enterprise
Creates a new self-hosted runner group for an enterprise.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
post /enterprises/{enterprise}/actions/runner-groups
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
name |
string | body |
Required. Name of the runner group. |
visibility |
string | body |
Visibility of a runner group. You can select all organizations or select individual organization. Can be one of: |
selected_organization_ids |
array of integers | body |
List of organization IDs that can access the runner group. |
runners |
array of integers | body |
List of runner IDs to add to the runner group. |
Code samples
Shell
curl \
-X POST \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runner-groups \
-d '{"name":"name"}'
JavaScript (@octokit/core.js)
await octokit.request('POST /enterprises/{enterprise}/actions/runner-groups', {
enterprise: 'enterprise',
name: 'name'
})
Default response
Status: 201 Created
{
"id": 2,
"name": "octo-runner-group",
"visibility": "selected",
"default": false,
"selected_organizations_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/organizations",
"runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/runners",
"allows_public_repositories": false
}
Get a self-hosted runner group for an enterprise
Gets a specific self-hosted runner group for an enterprise.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
get /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path | Unique identifier of the self-hosted runner group. |
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runner-groups/42
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}', {
enterprise: 'enterprise',
runner_group_id: 42
})
Default response
Status: 200 OK
{
"id": 2,
"name": "octo-runner-group",
"visibility": "selected",
"default": false,
"selected_organizations_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/organizations",
"runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/runners",
"allows_public_repositories": false
}
Update a self-hosted runner group for an enterprise
Updates the name
and visibility
of a self-hosted runner group in an enterprise.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
patch /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path | Unique identifier of the self-hosted runner group. |
name |
string | body |
Name of the runner group. |
visibility |
string | body |
Visibility of a runner group. You can select all organizations or select individual organizations. Can be one of: all
|
Code samples
Shell
curl \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runner-groups/42 \
-d '{"name":"name"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}', {
enterprise: 'enterprise',
runner_group_id: 42,
name: 'name'
})
Default response
Status: 200 OK
{
"id": 2,
"name": "Expensive hardware runners",
"visibility": "selected",
"default": false,
"selected_organizations_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/organizations",
"runners_url": "https://api.github.com/enterprises/octo-corp/actions/runner-groups/2/runners",
"allows_public_repositories": true
}
Delete a self-hosted runner group from an enterprise
Deletes a self-hosted runner group for an enterprise.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
delete /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path | Unique identifier of the self-hosted runner group. |
Code samples
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runner-groups/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}', {
enterprise: 'enterprise',
runner_group_id: 42
})
Default Response
Status: 204 No Content
List self-hosted runners in a group for an enterprise
Lists the self-hosted runners that are in a specific enterprise group.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
get /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path | Unique identifier of the self-hosted runner group. |
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" \
https://api.github.com/enterprises/ENTERPRISE/actions/runner-groups/42/runners
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners', {
enterprise: 'enterprise',
runner_group_id: 42
})
Default response
Status: 200 OK
{
"total_count": 2,
"runners": [
{
"id": 23,
"name": "linux_runner",
"os": "linux",
"status": "online",
"busy": true,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 11,
"name": "Linux",
"type": "read-only"
}
]
},
{
"id": 24,
"name": "mac_runner",
"os": "macos",
"status": "offline",
"busy": false,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
}
]
}
Set self-hosted runners in a group for an enterprise
Replaces the list of self-hosted runners that are part of an enterprise runner group.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
put /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path | Unique identifier of the self-hosted runner group. |
runners |
array of integers | body |
Required. List of runner IDs to add to the runner group. |
Code samples
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runner-groups/42/runners \
-d '{"runners":[42]}'
JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners', {
enterprise: 'enterprise',
runner_group_id: 42,
runners: [
42
]
})
Default Response
Status: 204 No Content
Add a self-hosted runner to a group for an enterprise
Adds a self-hosted runner to a runner group configured in an enterprise.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
put /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path | Unique identifier of the self-hosted runner group. |
runner_id |
integer | path | Unique identifier of the self-hosted runner. |
Code samples
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runner-groups/42/runners/42
JavaScript (@octokit/core.js)
await octokit.request('PUT /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id}', {
enterprise: 'enterprise',
runner_group_id: 42,
runner_id: 42
})
Default Response
Status: 204 No Content
Remove a self-hosted runner from a group for an enterprise
Removes a self-hosted runner from a group configured in an enterprise. The runner is then returned to the default group.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
delete /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_group_id |
integer | path | Unique identifier of the self-hosted runner group. |
runner_id |
integer | path | Unique identifier of the self-hosted runner. |
Code samples
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runner-groups/42/runners/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprises/{enterprise}/actions/runner-groups/{runner_group_id}/runners/{runner_id}', {
enterprise: 'enterprise',
runner_group_id: 42,
runner_id: 42
})
Default Response
Status: 204 No Content
List self-hosted runners for an enterprise
Lists all self-hosted runners configured for an enterprise.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
get /enterprises/{enterprise}/actions/runners
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
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" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runners', {
enterprise: 'enterprise'
})
Default response
Status: 200 OK
{
"total_count": 2,
"runners": [
{
"id": 23,
"name": "linux_runner",
"os": "linux",
"status": "online",
"busy": true,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 11,
"name": "Linux",
"type": "read-only"
}
]
},
{
"id": 24,
"name": "mac_runner",
"os": "macos",
"status": "offline",
"busy": false,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
}
]
}
Get a self-hosted runner for an enterprise
Gets a specific self-hosted runner configured in an enterprise.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
get /enterprises/{enterprise}/actions/runners/{runner_id}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_id |
integer | path | Unique identifier of the self-hosted runner. |
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/42
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/actions/runners/{runner_id}', {
enterprise: 'enterprise',
runner_id: 42
})
Default response
Status: 200 OK
{
"id": 23,
"name": "MBP",
"os": "macos",
"status": "online",
"busy": true,
"labels": [
{
"id": 5,
"name": "self-hosted",
"type": "read-only"
},
{
"id": 7,
"name": "X64",
"type": "read-only"
},
{
"id": 20,
"name": "macOS",
"type": "read-only"
},
{
"id": 21,
"name": "no-gpu",
"type": "custom"
}
]
}
Delete a self-hosted runner from an enterprise
Forces the removal of a self-hosted runner from an enterprise. You can use this endpoint to completely remove the runner when the machine you were using no longer exists.
You must authenticate using an access token with the admin:enterprise
scope to use this endpoint.
delete /enterprises/{enterprise}/actions/runners/{runner_id}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
enterprise |
string | path | The slug version of the enterprise name. You can also substitute this value with the enterprise id. |
runner_id |
integer | path | Unique identifier of the self-hosted runner. |
Code samples
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/actions/runners/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprises/{enterprise}/actions/runners/{runner_id}', {
enterprise: 'enterprise',
runner_id: 42
})
Default Response
Status: 204 No Content
Encryption at rest
You can use the encryption at rest API to manage the key that encrypts your data on GitHub AE. For more information, see "Configuring data encryption for your enterprise."
Get an encryption key
Warning: The encryption at rest endpoints are currently in beta and are subject to change.
Gets information about the current key used for encryption at rest.
get /enterprise/encryption
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprise/encryption
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/encryption')
Default response
Status: 200 OK
{
"updated_at": "2020-09-09T10:04:26.000Z",
"primary_key_version": "9b24a469887e416787173383958c6fb9",
"replica_key_version": "4621542832e447f285ea2dbeaf6f621b",
"backup_key_version": "d067172e711b44a5963fe53b6b976c0f"
}
Update an encryption key
Warning: The encryption at rest endpoints are currently in beta and are subject to change.
Updates the current encryption at rest key with a new private key.
You can add a new encryption key as often as you need. When you add a new key, the old key is discarded.
Your enterprise won't experience downtime when you update the key, because the key vault that GitHub manages uses the "envelope" technique. For more information, see Encryption and decryption via the envelope technique in the Azure documentation.
Your 2048 bit RSA private key should be in PEM format. For more information, see "Configuring data encryption for your enterprise."
patch /enterprise/encryption
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
key |
string | body |
Required. A 2048 bit RSA private key in PEM format. |
Code samples
Shell
curl \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprise/encryption \
-d '{"key":"key"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /enterprise/encryption', {
key: 'key'
})
Response
Status: 202 Accepted
{
"message": "Started update of private key for encryption at rest.",
"status_url": "https://octocoders.github.io/api/v3/enterprise/encryption/status/6020dd37-ce35-49e8-a15b-0b9df458c049"
}
Disable encryption at rest
Warning: The encryption at rest endpoints are currently in beta and are subject to change.
Marks your encryption key as disabled and disables encryption at rest. This will freeze your enterprise. For example, you can use this operation to freeze your enterprise in case of a breach. Note: This operation does not delete the key permanently.
It takes approximately ten minutes to disable encryption at rest. To check the status, use the "Get an encryption status" REST API.
To unfreeze your enterprise after you've disabled encryption at rest, you must contact Support. For more information, see "Receiving enterprise support."
delete /enterprise/encryption
Code samples
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprise/encryption
JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprise/encryption')
Response
Status: 202 Accepted
{
"message": "Started disabling encryption at rest.",
"status_url": "https://octocoders.github.io/api/v3/enterprise/encryption/status/db8ef711-ef82-464b-9013-5e0a1bb0031e"
}
Get an encryption status
Warning: The encryption at rest endpoints are currently in beta and are subject to change.
Checks the status of updating an encryption key or disabling encryption at rest.
get /enterprise/encryption/status/{request_id}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
request_id |
string | path | The id provided in the |
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprise/encryption/status/REQUEST_ID
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/encryption/status/{request_id}', {
request_id: 'request_id'
})
Response
Status: 200 OK
{
"result": "started",
"error": null
}
Response if the url cannot be found
Status: 404 Not Found
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.
Get statistics
There are a variety of types to choose from:
Type | Description |
---|---|
issues | The number of open and closed issues. |
hooks | The number of active and inactive hooks. |
milestones | The number of open and closed milestones. |
orgs | The number of organizations, teams, team members, and disabled organizations. |
comments | The number of comments on issues, pull requests, commits, and gists. |
pages | The number of GitHub Pages sites. |
users | The number of suspended and admin users. |
gists | The number of private and public gists. |
pulls | The number of merged, mergeable, and unmergeable pull requests. |
repos | The number of organization-owned repositories, root repositories, forks, pushed commits, and wikis. |
all | All of the statistics listed above. |
These statistics are cached and will be updated approximately every 10 minutes.
get /enterprise/stats/{type}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
type |
string | path |
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprise/stats/TYPE
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/stats/{type}', {
type: 'type'
})
Default response
Status: 200 OK
{
"repos": {
"total_repos": 212,
"root_repos": 194,
"fork_repos": 18,
"org_repos": 51,
"total_pushes": 3082,
"total_wikis": 15
},
"hooks": {
"total_hooks": 27,
"active_hooks": 23,
"inactive_hooks": 4
},
"pages": {
"total_pages": 36
},
"orgs": {
"total_orgs": 33,
"disabled_orgs": 0,
"total_teams": 60,
"total_team_members": 314
},
"users": {
"total_users": 254,
"admin_users": 45,
"suspended_users": 21
},
"pulls": {
"total_pulls": 86,
"merged_pulls": 60,
"mergeable_pulls": 21,
"unmergeable_pulls": 3
},
"issues": {
"total_issues": 179,
"open_issues": 83,
"closed_issues": 96
},
"milestones": {
"total_milestones": 7,
"open_milestones": 6,
"closed_milestones": 1
},
"gists": {
"total_gists": 178,
"private_gists": 151,
"public_gists": 25
},
"comments": {
"total_commit_comments": 6,
"total_gist_comments": 28,
"total_issue_comments": 366,
"total_pull_request_comments": 30
}
}
Announcements
The Announcements API allows you to manage the global announcement banner in your enterprise. For more information, see "Customizing user messages for your enterprise."
Get the global announcement banner
Gets the current message and expiration date of the global announcement banner in your enterprise.
get /enterprise/announcement
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprise/announcement
JavaScript (@octokit/core.js)
await octokit.request('GET /enterprise/announcement')
Default response
Status: 200 OK
{
"announcement": "Very **important** announcement about _nothing_.",
"expires_at": "2021-01-01T00:00:00.000+00:00"
}
Set the global announcement banner
Sets the message and expiration time for the global announcement banner in your enterprise.
patch /enterprise/announcement
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
announcement |
string | body |
Required. The announcement text in GitHub Flavored Markdown. For more information about GitHub Flavored Markdown, see "Mastering markdown." |
expires_at |
string or null | body |
The time at which the announcement expires. This is a timestamp in ISO 8601 format: |
Code samples
Shell
curl \
-X PATCH \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprise/announcement \
-d '{"announcement":"announcement"}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /enterprise/announcement', {
announcement: 'announcement'
})
Default response
Status: 200 OK
{
"announcement": "Very **important** announcement about _nothing_.",
"expires_at": "2021-01-01T00:00:00.000+00:00"
}
Remove the global announcement banner
Removes the global announcement banner in your enterprise.
delete /enterprise/announcement
Code samples
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprise/announcement
JavaScript (@octokit/core.js)
await octokit.request('DELETE /enterprise/announcement')
Default Response
Status: 204 No Content
Global webhooks
Global webhooks are installed on your enterprise. You can use global webhooks to automatically monitor, respond to, or enforce rules for users, organizations, teams, and repositories on your enterprise. 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.
get /admin/hooks
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
This API is under preview and subject to change. See preview notice |
accept |
string | header | This API is under preview and subject to change. |
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.superpro-preview+json" \
https://api.github.com/admin/hooks
JavaScript (@octokit/core.js)
await octokit.request('GET /admin/hooks', {
mediaType: {
previews: [
'superpro'
]
}
})
Default response
Status: 200 OK
[
{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization",
"user"
],
"config": {
"url": "https://example.com",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "https://api.github.com/admin/hooks/1",
"ping_url": "https://api.github.com/admin/hooks/1/pings"
}
]
Preview notice
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept
header:
application/vnd.github.superpro-preview+json
☝️ This header is required.
post /admin/hooks
Parameters
Name | Type | In | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
accept |
string | header |
This API is under preview and subject to change. See preview notice |
||||||||
accept |
string | header | This API is under preview and subject to change. |
||||||||
name |
string | body |
Required. Must be passed as "web". |
||||||||
config |
object | body |
Required. Key/value pairs to provide settings for this webhook. |
||||||||
config object |
url (string) |
Required. The URL to which the payloads will be delivered. |
content_type (string) |
The media type used to serialize the payloads. Supported values include |
secret (string) |
If provided, the |
insecure_ssl (string) |
Determines whether the SSL certificate of the host for |
events
The events that trigger this webhook. A global webhook can be triggered by user
and organization
events. Default: user
and organization
.
active
Determines if notifications are sent when the webhook is triggered. Set to true
to send notifications.
true
Code samples
Shell
curl \
-X POST \
-H "Accept: application/vnd.github.superpro-preview+json" \
https://api.github.com/admin/hooks \
-d '{"name":"name","config":{"url":"url","content_type":"content_type","secret":"secret","insecure_ssl":"insecure_ssl"}}'
JavaScript (@octokit/core.js)
await octokit.request('POST /admin/hooks', {
name: 'name',
config: {
url: 'url',
content_type: 'content_type',
secret: 'secret',
insecure_ssl: 'insecure_ssl'
},
mediaType: {
previews: [
'superpro'
]
}
})
Default response
Status: 201 Created
{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization",
"user"
],
"config": {
"url": "https://example.com",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "https://api.github.com/admin/hooks/1",
"ping_url": "https://api.github.com/admin/hooks/1/pings"
}
Preview notice
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept
header:
application/vnd.github.superpro-preview+json
☝️ This header is required.
get /admin/hooks/{hook_id}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
This API is under preview and subject to change. See preview notice |
accept |
string | header | This API is under preview and subject to change. |
hook_id |
integer | path |
Code samples
Shell
curl \
-H "Accept: application/vnd.github.superpro-preview+json" \
https://api.github.com/admin/hooks/42
JavaScript (@octokit/core.js)
await octokit.request('GET /admin/hooks/{hook_id}', {
hook_id: 42,
mediaType: {
previews: [
'superpro'
]
}
})
Default response
Status: 200 OK
{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization",
"user"
],
"config": {
"url": "https://example.com",
"content_type": "json",
"insecure_ssl": "0",
"secret": "********"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "https://api.github.com/admin/hooks/1",
"ping_url": "https://api.github.com/admin/hooks/1/pings"
}
Preview notice
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept
header:
application/vnd.github.superpro-preview+json
☝️ This header is required.
Update a global webhook
Parameters that are not provided will be overwritten with the default value or removed if no default exists.
patch /admin/hooks/{hook_id}
Parameters
Name | Type | In | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
accept |
string | header |
This API is under preview and subject to change. See preview notice |
||||||||
accept |
string | header | This API is under preview and subject to change. |
||||||||
hook_id |
integer | path | |||||||||
config |
object | body |
Key/value pairs to provide settings for this webhook. |
||||||||
config object |
url (string) |
Required. The URL to which the payloads will be delivered. |
content_type (string) |
The media type used to serialize the payloads. Supported values include |
secret (string) |
If provided, the |
insecure_ssl (string) |
Determines whether the SSL certificate of the host for |
events
The events that trigger this webhook. A global webhook can be triggered by user
and organization
events. Default: user
and organization
.
active
Determines if notifications are sent when the webhook is triggered. Set to true
to send notifications.
true
Code samples
Shell
curl \
-X PATCH \
-H "Accept: application/vnd.github.superpro-preview+json" \
https://api.github.com/admin/hooks/42 \
-d '{"config":{"url":"url","content_type":"content_type","secret":"secret","insecure_ssl":"insecure_ssl"}}'
JavaScript (@octokit/core.js)
await octokit.request('PATCH /admin/hooks/{hook_id}', {
hook_id: 42,
config: {
url: 'url',
content_type: 'content_type',
secret: 'secret',
insecure_ssl: 'insecure_ssl'
},
mediaType: {
previews: [
'superpro'
]
}
})
Default response
Status: 200 OK
{
"type": "Global",
"id": 1,
"name": "web",
"active": true,
"events": [
"organization"
],
"config": {
"url": "https://example.com",
"content_type": "form",
"insecure_ssl": "0"
},
"updated_at": "2017-12-07T00:14:59Z",
"created_at": "2017-12-07T00:14:59Z",
"url": "https://api.github.com/admin/hooks/1",
"ping_url": "https://api.github.com/admin/hooks/1/pings"
}
Preview notice
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept
header:
application/vnd.github.superpro-preview+json
☝️ This header is required.
delete /admin/hooks/{hook_id}
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
This API is under preview and subject to change. See preview notice |
accept |
string | header | This API is under preview and subject to change. |
hook_id |
integer | path |
Code samples
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.superpro-preview+json" \
https://api.github.com/admin/hooks/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/hooks/{hook_id}', {
hook_id: 42,
mediaType: {
previews: [
'superpro'
]
}
})
Default Response
Status: 204 No Content
Preview notice
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept
header:
application/vnd.github.superpro-preview+json
☝️ This header is required.
Ping a global webhook
This will trigger a ping event to be sent to the webhook.
post /admin/hooks/{hook_id}/pings
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
This API is under preview and subject to change. See preview notice |
accept |
string | header | This API is under preview and subject to change. |
hook_id |
integer | path |
Code samples
Shell
curl \
-X POST \
-H "Accept: application/vnd.github.superpro-preview+json" \
https://api.github.com/admin/hooks/42/pings
JavaScript (@octokit/core.js)
await octokit.request('POST /admin/hooks/{hook_id}/pings', {
hook_id: 42,
mediaType: {
previews: [
'superpro'
]
}
})
Default Response
Status: 204 No Content
Preview notice
The Global Webhooks API is currently available for developers to preview. To access the API during the preview period, you must provide a custom media type in the Accept
header:
application/vnd.github.superpro-preview+json
☝️ This header is required.
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
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/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"
}
Organizations
The Organization Administration API allows you to create organizations on your enterprise. 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 |
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" \
https://api.github.com/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 |
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" \
https://api.github.com/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"
}
Users
The User Administration API allows you to suspend and unsuspend users on your enterprise. 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 |
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" \
https://api.github.com/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 |
key_ids |
string | path |
Code samples
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/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 |
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" \
https://api.github.com/admin/tokens
JavaScript (@octokit/core.js)
await octokit.request('GET /admin/tokens')
Default response
Status: 200 OK
[
{
"id": 1,
"url": "https://api.github.com/authorizations/1",
"scopes": [
"public_repo"
],
"token": "",
"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 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 |
token_id |
integer | path |
Code samples
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/admin/tokens/42
JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/tokens/{token_id}', {
token_id: 42
})
Default Response
Status: 204 No Content
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 |
username |
string | path |
Code samples
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/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 |
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" \
https://api.github.com/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": ""
}
delete /admin/users/{username}/authorizations
Parameters
Name | Type | In | Description |
---|---|---|---|
accept |
string | header |
Setting to |
username |
string | path |
Code samples
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/admin/users/USERNAME/authorizations
JavaScript (@octokit/core.js)
await octokit.request('DELETE /admin/users/{username}/authorizations', {
username: 'username'
})
Default Response
Status: 204 No Content
Suspend a user
If your GitHub 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 |
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 |
Code samples
Shell
curl \
-X PUT \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/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 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 |
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 |
Code samples
Shell
curl \
-X DELETE \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/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