---
updatedAt: 2026-09-22T12:27:58.000Z
agentTools:
  projectIndex: https://docs.umbrellacost.io/llms.txt
---

# Get Cost and Usage

<Callout icon="📘" theme="info">
  ### Pagination information

  When there is additional information to show, the _nextToken_ field will be included in the response.<br />The value should be used in the _token_ parameter of the next call.
</Callout>

<br />

#### Data source - cloud, Kubernetes or both

Define the data scope of your query by using the filter costglobaltype.<br />\*Mentioned below in the body param as well

| Scope       | Send                           | Returns                                          |
| ----------- | ------------------------------ | ------------------------------------------------ |
| Cloud Only  | filters\[costglobaltype]=cloud | Cloud charges. Kubernetes rows are filtered out. |
| K8s Only    | filters\[costglobaltype]=k8s   | Kubernetes charges only.                         |
| Cloud + K8s | omit the filter                | Both. This is the default.                       |

<br />

#### Measures - cost, usage, rate and unit-economics KPIs

| Measure                | What to send                                                           | What to read                                               |
| ---------------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------- |
| Cost                   | costType=cost\&costType=discount - the default                         | total\_cost                                                |
| Usage                  | filters\[quantitytype]=Hours to pin the unit (optional)                | total\_usage\_quantity                                     |
| Rate - cost per unit   | isRateUsageBased: true + filters\[quantitytype]                        | total\_cost ÷ total\_usage\_quantity                       |
| Rate - usage per usage | isRateUsageBased: true + two quantitytype values                       | total\_usage\_quantity\_secondary ÷ total\_usage\_quantity |
| Unit-economics KPI     | unitEconomics: {"type":"kpi","value":"<kpiId>"}                        | total\_cost - carries the KPI value                        |
| Pipeline metric        | unitEconomics: {"type":"metric","value":"<pipelineId>-<metricColumn>"} | total\_cost - carries the metric value                     |

<br />

<br />

**Unit economics on the POST form**

unitEconomics names what to measure in place of cost, and the dimensions of the pipeline behind it become available to groupBy and to every filter family.

| **Field** | **Type** | **Notes**                                                                                                              |
| --------- | -------- | ---------------------------------------------------------------------------------------------------------------------- |
| `type`    | string   | `metric` - a single pipeline metric; <br />`kpi` - a saved KPI; <br />`kpi_preview`- an inline formula, nothing saved. |
| `value`   | string   | For `metric`, `<pipelineId>-<metricColumn>`, e.g. `pipe_1d6ba6230251-m_3`. For `kpi`, the KPI id.                      |

<br />

