|
| 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 | +These reports are generated asynchronously and can be accessed with an object endpoint or downloaded in CSV format |
| 18 | +for analysis by FinOps professionals and Temporal Cloud operators. |
| 19 | + |
| 20 | +This API is part of the [Cloud Operations API](/ops). |
| 21 | + |
| 22 | +:::tip Support, stability, and dependency info |
| 23 | + |
| 24 | +The Temporal Cloud Billing API is in [Pre-release](/evaluate/development-production-features/release-stages#pre-release). |
| 25 | + |
| 26 | +::: |
| 27 | + |
| 28 | +The Billing API allows you to: |
| 29 | + |
| 30 | +- Generate billing reports for specified invoice months |
| 31 | +- Retrieve report status and metadata |
| 32 | +- Correlate report generation with async operations |
| 33 | +- Download CSV reports |
| 34 | +- Integrate billing reports into internal analytics tooling and cloud cost management platforms |
| 35 | + |
| 36 | +The Billing API contains: |
| 37 | + |
| 38 | +- Accurate Namespace-level cost attribution |
| 39 | +- Down to hourly granularity |
| 40 | +- Alignment with the [FOCUS schema](https://focus.finops.org/) |
| 41 | + |
| 42 | +For complete request and response schemas, refer to the Protocol Buffer definitions below. |
| 43 | + |
| 44 | +Billing report generation is **asynchronous**. You initiate report creation, then poll for completion. |
| 45 | + |
| 46 | +## Report data granularity |
| 47 | + |
| 48 | +Reports can be generated with hourly granularity only, for the current billing month, and the previous billing month. |
| 49 | + |
| 50 | +## Allowed date ranges |
| 51 | + |
| 52 | +Date ranges must use billing-month boundaries (MM/YYYY). |
| 53 | +Requests may include the current billing month. |
| 54 | +The data in finalized reports includes usage up to `current_time` \- 24 hours (rounded up to nearest hour). |
| 55 | + |
| 56 | +:::info Limitiations |
| 57 | + |
| 58 | +Data from the current billing period is not cacheable. Also, recently requested historical date ranges may complete faster due to caching. |
| 59 | + |
| 60 | +::: |
| 61 | + |
| 62 | +## Rate limits and concurrency |
| 63 | + |
| 64 | +To ensure system stability, rate limits apply to API usage. |
| 65 | + |
| 66 | +### Per-account concurrency |
| 67 | + |
| 68 | +Within a single account: |
| 69 | + |
| 70 | +- Only one billing report per account is processed at a time |
| 71 | +- Additional requests are accepted but queued |
| 72 | +- Processing occurs serially per account |
| 73 | + |
| 74 | +### Global rate limits |
| 75 | + |
| 76 | +Billing report generation depends on shared infrastructure. |
| 77 | + |
| 78 | +Report generation time varies based on: |
| 79 | + |
| 80 | +- Global system load |
| 81 | +- Date range size |
| 82 | +- Cache availability |
| 83 | + |
| 84 | +### Caching behavior |
| 85 | + |
| 86 | +If a previously requested date range is requested again: |
| 87 | + |
| 88 | +- Cached precomputed data is reused |
| 89 | +- Global rate limits are skipped |
| 90 | +- Generation completes significantly faster |
| 91 | + |
| 92 | +Exception: Data from the current billing period is not cached. |
| 93 | + |
| 94 | +## Best practices |
| 95 | + |
| 96 | +Provide an idempotency key (`async_operation_id`) when retrying requests. |
| 97 | + |
| 98 | +Poll `GetBillingReport` using exponential backoff. |
| 99 | + |
| 100 | +Download reports immediately after generation (URLs expire). |
| 101 | + |
| 102 | +Reuse previously requested date ranges when possible to benefit from caching. |
| 103 | + |
| 104 | +Avoid frequent generation of large overlapping ranges in the current billing period. |
| 105 | + |
| 106 | +## Billing report schema |
| 107 | + |
| 108 | +Billing reports are delivered in CSV format. |
| 109 | + |
| 110 | +Each row represents a charge record. |
| 111 | + |
| 112 | +| Column Name | Description | Example | |
| 113 | +| ----- | ----- | ----- | |
| 114 | +| BillingAccountID | Temporal Cloud account ID | a2dd6 | |
| 115 | +| BillingAccountName | Temporal Cloud account name | temporal | |
| 116 | +| BillingCurrency | The currency an account is billed in | USD (cents) | |
| 117 | +| BillingPeriodEnd | The exclusive end bound of a billing period | 2024-02-01T00:00:00Z | |
| 118 | +| BillingPeriodStart | The inclusive start bound of a billing period | 2024-01-01T00:00:00Z | |
| 119 | +| ChargeCategory | The highest level classification of a charge based on how it is billed | Usage | |
| 120 | +| ChargeDescription | A self contained summary of the charge’s purpose | Actions \- Tier 1 | |
| 121 | +| ChargeFrequency | Indicates how often a charge will occur | Usage-Based | |
| 122 | +| ChargePeriodEnd | Time period end from when this charge took place, correlates to data granularity | 2025-10-01T01:00:00.000Z | |
| 123 | +| ChargePeriodStart | Time period start from when this charge took place, correlates to data granularity | 2025-10-01T00:00:00.000Z | |
| 124 | +| ContractedCost | Cost calculated by multiplying ContractedUnitPrice and PricingQuantity | 100.00 | |
| 125 | +| ContractedUnitPrice | The agreed-upon unit price for a single pricing unit of the associated SKU. Inclusive of negotiated discounts | 10.00 | |
| 126 | +| InvoiceID | The ID of the invoice for this billing period | in\_1SPN94JLJETBw2gmYWyQ71xT | |
| 127 | +| InvoiceIssuer | The entity responsible for issuing payable invoices | stripe | |
| 128 | +| PricingQuantity | The volume of a given SKU used or purchased | 10.00 | |
| 129 | +| PricingUnit | The measurement unit used for PricingQuantity | 1 Million Actions | |
| 130 | +| Provider | The provider of purchased resources or services | Temporal Technologies | |
| 131 | +| Publisher | The publisher of purchased resources or services | Temporal Technologies | |
| 132 | +| ResourceID | Namespace name \+ Temporal Cloud account ID | production.a2dd6 | |
| 133 | +| ResourceName | Namespace name \+ Temporal Cloud account ID | production.a2dd6 | |
| 134 | +| ResourceType | The type of resource the charge applies to | Namespace | |
| 135 | +| ServiceCategory | The highest level classification of a service based on the core function of the service | Temporal Cloud | |
| 136 | +| ServiceName | An offering that can be purchased from a provider | Temporal Cloud | |
| 137 | +| ServiceSubcategory | A secondary classification of the service category for a service based on its core function | Actions | |
| 138 | +| SKUID | A unique identifier that represents a specific SKU | essentials-actions | |
| 139 | +| SKUMeter | The functionality being metered or measured by a particular SKU in a charge | Actions | |
| 140 | +| Tags | Provider and customer defined tags associated with resources | `{"$tmprl\_project":\["project-id"\],"namespace-tag-key":\["namespace-tag-value"\]}` | |
| 141 | + |
| 142 | +## Generate a report |
| 143 | + |
| 144 | +To generate a report, follow these steps: |
| 145 | + |
| 146 | +1. Create a billing report using `CreateBillingReport` |
| 147 | +1. Receive: |
| 148 | + - `billing_report_id` (identifies the report artifact) |
| 149 | + - `async_operation_id` (identifies the background job) |
| 150 | +1. Poll `GetBillingReport` using the `billing_report_id` |
| 151 | +1. When the report state becomes `BILLING_REPORT_STATE_GENERATED`, retrieve the download URL |
| 152 | +1. Download the report before the URL expires |
| 153 | + |
| 154 | +### Key identifiers |
| 155 | + |
| 156 | +| Identifier | Purpose | |
| 157 | +| ----- | ----- | |
| 158 | +| `billing_report_id` | Identifies the billing report artifact and is used to retrieve metadata and download URLs | |
| 159 | +| `async_operation_id` | Identifies the background operation responsible for generating the report | |
| 160 | + |
| 161 | +The async operation follows the standard Cloud Operations async model (see [Async Operations](/ops#per-identity-rate-limits)). |
0 commit comments