Nutzungsberichte
Verwenden Sie die REST-API, um Exporte von Verwendungsberichten für ein Unternehmen zu erstellen und abzurufen.
List usage report exports
Lists all usage report exports for an enterprise. The authenticated user must be an enterprise admin or billing manager, or a custom role holder with fine-grained read access to enterprise billing. An installation access token for a GitHub App installed on the enterprise with write access to enterprise administration, or with read access to enterprise billing, can also list usage report exports.
Feinkörnige Zugriffstoken für "List usage report exports"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
Das feingranulierte Token muss mindestens einen der folgenden Berechtigungssets aufweisen.:
- "Enterprise administration" enterprise permissions (write)
- "Enterprise billing" enterprise permissions (read)
Parameter für "List usage report exports"
| Name, Typ, BESCHREIBUNG |
|---|
accept string Setting to |
| Name, Typ, BESCHREIBUNG |
|---|
enterprise string ErforderlichThe slug version of the enterprise name. |
HTTP-Antwortstatuscodes für "List usage report exports"
| Statuscode | BESCHREIBUNG |
|---|---|
200 | List of usage report exports |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
500 | Internal Error |
503 | Service unavailable |
Codebeispiele für "List usage report exports"
Wenn Sie bei GHE.com auf GitHub zugreifen, ersetzen Sie api.github.com durch die dedizierte Unterdomäne Ihres Unternehmens unter api.SUBDOMAIN.ghe.com.
Anforderungsbeispiel
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/enterprises/ENTERPRISE/settings/billing/reportsList of usage report exports
Status: 200{
"usage_report_exports": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"report_type": "detailed",
"start_date": "2024-01-01",
"end_date": "2024-01-31",
"status": "completed",
"download_urls": [
"https://github.com/enterprises/github/metered_exports/1234"
],
"created_at": "2024-01-15T10:30:00Z",
"actor": "monalisa"
},
{
"id": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
"report_type": "summarized",
"start_date": "2024-01-01",
"end_date": "2024-01-31",
"status": "processing",
"created_at": "2024-01-14T09:00:00Z",
"actor": "monalisa"
},
{
"id": "c3d4e5f6-a7b8-9012-cdef-123456789012",
"report_type": "premium_request",
"start_date": "2024-01-01",
"end_date": "2024-01-31",
"status": "processing",
"created_at": "2024-01-13T08:00:00Z",
"actor": "octocat"
}
]
}Create a usage report export
Initiates the generation of a usage report export for an enterprise. The report will be processed asynchronously and can be downloaded once completed. The authenticated user must be an enterprise admin or billing manager, or a custom role holder with fine-grained read access to enterprise billing. An installation access token for a GitHub App installed on the enterprise with write access to enterprise administration, or with read access to enterprise billing, can also initiate a usage report export.
Feinkörnige Zugriffstoken für "Create a usage report export"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
Das feingranulierte Token muss mindestens einen der folgenden Berechtigungssets aufweisen.:
- "Enterprise administration" enterprise permissions (write)
- "Enterprise billing" enterprise permissions (read)
Parameter für "Create a usage report export"
| Name, Typ, BESCHREIBUNG |
|---|
accept string Setting to |
| Name, Typ, BESCHREIBUNG |
|---|
enterprise string ErforderlichThe slug version of the enterprise name. |
| Name, Typ, BESCHREIBUNG |
|---|
report_type string ErforderlichThe type of usage report to generate Kann eine der folgenden sein: |
start_date string ErforderlichThe start date for the report in YYYY-MM-DD format |
end_date string The end date for the report in YYYY-MM-DD format. Defaults to today (UTC) if not provided. |
send_email boolean Whether to send an email notification to the requester when the report is ready. Defaults to false. Standard: |
HTTP-Antwortstatuscodes für "Create a usage report export"
| Statuscode | BESCHREIBUNG |
|---|---|
202 | Report export request accepted |
400 | Bad Request |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
500 | Internal Error |
503 | Service unavailable |
Codebeispiele für "Create a usage report export"
Wenn Sie bei GHE.com auf GitHub zugreifen, ersetzen Sie api.github.com durch die dedizierte Unterdomäne Ihres Unternehmens unter api.SUBDOMAIN.ghe.com.
Anforderungsbeispiel
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/enterprises/ENTERPRISE/settings/billing/reports \
-d '{"report_type":"detailed","start_date":"2024-01-01","end_date":"2024-01-31"}'Report export request accepted
Status: 202{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"report_type": "detailed",
"start_date": "2024-01-01",
"end_date": "2024-01-31",
"status": "completed",
"download_urls": [
"https://github.com/enterprises/github/metered_exports/1234"
],
"created_at": "2024-01-15T10:30:00Z",
"actor": "monalisa"
}Get a usage report export
Gets the status and details of a usage report export by ID. The authenticated user must be an enterprise admin or billing manager, or a custom role holder with fine-grained read access to enterprise billing. An installation access token for a GitHub App installed on the enterprise with write access to enterprise administration, or with read access to enterprise billing, can also get a usage report export.
Feinkörnige Zugriffstoken für "Get a usage report export"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
Das feingranulierte Token muss mindestens einen der folgenden Berechtigungssets aufweisen.:
- "Enterprise administration" enterprise permissions (write)
- "Enterprise billing" enterprise permissions (read)
Parameter für "Get a usage report export"
| Name, Typ, BESCHREIBUNG |
|---|
accept string Setting to |
| Name, Typ, BESCHREIBUNG |
|---|
enterprise string ErforderlichThe slug version of the enterprise name. |
report_id string ErforderlichThe unique identifier (UUID) for the usage report export. |
HTTP-Antwortstatuscodes für "Get a usage report export"
| Statuscode | BESCHREIBUNG |
|---|---|
200 | Usage report export details |
401 | Requires authentication |
403 | Forbidden |
404 | Resource not found |
500 | Internal Error |
503 | Service unavailable |
Codebeispiele für "Get a usage report export"
Wenn Sie bei GHE.com auf GitHub zugreifen, ersetzen Sie api.github.com durch die dedizierte Unterdomäne Ihres Unternehmens unter api.SUBDOMAIN.ghe.com.
Anforderungsbeispiel
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2026-03-10" \
https://api.github.com/enterprises/ENTERPRISE/settings/billing/reports/REPORT_IDUsage report export details
Status: 200{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"report_type": "detailed",
"start_date": "2024-01-01",
"end_date": "2024-01-31",
"status": "completed",
"download_urls": [
"https://github.com/enterprises/github/metered_exports/1234"
],
"created_at": "2024-01-15T10:30:00Z",
"actor": "monalisa"
}