<br />

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "Cost & Usage",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "https://api.umbrellacost.io"
    }
  ],
  "x-readme": {
    "explorer-enabled": false
  },
  "paths": {
    "/api/v2/invoices/cost-and-usage": {
      "post": {
        "responses": {
          "200": {
            "description": ""
          }
        },
        "parameters": [
          {
            "in": "header",
            "name": "Authorization",
            "schema": {
              "type": "string"
            },
            "required": true
          },
          {
            "in": "header",
            "name": "apikey",
            "schema": {
              "type": "string"
            },
            "required": true
          }
        ],
        "operationId": "post_api-v2-invoices-cost-and-usage",
        "summary": "Get Cost and Usage",
        "x-internal": false,
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "startDate": {
                    "type": "string",
                    "description": "Start of the range.\nExample: 2026-04-16 "
                  },
                  "endDate": {
                    "type": "string",
                    "description": "Must be on or after startDate. The span may not exceed 36 months.\nExample: 2026-08-16"
                  },
                  "periodGranLevel": {
                    "type": "string",
                    "description": "Granularity.\nValues: day, week, month, quarter, year"
                  },
                  "groupBy": {
                    "type": "string",
                    "description": "Dimension(s) to group by (Two levels maximum). \nExample: [\"service\", \"usagedate\"]"
                  },
                  "costType": {
                    "type": "string",
                    "description": "Charge classification, not a cost metric. One or more of cost, credit, discount, refund, tax"
                  },
                  "costglobaltype": {
                    "type": "string",
                    "description": "Data source scope. By default, it is cloud+K8s. Specify whether to see only K8s or cloud costs.\nExample: costglobaltype: \"cloud\""
                  },
                  "filters": {
                    "type": "object",
                    "description": "Include-filters keyed by dimension. {\"service\":[\"Amazon Elastic Compute Cloud\"]}.",
                    "properties": {
                      "service": {
                        "type": "string",
                        "description": "service is an example; it can be any of the available fields. \nhttps://docs.umbrellacost.io/reference/grouping-anf-filtering-options "
                      }
                    }
                  },
                  "excludeFilters": {
                    "type": "object",
                    "description": "Exclude-filters, same shape as filters.",
                    "properties": {
                      "service": {
                        "type": "string",
                        "description": "service is an example; it can be any of the available fields. \nhttps://docs.umbrellacost.io/reference/grouping-anf-filtering-options "
                      }
                    }
                  },
                  "likeFilters": {
                    "type": "object",
                    "description": "Substring (LIKE) filters.\nExample: {service: \"bedrock\"}",
                    "properties": {
                      "service": {
                        "type": "string",
                        "description": "service is an example; it can be any of the available fields. \nhttps://docs.umbrellacost.io/reference/grouping-anf-filtering-options "
                      }
                    }
                  },
                  "excludeLikeFilters": {
                    "type": "object",
                    "description": "Negated substring filters. ",
                    "properties": {
                      "service": {
                        "type": "string",
                        "description": "service is an example; it can be any of the available fields. \nhttps://docs.umbrellacost.io/reference/grouping-anf-filtering-options "
                      }
                    }
                  },
                  "conjunction": {
                    "type": "string",
                    "description": "How the filter families combine - and (default) or or.\nExample: conjunction: {customtags: \"or\"}"
                  },
                  "unitEconomics": {
                    "type": "object",
                    "description": "The KPI or metric to measure instead of cost. See Unit economics above.",
                    "properties": {}
                  },
                  "dateBasis": {
                    "type": "string",
                    "description": "GCP only. 'usagedate' (default) or 'invoicemonth'."
                  },
                  "carbonEmissionsUsage": {
                    "type": "string",
                    "description": "Measure emissions or water instead of cost. One of 'totalCarbonEmissions', 'usageCarbonEmissions', 'manufacturingCarbonEmissions', 'cloudUsageElectricityConsumption', 'waterElectricity', 'waterCooling', 'waterTotal'. The chosen figure replaces total_cost."
                  },
                  "isRateUsageBased": {
                    "type": "boolean",
                    "description": "Keep the quantitytype filter applied to the usage side, for rate-per-unit queries."
                  },
                  "isTimezonePST": {
                    "type": "boolean",
                    "description": "For GCP only. Read the hourly table and bucket in PST rather than UTC."
                  },
                  "isAmortized": {
                    "type": "boolean",
                    "description": "Return amortized cost."
                  },
                  "isNetAmortized": {
                    "type": "boolean",
                    "description": "Return net unblended cost."
                  },
                  "isNetUnblended": {
                    "type": "boolean",
                    "description": "Return net unblended cost."
                  },
                  "isDistributed": {
                    "type": "boolean",
                    "description": "Return distributed (shared-cost-allocated) cost."
                  },
                  "isPublicCost": {
                    "type": "boolean",
                    "description": "Return public (list) cost."
                  },
                  "isWasteCostAllocation": {
                    "type": "boolean",
                    "description": "Distribute the node-level unused cost among the pods. Only meaningful with a Kubernetes groupBy"
                  },
                  "token": {
                    "type": "string",
                    "description": "Pagination token, use the nextToken from previous response"
                  }
                },
                "required": [
                  "startDate",
                  "endDate",
                  "periodGranLevel"
                ]
              }
            }
          }
        }
      }
    }
  }
}
```