|
| 1 | +--- |
| 2 | +id: billing-api |
| 3 | +title: Cloud Billing API |
| 4 | +sidebar_label: Cloud Billing API |
| 5 | +description: The Temporal Cloud Billing API provides namespace-level cost attribution through on-demand billing reports. |
| 6 | +slug: /cloud/billing-api |
| 7 | +toc_max_heading_level: 4 |
| 8 | +keywords: |
| 9 | + - explanation |
| 10 | +tags: |
| 11 | + - API |
| 12 | + - Billing |
| 13 | + - Temporal Cloud |
| 14 | +--- |
| 15 | + |
| 16 | +The Temporal Cloud Billing API provides Namespace-level cost attribution through on-demand billing reports. |
| 17 | +Reports are delivered in CSV format and can be accessed via API or downloaded directly for use in FinOps tooling and cost management platforms. |
| 18 | + |
| 19 | +This API is part of the [Cloud Operations API](/ops). |
| 20 | + |
| 21 | +:::tip Support, stability, and dependency info |
| 22 | + |
| 23 | +The Temporal Cloud Billing API is in [Pre-release](/evaluate/development-production-features/release-stages#pre-release). |
| 24 | + |
| 25 | +::: |
| 26 | + |
| 27 | +The Billing API allows you to: |
| 28 | + |
| 29 | +- Generate billing reports for specified invoice months |
| 30 | +- Retrieve report status and metadata |
| 31 | +- Download CSV reports that can be fed into internal analytics tooling or cloud cost management platforms |
| 32 | + |
| 33 | +The Billing Report contains: |
| 34 | + |
| 35 | +- Accurate Namespace-level cost attribution |
| 36 | +- Hourly granularity |
| 37 | +- A [FOCUS](https://focus.finops.org/)-friendly data format |
| 38 | + |
| 39 | +For complete request and response schemas, refer to the Schema below. |
| 40 | + |
| 41 | +Billing report generation is **asynchronous**. You initiate report creation, then poll for completion. |
| 42 | + |
| 43 | +## Report data limitations |
| 44 | + |
| 45 | +For pre-release, reports can be generated with hourly granularity only, for the current billing month, and the previous billing month. |
| 46 | + |
| 47 | +## Allowed date ranges |
| 48 | + |
| 49 | +Date ranges must use billing-month boundaries (MM/YYYY). |
| 50 | +Requests may include the current billing month. |
| 51 | +The data in finalized reports includes usage up to `current_time` \- 24 hours (rounded up to nearest hour). |
| 52 | + |
| 53 | +## Rate limits and concurrency |
| 54 | + |
| 55 | +Rate limits apply to API usage. |
| 56 | + |
| 57 | +### Per-account concurrency |
| 58 | + |
| 59 | +Within a single account: |
| 60 | + |
| 61 | +- Only one billing report per account is generated at a time |
| 62 | +- Additional requests are accepted but queued |
| 63 | + |
| 64 | +### Report Generation Latency |
| 65 | + |
| 66 | +Report generation time varies and is not guaranteed. Factors that affect it include the size of the requested date range and overall platform load. |
| 67 | + |
| 68 | +## Best practices |
| 69 | + |
| 70 | +Provide an idempotency key (`async_operation_id`) when retrying requests. |
| 71 | + |
| 72 | +Poll `GetBillingReport` using exponential backoff. |
| 73 | + |
| 74 | +Download reports immediately after generation (URLs expire). |
| 75 | + |
| 76 | +Avoid frequent generation of large overlapping ranges in the current billing period. |
| 77 | + |
| 78 | +## Billing report schema |
| 79 | + |
| 80 | +Billing reports are delivered in CSV format. |
| 81 | + |
| 82 | +Each row represents a charge record. |
| 83 | + |
| 84 | +| Column Name | Description | Example | |
| 85 | +| ----- | ----- | ----- | |
| 86 | +| BillingAccountID | Temporal Cloud account ID | a2dd6 | |
| 87 | +| BillingAccountName | Temporal Cloud account name | temporal | |
| 88 | +| BillingCurrency | The currency an account is billed in | USD (cents) | |
| 89 | +| BillingPeriodEnd | The exclusive end bound of a billing period | 2024-02-01T00:00:00Z | |
| 90 | +| BillingPeriodStart | The inclusive start bound of a billing period | 2024-01-01T00:00:00Z | |
| 91 | +| ChargeCategory | The highest level classification of a charge based on how it is billed | Usage | |
| 92 | +| ChargeDescription | A self contained summary of the charge’s purpose | Actions \- Tier 1 | |
| 93 | +| ChargeFrequency | Indicates how often a charge will occur | Usage-Based | |
| 94 | +| ChargePeriodEnd | Time period end from when this charge took place, correlates to data granularity | 2025-10-01T01:00:00.000Z | |
| 95 | +| ChargePeriodStart | Time period start from when this charge took place, correlates to data granularity | 2025-10-01T00:00:00.000Z | |
| 96 | +| ContractedCost | Cost calculated by multiplying ContractedUnitPrice and PricingQuantity | 100.00 | |
| 97 | +| ContractedUnitPrice | The agreed-upon unit price for a single pricing unit of the associated SKU. Inclusive of negotiated discounts | 10.00 | |
| 98 | +| InvoiceID | The ID of the invoice for this billing period | in\_XXXXXXXXXXXXXXXXXXXX | |
| 99 | +| InvoiceIssuer | The entity responsible for issuing payable invoices | stripe | |
| 100 | +| PricingQuantity | The volume of a given SKU used or purchased | 10.00 | |
| 101 | +| PricingUnit | The measurement unit used for PricingQuantity | 1 Million Actions | |
| 102 | +| Provider | The provider of purchased resources or services | Temporal Technologies | |
| 103 | +| Publisher | The publisher of purchased resources or services | Temporal Technologies | |
| 104 | +| ResourceID | Namespace name \+ Temporal Cloud account ID | production.a2dd6 | |
| 105 | +| ResourceName | Namespace name \+ Temporal Cloud account ID | production.a2dd6 | |
| 106 | +| ResourceType | The type of resource the charge applies to | Namespace | |
| 107 | +| ServiceCategory | The highest level classification of a service based on the core function of the service | Temporal Cloud | |
| 108 | +| ServiceName | An offering that can be purchased from a provider | Temporal Cloud | |
| 109 | +| ServiceSubcategory | A secondary classification of the service category for a service based on its core function | Actions | |
| 110 | +| SKUID | A unique identifier that represents a specific SKU | essentials-actions | |
| 111 | +| SKUMeter | The functionality being metered or measured by a particular SKU in a charge | Actions | |
| 112 | +| Tags | Provider and customer defined tags associated with resources | `{"$tmprl_project":["project-id"],"namespace-tag-key":["namespace-tag-value"]}` | |
| 113 | + |
| 114 | +## Generate a report |
| 115 | + |
| 116 | +To generate a report, follow these steps: |
| 117 | + |
| 118 | +1. Create a billing report using `CreateBillingReport`. The response includes a `billing_report_id` and `async_operation_id`. |
| 119 | +1. Poll `GetBillingReport` using the `billing_report_id` |
| 120 | +1. When the report state becomes `BILLING_REPORT_STATE_GENERATED`, retrieve the download URL |
| 121 | +1. Download the report before the URL expires |
| 122 | + |
| 123 | +### Key identifiers |
| 124 | + |
| 125 | +| Identifier | Purpose | |
| 126 | +| ----- | ----- | |
| 127 | +| `billing_report_id` | Identifies the billing report and is used to retrieve metadata and download URLs | |
| 128 | +| `async_operation_id` | Identifies the background operation responsible for generating the report | |
| 129 | + |
| 130 | +The async operation follows the standard Cloud Operations async model (see [Async Operations](/ops#per-identity-rate-limits)). |
0 commit comments