Back to Redis

Generate Cost Report

content/operate/rc/api/examples/generate-cost-report.md

latest8.0 KB
Original Source

You can use the Redis Cloud REST API to generate and download a cost report in a FinOps Open Cost and Usage Specification (FOCUS) compatible format. The report includes detailed information about your Redis Cloud subscription usage and associated charges.

{{< embed-md "rc-cost-report-api.md" >}}

The following sections provide examples for each step.

Generate a cost report

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.

Include startDate and endDate in your request body using YYYY-MM-DD format. You can specify a date range up to 40 days.

json
{
  "startDate": "2025-01-01",
  "endDate": "2025-01-31"
}

More options and filters can be added to the request body to filter the report data.

Option nameTypeDescription
formatEnum: csv, jsonThe format for the report file. Default is csv.
subscriptionIdsArray of integersFilters the report to only include the specified subscriptions.
databaseIdsArray of integersFilters the report to only include the specified databases.
subscriptionTypeEnum: essentials, proFilters the report to only include subscriptions of the specified type.
regionsArray of stringsFilters the report to only include subscriptions in the specified regions.
tagsArray of key-value pairsFilters 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.

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:

json
{
  "startDate": "2025-01-01",
  "endDate": "2025-01-31",
  "format": "csv",
  "regions": ["us-east-1"],
  "tags": [
    {
      "key": "team",
      "value": "marketing"
    }
  ]
}

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:

json
{
  "taskId": "7ba51acc-cd1d-44c7-8453-281730d214ce",
  "commandType": "costReportCreateRequest",
  "status": "received",
  "description": "Task request received and is being queued for processing.",
  "timestamp": "2025-11-07T15:44:29.811142433Z",
  "links": [
    {
      "href": "https://api.redislabs.com/v1/tasks/7ba51acc-cd1d-44c7-8453-281730d214ce",
      "type": "GET",
      "rel": "task"
    }
  ]
}

Get cost report status

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.

When the report is ready, the status is processing-completed and the response field contains a costReportId:

json
{
  "taskId": "7ba51acc-cd1d-44c7-8453-281730d214ce",
  "commandType": "costReportCreateRequest",
  "status": "processing-completed",
  "description": "Request processing completed successfully and its resources are now being provisioned / de-provisioned.",
  "timestamp": "2025-11-07T15:44:31.168900133Z",
  "response": {
    "resource": {
      "costReportId": "a07524cf-6d4d-47ec-a1b7-810d1cbafcf7.json"
    }
  },
  "links": [
    {
      "href": "https://api.redislabs.com/v1/tasks/7ba51acc-cd1d-44c7-8453-281730d214ce",
      "type": "GET",
      "rel": "self"
    }
  ]
}

Download cost report

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.

You can use this cost report with any FOCUS-compatible cost reporting tool to analyze and visualize your costs.

Cost report fields

The cost report returned from the Redis Cloud REST API contains fields from the FOCUS column library. The Redis Cloud-specific implementation is described in the following sections.

Billing account and publisher fields

FieldTypeDescription
BillingAccountIdStringRedis Cloud account ID.
BillingAccountNameStringDisplay name of the Redis Cloud account.
BillingAccountTypeStringType of billing account structure. Always set to Redis Cloud.
PublisherNameStringPublisher/vendor of the service, which is Redis. Always redis.io.

Pricing fields

FieldTypeDescription
PricingCategoryStringPricing model category. Always Standard.
PricingCurrencyStringThe currency used for pricing. Always USD.
PricingQuantityBigDecimalQuantity 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.
PricingUnitStringThe unit of measure for pricing. Can be Hours (Pro), Months (Essentials), or Network.

Period fields

FieldTypeDescription
BillingPeriodStartInstant (ISO 8601 DateTime)Start of the billing period (inclusive).
BillingPeriodEndInstant (ISO 8601 DateTime)End of the billing period (exclusive).
ChargePeriodStartInstant (ISO 8601 DateTime)Start of the specific charge period (inclusive). May differ from billing period if the resource was created mid-period.
ChargePeriodEndInstant (ISO 8601 DateTime)End of the specific charge period (exclusive). May differ from billing period if the resource was deleted mid-period.

Cost fields

FieldTypeDescription
BilledCostBigDecimalCost that Redis will invoice you for.
BillingCurrencyString (ISO 4217)Currency code for all billing amounts. Always USD.
ConsumedQuantityBigDecimalActual amount of resources used. May be null for fixed-price plans.
ConsumedUnitStringUnit for ConsumedQuantity. Can be Hours or Network.
ContractedCostBigDecimalCost after applying contractual discounts but before credits.
ContractedUnitPriceBigDecimalPer-unit price after applying your negotiated discounts.
EffectiveCostBigDecimalTrue cost after all discounts, credits, and adjustments.
ListCostBigDecimalCost at Redis's published list prices before any discounts.
ListUnitPriceBigDecimalRedis's published price per unit at list rates.

Location, Resource, and SKU fields

FieldTypeDescription
RegionIdStringCloud vendor region identifier.
RegionNameStringDisplay name of the region.
ResourceIdStringIdentifier of the resource being charged.
ResourceNameStringDisplay name you gave to the resource in the Redis Cloud console.
ResourceTypeStringWhether the charge is for a specific database or a subscription-level service.
TagsJSON Map<String, String>User-defined tags on resources.
SkuPriceDetailsJSON Map<String, Object>Redis-specific technical details about the database configuration, such as RBUs, memory limit, and throughput.

Charge fields

FieldTypeDescription
ChargeCategoryStringCategory of the charge: Usage, Purchase, Tax, or Adjustment.
ChargeDescriptionStringA clear description of what you're being charged for, combining service type and resource details.
ChargeFrequencyStringHow often the charge occurs - always Recurring.

Service fields

FieldTypeDescription
ServiceCategoryStringThe high-level category of service - always Databases.
ServiceNameStringThe Redis Cloud service tier - Redis Cloud Pro or Redis Cloud Essentials.
ServiceSubcategoryStringThe specific type of database service - always Caching.