On This Page

Home / Cribl as Code/ Cribl API/ API Code Examples/ Billing and FinOps Examples/Get Monthly or Daily Credit Consumption

Get Monthly or Daily Credit Consumption

Use the Cribl API to get monthly or daily credit consumption for an Organization, including per-product and Worker Group infrastructure breakdowns. The examples demonstrate how to get monthly or daily credit consumption with GET /billing/credits/timeseries, as well as one way to get a chargeback-ready table.

To get cumulative credit consumption by contract, see Get Cumulative Consumption by Contract. To get credit grants and credit balance totals, see Get Credit Grants and Statistics.

For information about viewing credit consumption in Cribl, see Track Product Usage and Credit Consumption.

Credit consumption aggregates only at daily and monthly windows, so more frequent polling does not return finer-grained data.

About Code Examples

Code examples use Bearer token authentication. Read the API authentication documentation to learn how to configure authentication. The API Credential that you use to obtain the Bearer token must have the necessary Permissions for the operations in code examples: Billing Reader, Admin, or Owner. Billing API requests return data only for the Organization associated with the API Credential.

Replace the variables in code examples with the corresponding information for your Cribl deployment.

Billing and FinOps API operations are available only on Cribl.Cloud, so this page does not include examples for on-prem deployments.

Code examples do not include all available parameters. For a complete list of parameters for specific endpoints, refer to the documentation in the API Reference.

Get Monthly Credit Consumption

Use GET /billing/credits/timeseries to get total credit consumption and per-product and Worker Group infrastructure credit consumption broken down by month. Review the JSON response structure, then see Get a Chargeback-Ready Table for Monthly Credit Consumption for an example of one way to get a chargeback-ready table.

This example uses the following query parameters to get data for January, February, and March 2026:

  • window: The granularity to apply to the timeseries data. In this example, the granularity is monthly. For day-level allocation within a shorter range, see Get Daily Credit Consumption.

  • startingOn: The inclusive start of the date range for the request, in ISO 8601 format. In this example, the date range 2026-01-01T00:00:00.000Z starts on (and includes) January 1, 2026.

  • endingBefore: The exclusive end of the date range for the request, in ISO 8601 format. In this example, the value 2026-04-01T00:00:00.000Z means that the last day included in the results is March 31, 2026.

Cribl.Cloud

In the response body, the count value is equal to the number of objects that represent the billing periods in your range. For this request, count is 3: one object each for January, February, and March 2026.

Each object in this example response lists consumption for one monthly billing period. For each object:

  • date is the start of a monthly billing period, in ISO 8601 format (the first day of the month when window=monthly).

  • credits is the total consumed across all products and Worker Group infrastructure for the month.

  • dimensions lists per-product and Worker Group infrastructure credit consumption for the month. The response might include all or some of the dimensions objects listed in the example response, depending on the Cribl products and infrastructure that your Organization uses.

{
  "items": [
    {
      "date": "2026-01-01T00:00:00.000Z",
      "credits": 45630.4751129743,
      "dimensions": [
        {
          "dimension": "Search",
          "credits": 8421.46927874825
        },
        {
          "dimension": "Stream",
          "credits": 28417.38471928641
        },
        {
          "dimension": "Lake",
          "credits": 1264.591384620168
        },
        {
          "dimension": "Infrastructure",
          "credits": 4518.417284619472
        },
        {
          "dimension": "Edge",
          "credits": 2103.5847163
        },
        {
          "dimension": "Guard",
          "credits": 386.75291
        },
        {
          "dimension": "Insights",
          "credits": 518.2748194
        }
      ]
    },
    {
      "date": "2026-02-01T00:00:00.000Z",
      "credits": 42752.57682478261,
      "dimensions": [
        {
          "dimension": "Search",
          "credits": 7912.27351964027
        },
        {
          "dimension": "Stream",
          "credits": 26108.48730591862
        },
        {
          "dimension": "Lake",
          "credits": 1104.364029851702
        },
        {
          "dimension": "Infrastructure",
          "credits": 4826.508391472018
        },
        {
          "dimension": "Edge",
          "credits": 1987.2916048
        },
        {
          "dimension": "Guard",
          "credits": 341.493581
        },
        {
          "dimension": "Insights",
          "credits": 472.1583921
        }
      ]
    },
    {
      "date": "2026-03-01T00:00:00.000Z",
      "credits": 50180.8590760128,
      "dimensions": [
        {
          "dimension": "Search",
          "credits": 9234.18374652815
        },
        {
          "dimension": "Stream",
          "credits": 31256.1745083621
        },
        {
          "dimension": "Lake",
          "credits": 1382.291746038531
        },
        {
          "dimension": "Infrastructure",
          "credits": 5104.583716284019
        },
        {
          "dimension": "Edge",
          "credits": 2241.3729506
        },
        {
          "dimension": "Guard",
          "credits": 412.415937
        },
        {
          "dimension": "Insights",
          "credits": 549.8364712
        }
      ]
    }
  ],
  "count": 3
}

