## GetCreditUsageExport **post** `/gitpod.v1.BillingService/GetCreditUsageExport` Returns a signed download URL for a CSV export of credit usage. The URL points to an HTTP endpoint that streams gzip-compressed CSV and is valid for five minutes. The download must be made by the same principal that requested it, carrying its own bearer token. The export range may cover up to a year. For organizations without enterprise credit usage enabled (no billing contract start date), the export instead contains BYOK cost usage with a different column set, and groupBy=RESOURCE is rejected. Use this method to: - Export per-user daily credit usage for external reporting - Export a per-environment and per-conversation resource breakdown ### Examples - Export January's daily summary: ```yaml organizationId: "b0e12f6c-4c67-429d-a4a6-d9838b5da047" dateRange: startTime: "2024-01-01T00:00:00Z" endTime: "2024-01-31T00:00:00Z" groupBy: CREDIT_USAGE_EXPORT_GROUP_BY_DAILY_SUMMARY ``` ### Authorization Requires `billing:read_usage` permission on the organization. ### Body Parameters - `dateRange: DateRange` Date range to export. Both start and end dates are inclusive; time-of-day is ignored. Unlike GetCreditUsageReport, the range may cover up to a year. - `endTime: string` End time of the date range (exclusive). - `startTime: string` Start time of the date range (inclusive). - `organizationId: string` - `groupBy: optional CreditUsageExportGroupBy` How to group the export data. Defaults to DAILY_SUMMARY. - `"CREDIT_USAGE_EXPORT_GROUP_BY_UNSPECIFIED"` - `"CREDIT_USAGE_EXPORT_GROUP_BY_DAILY_SUMMARY"` - `"CREDIT_USAGE_EXPORT_GROUP_BY_RESOURCE"` ### Returns - `downloadUrl: optional string` Signed download URL for the CSV export. Valid for five minutes, and only for the principal that requested it. ### Example ```http curl https://app.gitpod.io/api/gitpod.v1.BillingService/GetCreditUsageExport \ -H 'Content-Type: application/json' \ -H "Authorization: Bearer $GITPOD_API_KEY" \ -d '{ "dateRange": { "endTime": "2024-01-31T00:00:00Z", "startTime": "2024-01-01T00:00:00Z" }, "organizationId": "b0e12f6c-4c67-429d-a4a6-d9838b5da047" }' ``` #### Response ```json { "downloadUrl": "downloadUrl" } ```