|
| 1 | +--- |
| 2 | +Title: Generate FOCUS-compliant cost report |
| 3 | +linkTitle: Generate cost report |
| 4 | +alwaysopen: false |
| 5 | +categories: |
| 6 | +- docs |
| 7 | +- operate |
| 8 | +- rc |
| 9 | +description: Shows how to generate and download a cost report in FOCUS format using the Redis Cloud REST API. |
| 10 | +bannerText: The cost report API endpoint is currently in preview. [Contact support](https://redis.io/support/) to request access to this endpoint. |
| 11 | +weight: 60 |
| 12 | +--- |
| 13 | + |
| 14 | +You can use the Redis Cloud REST API to generate and download a cost report in a [FinOps Open Cost and Usage Specification (FOCUS)](https://focus.finops.org/) compatible format. The report includes detailed information about your Redis Cloud subscription usage and associated charges. |
| 15 | + |
| 16 | +{{< embed-md "rc-cost-report-api.md" >}} |
| 17 | + |
| 18 | +The following sections provide examples for each step. |
| 19 | + |
| 20 | +## Generate a cost report |
| 21 | + |
| 22 | +To generate a cost report, use [`POST /cost-report`]({{< relref "/operate/rc/api/api-reference#tag/Account/operation/createCostReport" >}}). Your account must have the **Owner** or **Viewer** role to generate a cost report through this endpoint. |
| 23 | + |
| 24 | +Include `startDate` and `endDate` in your request body using `YYYY-MM-DD` format. You can specify a date range up to 40 days. |
| 25 | + |
| 26 | +```json |
| 27 | +{ |
| 28 | + "startDate": "2025-01-01", |
| 29 | + "endDate": "2025-01-31" |
| 30 | +} |
| 31 | +``` |
| 32 | + |
| 33 | +More options and filters can be added to the request body to filter the report data. |
| 34 | + |
| 35 | +| Option name | Type | Description | |
| 36 | +|-------------|--------|-------------| |
| 37 | +| `format` | Enum: `csv`, `json` | The format for the report file. Default is `csv`. | |
| 38 | +| `subscriptionIds` | Array of integers | Filters the report to only include the specified subscriptions. | |
| 39 | +| `databaseIds` | Array of integers | Filters the report to only include the specified databases. | |
| 40 | +| `subscriptionType` | Enum: `essentials`, `pro` | Filters the report to only include subscriptions of the specified type. | |
| 41 | +| `regions` | Array of strings | Filters the report to only include subscriptions in the specified regions. | |
| 42 | +| `tags` | Array of key-value pairs | Filters the report to only include databases with the specified [tags]({{< relref "/operate/rc/databases/tag-database" >}}). Both `key` and `value` are required for each tag. | |
| 43 | + |
| 44 | +For example, the following request body generates a CSV report for all databases in the `us-east-1` region that have the `team:marketing` tag in January 2025: |
| 45 | + |
| 46 | +```json |
| 47 | +{ |
| 48 | + "startDate": "2025-01-01", |
| 49 | + "endDate": "2025-01-31", |
| 50 | + "format": "csv", |
| 51 | + "regions": ["us-east-1"], |
| 52 | + "tags": [ |
| 53 | + { |
| 54 | + "key": "team", |
| 55 | + "value": "marketing" |
| 56 | + } |
| 57 | + ] |
| 58 | +} |
| 59 | +``` |
| 60 | + |
| 61 | +The response body is a [task object]({{< relref "/operate/rc/api/get-started/manage-tasks#task-information" >}}) that contains the `taskId` for the task that generates the cost report: |
| 62 | + |
| 63 | +```json |
| 64 | +{ |
| 65 | + "taskId": "7ba51acc-cd1d-44c7-8453-281730d214ce", |
| 66 | + "commandType": "costReportCreateRequest", |
| 67 | + "status": "received", |
| 68 | + "description": "Task request received and is being queued for processing.", |
| 69 | + "timestamp": "2025-11-07T15:44:29.811142433Z", |
| 70 | + "links": [ |
| 71 | + { |
| 72 | + "href": "https://api.redislabs.com/v1/tasks/7ba51acc-cd1d-44c7-8453-281730d214ce", |
| 73 | + "type": "GET", |
| 74 | + "rel": "task" |
| 75 | + } |
| 76 | + ] |
| 77 | +} |
| 78 | +``` |
| 79 | + |
| 80 | +## Get cost report status |
| 81 | + |
| 82 | +To get the status of the cost report generation, use [`GET /tasks/{taskId}`]({{< relref "/operate/rc/api/api-reference#tag/Tasks/operation/getTaskById" >}}) with the `taskId` from the previous step. |
| 83 | + |
| 84 | +When the report is ready, the `status` is `processing-completed` and the `response` field contains a `costReportId`: |
| 85 | + |
| 86 | +```json |
| 87 | +{ |
| 88 | + "taskId": "7ba51acc-cd1d-44c7-8453-281730d214ce", |
| 89 | + "commandType": "costReportCreateRequest", |
| 90 | + "status": "processing-completed", |
| 91 | + "description": "Request processing completed successfully and its resources are now being provisioned / de-provisioned.", |
| 92 | + "timestamp": "2025-11-07T15:44:31.168900133Z", |
| 93 | + "response": { |
| 94 | + "resource": { |
| 95 | + "costReportId": "a07524cf-6d4d-47ec-a1b7-810d1cbafcf7.json" |
| 96 | + } |
| 97 | + }, |
| 98 | + "links": [ |
| 99 | + { |
| 100 | + "href": "https://api.redislabs.com/v1/tasks/7ba51acc-cd1d-44c7-8453-281730d214ce", |
| 101 | + "type": "GET", |
| 102 | + "rel": "self" |
| 103 | + } |
| 104 | + ] |
| 105 | +} |
| 106 | +``` |
| 107 | + |
| 108 | +## Download cost report |
| 109 | + |
| 110 | +To get the cost report, use [`GET /cost-report/{costReportId}`]({{< relref "/operate/rc/api/api-reference#tag/Account/operation/getCostReport" >}}) with the `costReportId` from the previous step. |
| 111 | + |
| 112 | +You can use this cost report with any FOCUS-compatible cost reporting tool to analyze and visualize your costs. |
| 113 | + |
| 114 | +### Cost report fields |
| 115 | + |
| 116 | +The cost report returned from the Redis Cloud REST API contains fields from the [FOCUS column library](https://focus.finops.org/focus-columns/). The Redis Cloud-specific implementation is described in the following sections. |
| 117 | + |
| 118 | +#### Billing account and publisher fields |
| 119 | + |
| 120 | +| Field | Type | Description | |
| 121 | +|---|---|---| |
| 122 | +| `BillingAccountId` | String | Redis Cloud account ID. | |
| 123 | +| `BillingAccountName` | String | Display name of the Redis Cloud account. | |
| 124 | +| `BillingAccountType` | String | Type of billing account structure. Always set to `Redis Cloud`. | |
| 125 | +| `PublisherName` | String | Publisher/vendor of the service, which is Redis. Always `redis.io`. | |
| 126 | + |
| 127 | +#### Pricing fields |
| 128 | + |
| 129 | +| Field | Type | Description | |
| 130 | +|---|---|---| |
| 131 | +| `PricingCategory` | String | Pricing model category. Always `Standard`. | |
| 132 | +| `PricingCurrency` | String | The currency used for pricing. Always `USD`. | |
| 133 | +| `PricingQuantity` | BigDecimal | Quantity of units being priced. For hourly services like Redis Cloud Pro, this is the number of hours. For monthly services like Redis Cloud Essentials and network costs, this is typically one month. | |
| 134 | +| `PricingUnit` | String | The unit of measure for pricing. Can be `Hours` (Pro), `Months` (Essentials), or `Network`. | |
| 135 | + |
| 136 | +#### Period fields |
| 137 | + |
| 138 | +| Field | Type | Description | |
| 139 | +|---|---|---| |
| 140 | +| `BillingPeriodStart` | Instant (ISO 8601 DateTime) | Start of the billing period (inclusive). | |
| 141 | +| `BillingPeriodEnd` | Instant (ISO 8601 DateTime) | End of the billing period (exclusive). | |
| 142 | +| `ChargePeriodStart` | Instant (ISO 8601 DateTime) | Start of the specific charge period (inclusive). May differ from billing period if the resource was created mid-period. | |
| 143 | +| `ChargePeriodEnd` | Instant (ISO 8601 DateTime) | End of the specific charge period (exclusive). May differ from billing period if the resource was deleted mid-period. | |
| 144 | + |
| 145 | +#### Cost fields |
| 146 | + |
| 147 | +| Field | Type | Description | |
| 148 | +|---|---|---| |
| 149 | +| `BilledCost` | BigDecimal | Cost that Redis will invoice you for. | |
| 150 | +| `BillingCurrency` | String (ISO 4217) | Currency code for all billing amounts. Always `USD`. | |
| 151 | +| `ConsumedQuantity` | BigDecimal | Actual amount of resources used. May be null for fixed-price plans. | |
| 152 | +| `ConsumedUnit` | String | Unit for `ConsumedQuantity`. Can be `Hours` or `Network`. | |
| 153 | +| `ContractedCost` | BigDecimal | Cost after applying contractual discounts but before credits. | |
| 154 | +| `ContractedUnitPrice` | BigDecimal | Per-unit price after applying your negotiated discounts. | |
| 155 | +| `EffectiveCost` | BigDecimal | True cost after all discounts, credits, and adjustments. | |
| 156 | +| `ListCost` | BigDecimal | Cost at Redis's published list prices before any discounts. | |
| 157 | +| `ListUnitPrice` | BigDecimal | Redis's published price per unit at list rates. | |
| 158 | + |
| 159 | +#### Location, Resource, and SKU fields |
| 160 | + |
| 161 | +| Field | Type | Description | |
| 162 | +|---|---|---| |
| 163 | +| `RegionId` | String | Cloud vendor region identifier. | |
| 164 | +| `RegionName` | String | Display name of the region. | |
| 165 | +| `ResourceId` | String | Identifier of the resource being charged. | |
| 166 | +| `ResourceName` | String | Display name you gave to the resource in the Redis Cloud console. | |
| 167 | +| `ResourceType` | String | Whether the charge is for a specific database or a subscription-level service. | |
| 168 | +| `Tags` | JSON Map<String, String> | User-defined tags on resources. | |
| 169 | +| `SkuPriceDetails` | JSON Map<String, Object> | Redis-specific technical details about the database configuration, such as RBUs, memory limit, and throughput. | |
| 170 | + |
| 171 | +#### Charge fields |
| 172 | + |
| 173 | +| Field | Type | Description | |
| 174 | +|---|---|---| |
| 175 | +| `ChargeCategory` | String | Category of the charge: `Usage`, `Purchase`, `Tax`, or `Adjustment`. | |
| 176 | +| `ChargeDescription` | String | A clear description of what you're being charged for, combining service type and resource details. | |
| 177 | +| `ChargeFrequency` | String | How often the charge occurs - always `Recurring`. | |
| 178 | + |
| 179 | +#### Service fields |
| 180 | + |
| 181 | +| Field | Type | Description | |
| 182 | +|---|---|---| |
| 183 | +| `ServiceCategory` | String | The high-level category of service - always `Databases`. | |
| 184 | +| `ServiceName` | String | The Redis Cloud service tier - `Redis Cloud Pro` or `Redis Cloud Essentials`. | |
| 185 | +| `ServiceSubcategory` | String | The specific type of database service - always `Caching`. | |
| 186 | + |
0 commit comments