Get a Chargeback-Ready Table for Monthly Credit Consumption

Automated chargeback reporting tools often expect billing period and credit totals in flat rows. In JSON responses for GET /billing/credits/timeseries requests, this data is nested in items and dimensions instead. This example makes the same request as in Get Monthly Credit Consumption, passes the response body to a short jq program, and prints chargeback-ready CSV to stdout.

You can flatten the JSON response using other methods such as Python, SQL in your warehouse, dbt (or another ETL job), a spreadsheet, or a BI tool.

The jq program in this example transforms the JSON response as follows:

  1. Output a header row with the column names billing_period, dimension, and credits.

  2. Loop over every object in items. Derive billing_period from the date. This example uses window=monthly, so the billing_period values include only the year and month (YYYY-MM).

  3. Loop over every object in that item’s dimensions array. For each entry, emit one row: billing_period, the dimension value (such as Stream or Edge), and the entry’s credits.

  4. Format each row with @csv so values are valid comma-separated fields.

Cribl.Cloud

When you execute the request, stdout includes CSV output similar to the following example. Each data row is one dimension’s credit consumption total for one billing period. For example, "2026-01","Stream",28417.38471928641 means approximately 28,417.38 credits for Cribl Stream in January 2026.

"billing_period","dimension","credits"
"2026-01","Search",8421.46927874825
"2026-01","Stream",28417.38471928641
"2026-01","Lake",1264.591384620168
"2026-01","Infrastructure",4518.417284619472
"2026-01","Edge",2103.5847163
"2026-01","Guard",386.75291
"2026-01","Insights",518.2748194
"2026-02","Search",7912.27351964027
"2026-02","Stream",26108.48730591862
"2026-02","Lake",1104.364029851702
"2026-02","Infrastructure",4826.508391472018
"2026-02","Edge",1987.2916048
"2026-02","Guard",341.493581
"2026-02","Insights",472.1583921
"2026-03","Search",9234.18374652815
"2026-03","Stream",31256.1745083621
"2026-03","Lake",1382.291746038531
"2026-03","Infrastructure",5104.583716284019
"2026-03","Edge",2241.3729506
"2026-03","Guard",412.415937
"2026-03","Insights",549.8364712

Get Daily Credit Consumption

Use GET /billing/credits/timeseries to get total credit consumption and per-product and Worker Group infrastructure credit consumption broken down by day. This example uses the following query parameters to get data for January 1 through January 7, 2026:

  • window: The granularity to apply to the timeseries data. In this example, the granularity is daily. For month-level allocation, see Get Monthly Credit Consumption.

  • startingOn: The inclusive start of the date range for the request, in ISO 8601 format. In this example, the date range 2026-01-01T00:00:00.000Z starts on (and includes) January 1, 2026.

  • endingBefore: The exclusive end of the date range for the request, in ISO 8601 format. In this example, the value 2026-01-08T00:00:00.000Z means that the last day included in the results is January 7, 2026.

Cribl.Cloud

In the response body, the count value is equal to the number of objects that represent the billing periods in your range. For this request, count is 7: one object each for seven days.

Each object in this example response lists consumption for one day. For each object:

  • date is the date (in ISO 8601 format) for the day whose credit consumption is listed in the dimensions objects.

  • credits is the total consumed across all products and Worker Group infrastructure for the day.

  • dimensions lists per-product and Worker Group infrastructure credit consumption for the day. The response might include all or some of the dimensions objects listed in the example response, depending on the Cribl products and infrastructure that your Organization uses.

