Note: This article applies to GitHub Enterprise Cloud. To see the GitHub AE or GitHub Enterprise Server version, use the Article version drop-down menu.
Endpoint URLs
REST API endpoints are prefixed with the following URL:
https://api.github.com
When endpoints include {enterprise}, replace {enterprise} with the handle for your enterprise account, which is included in the URL for your enterprise settings. For example, if your enterprise account is located at https://github.com/enterprises/octo-enterprise, replace {enterprise} with octo-enterprise.
Audit log
Get the audit log for an enterprise
Gets the audit log for an enterprise. To use this endpoint, you must be an enterprise admin, and you must use an access token with the admin:enterprise scope.
get /enterprises/{enterprise}/audit-log
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. |
phrase |
string | query |
A search phrase. For more information, see Searching the audit log. |
include |
string | query |
The event types to include:
The default is |
after |
string | query |
A cursor, as given in the Link header. If specified, the query only searches for events after this cursor. |
before |
string | query |
A cursor, as given in the Link header. If specified, the query only searches for events before this cursor. |
order |
string | query |
The order of audit log events. To list newest events first, specify The default is |
page |
integer | query |
Page number of the results to fetch. Default:1 |
per_page |
integer | query |
Results per page (max 100) Default:30 |
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/audit-logJavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/audit-log', {
enterprise: 'enterprise'
})
Response
Status: 200 OK
[
{
"@timestamp": 1606929874512,
"action": "team.add_member",
"actor": "octocat",
"created_at": 1606929874512,
"_document_id": "xJJFlFOhQ6b-5vaAFy9Rjw",
"org": "octo-corp",
"team": "octo-corp/example-team",
"user": "monalisa"
},
{
"@timestamp": 1606507117008,
"action": "org.create",
"actor": "octocat",
"created_at": 1606507117008,
"_document_id": "Vqvg6kZ4MYqwWRKFDzlMoQ",
"org": "octocat-test-org"
},
{
"@timestamp": 1605719148837,
"action": "repo.destroy",
"actor": "monalisa",
"created_at": 1605719148837,
"_document_id": "LwW2vpJZCDS-WUmo9Z-ifw",
"org": "mona-org",
"repo": "mona-org/mona-test-repo",
"visibility": "private"
}
]
Billing
Get GitHub Actions billing for an enterprise
Gets the summary of the free and paid GitHub Actions minutes used.
Paid minutes only apply to workflows in private repositories that use GitHub-hosted runners. Minutes used is listed for each GitHub-hosted runner operating system. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "Managing billing for GitHub Actions".
The authenticated user must be an enterprise admin.
get /enterprises/{enterprise}/settings/billing/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/settings/billing/actionsJavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/settings/billing/actions', {
enterprise: 'enterprise'
})
Response
Status: 200 OK
{
"total_minutes_used": 305,
"total_paid_minutes_used": 0,
"included_minutes": 3000,
"minutes_used_breakdown": {
"UBUNTU": 205,
"MACOS": 10,
"WINDOWS": 90
}
}
Get GitHub Advanced Security active committers for an enterprise
Gets the GitHub Advanced Security active committers for an enterprise per repository. Each distinct user login across all repositories is counted as a single Advanced Security seat, so the total_advanced_security_committers is not the sum of active_users for each repository.
get /enterprises/{enterprise}/settings/billing/advanced-security
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) Default:30 |
page |
integer | query |
Page number of the results to fetch. Default:1 |
Code samples
Shell
curl \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/enterprises/ENTERPRISE/settings/billing/advanced-securityJavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/settings/billing/advanced-security', {
enterprise: 'enterprise'
})
Success
Status: 200 OK
{
"total_advanced_security_committers": 2,
"repositories": [
{
"name": "octocat-org/Hello-World",
"advanced_security_committers": 2,
"advanced_security_committers_breakdown": [
{
"user_login": "octocat",
"last_pushed_date": "2021-11-03"
},
{
"user_login": "octokitten",
"last_pushed_date": "2021-10-25"
}
]
},
{
"name": "octocat-org/server",
"advanced_security_committers": 1,
"advanced_security_committers_breakdown": [
{
"user_login": "octokitten",
"last_pushed_date": "2021-10-26"
}
]
}
]
}
Response if GitHub Advanced Security is not enabled for this repository
Status: 403 Forbidden
Get GitHub Packages billing for an enterprise
Gets the free and paid storage used for GitHub Packages in gigabytes.
Paid minutes only apply to packages stored for private repositories. For more information, see "Managing billing for GitHub Packages."
The authenticated user must be an enterprise admin.
get /enterprises/{enterprise}/settings/billing/packages
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/settings/billing/packagesJavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/settings/billing/packages', {
enterprise: 'enterprise'
})
Response
Status: 200 OK
{
"total_gigabytes_bandwidth_used": 50,
"total_paid_gigabytes_bandwidth_used": 40,
"included_gigabytes_bandwidth": 10
}
Get shared storage billing for an enterprise
Gets the estimated paid and estimated total storage used for GitHub Actions and Github Packages.
Paid minutes only apply to packages stored for private repositories. For more information, see "Managing billing for GitHub Packages."
The authenticated user must be an enterprise admin.
get /enterprises/{enterprise}/settings/billing/shared-storage
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/settings/billing/shared-storageJavaScript (@octokit/core.js)
await octokit.request('GET /enterprises/{enterprise}/settings/billing/shared-storage', {
enterprise: 'enterprise'
})
Response
Status: 200 OK
{
"days_left_in_billing_cycle": 20,
"estimated_paid_storage_for_month": 15,
"estimated_storage_for_month": 40
}