{
  "items": [
    {
      "date": "2026-01-01T00:00:00.000Z",
      "credits": 1474.682852340751,
      "dimensions": [
        {
          "dimension": "Search",
          "credits": 271.458291034182
        },
        {
          "dimension": "Stream",
          "credits": 918.274519286401
        },
        {
          "dimension": "Lake",
          "credits": 41.285918420168
        },
        {
          "dimension": "Infrastructure",
          "credits": 146.225
        },
        {
          "dimension": "Edge",
          "credits": 68.4829163
        },
        {
          "dimension": "Guard",
          "credits": 12.473291
        },
        {
          "dimension": "Insights",
          "credits": 16.4829163
        }
      ]
    },
    {
      "date": "2026-01-02T00:00:00.000Z",
      "credits": 1494.036441749864,
      "dimensions": [
        {
          "dimension": "Search",
          "credits": 265.18374652815
        },
        {
          "dimension": "Stream",
          "credits": 942.581730591862
        },
        {
          "dimension": "Lake",
          "credits": 40.104364029852
        },
        {
          "dimension": "Infrastructure",
          "credits": 147.075
        },
        {
          "dimension": "Edge",
          "credits": 71.2916048
        },
        {
          "dimension": "Guard",
          "credits": 12.508391
        },
        {
          "dimension": "Insights",
          "credits": 15.2916048
        }
      ]
    },
    {
      "date": "2026-01-03T00:00:00.000Z",
      "credits": 1099.91201368261,
      "dimensions": [
        {
          "dimension": "Search",
          "credits": 198.27351964027
        },
        {
          "dimension": "Stream",
          "credits": 701.48730591862
        },
        {
          "dimension": "Lake",
          "credits": 32.364029851702
        },
        {
          "dimension": "Infrastructure",
          "credits": 98.508391472018
        },
        {
          "dimension": "Edge",
          "credits": 48.2916048
        },
        {
          "dimension": "Guard",
          "credits": 9.493581
        },
        {
          "dimension": "Insights",
          "credits": 11.493581
        }
      ]
    },
    {
      "date": "2026-01-04T00:00:00.000Z",
      "credits": 1051.87558922285,
      "dimensions": [
        {
          "dimension": "Search",
          "credits": 185.007636330227
        },
        {
          "dimension": "Stream",
          "credits": 682.1076972
        },
        {
          "dimension": "Lake",
          "credits": 28.509100625956
        },
        {
          "dimension": "Infrastructure",
          "credits": 92.666666666667
        },
        {
          "dimension": "Edge",
          "credits": 45.2447562
        },
        {
          "dimension": "Guard",
          "credits": 8.094976
        },
        {
          "dimension": "Insights",
          "credits": 10.2447562
        }
      ]
    },
    {
      "date": "2026-01-05T00:00:00.000Z",
      "credits": 1558.313171349544,
      "dimensions": [
        {
          "dimension": "Search",
          "credits": 289.873310099112
        },
        {
          "dimension": "Stream",
          "credits": 968.248508600002
        },
        {
          "dimension": "Lake",
          "credits": 48.97862625043
        },
        {
          "dimension": "Infrastructure",
          "credits": 148.45
        },
        {
          "dimension": "Edge",
          "credits": 72.3404672
        },
        {
          "dimension": "Guard",
          "credits": 13.081792
        },
        {
          "dimension": "Insights",
          "credits": 17.3404672
        }
      ]
    },
    {
      "date": "2026-01-06T00:00:00.000Z",
      "credits": 1623.312514190655,
      "dimensions": [
        {
          "dimension": "Search",
          "credits": 302.151468707323
        },
        {
          "dimension": "Stream",
          "credits": 1012.302316000001
        },
        {
          "dimension": "Lake",
          "credits": 52.015317216664
        },
        {
          "dimension": "Infrastructure",
          "credits": 151.491666666667
        },
        {
          "dimension": "Edge",
          "credits": 74.0629408
        },
        {
          "dimension": "Guard",
          "credits": 13.225864
        },
        {
          "dimension": "Insights",
          "credits": 18.0629408
        }
      ]
    },
    {
      "date": "2026-01-07T00:00:00.000Z",
      "credits": 1529.686328092164,
      "dimensions": [
        {
          "dimension": "Search",
          "credits": 278.697166922386
        },
        {
          "dimension": "Stream",
          "credits": 956.8374656
        },
        {
          "dimension": "Lake",
          "credits": 43.856591303111
        },
        {
          "dimension": "Infrastructure",
          "credits": 149.666666666667
        },
        {
          "dimension": "Edge",
          "credits": 70.9696536
        },
        {
          "dimension": "Guard",
          "credits": 12.829392
        },
        {
          "dimension": "Insights",
          "credits": 16.829392
        }
      ]
    }
  ],
  "count": 7
}