---
title: "GET /api/customers/{customer_id}/cost_analysis/"
method: GET
path: "/api/customers/{customer_id}/cost_analysis/"
tags: ["api"]
---

# GET /api/customers/{customer_id}/cost_analysis/

`GET /api/customers/{customer_id}/cost_analysis/`

## Path parameters

- `customer_id` string, required — The id provided when creating the customer, we suggest matching with your internal customer id in your backend

## Query parameters

- `end_date` string, date, required
- `start_date` string, date, required

## Response `200`

- CostAnalysis
  - `per_day` SingleDayCostAnalysis[], required
    - `date` string, date, required
    - `cost_data` SingleMetricCost[], required
      - `metric` MetricDetail, required
        - `metric_name` string, required
        - `numeric_filters` NumericFilter[], required
          - `property_name` string, required
          - `operator` 'gte' | 'gt' | 'eq' | 'lt' | 'lte', required — * `gte` - Greater than or equal to * `gt` - Greater than * `eq` - Equal to * `lt` - Less than * `lte` - Less than or equal to
          - `comparison_value` number, double, required
        - `is_cost_metric` boolean, required — Whether or not this metric is a cost metric (used to track costs to your business).
        - `proration` 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'quarters' | 'years' | 'total' | 'null', nullable, required — The proration of the metric. Only applies to metrics of type 'gauge'. * `seconds` - Second * `minutes` - Minute * `hours` - Hour * `days` - Day * `months` - Month * `quarters` - Quarter * `years` - Year * `total` - Total
        - `event_name` string, required — Name of the event that this metric is tracking.
        - `metric_type` 'counter' | 'rate' | 'custom' | 'gauge', required — The type of metric that this is. Please refer to our documentation for an explanation of the different types. * `counter` - Counter * `rate` - Rate * `custom` - Custom * `gauge` - Gauge
        - `granularity` 'seconds' | 'minutes' | 'hours' | 'days' | 'months' | 'quarters' | 'years' | 'total' | 'null', nullable, required — The granularity of the metric. Only applies to metrics of type 'gauge' or 'rate'. * `seconds` - Second * `minutes` - Minute * `hours` - Hour * `days` - Day * `months` - Month * `quarters` - Quarter * `years` - Year * `total` - Total
        - `property_name` string, nullable, required — The name of the property of the event that should be used for this metric. Doesn't apply if the metric is of type 'counter' with an aggregation of count.
        - `event_type` 'delta' | 'total' | 'null', nullable, required — Used only for metrics of type 'gauge'. Please refer to our documentation for an explanation of the different types. * `delta` - Delta * `total` - Total
        - `metric_id` string, required
        - `custom_sql` string, nullable, required — A custom SQL query that can be used to define the metric. Please refer to our documentation for more information.
        - `categorical_filters` CategoricalFilter[], required
          - `property_name` string, required
          - `operator` 'isin' | 'isnotin', required — * `isin` - Is in * `isnotin` - Is not in
          - `comparison_value` string[], required
        - `usage_aggregation_type` 'count' | 'sum' | 'max' | 'unique' | 'latest' | 'average' — The type of aggregation that should be used for this metric. Please refer to our documentation for an explanation of the different types. * `count` - Count * `sum` - Sum * `max` - Max * `unique` - Unique * `latest` - Latest * `average` - Average
        - `billable_aggregation_type` 'count' | 'sum' | 'max' | 'unique' | 'latest' | 'average' | '' | 'null', nullable — * `count` - Count * `sum` - Sum * `max` - Max * `unique` - Unique * `latest` - Latest * `average` - Average
      - `cost` number, double, required
    - `revenue` number, double, required
  - `total_cost` number, double, required
  - `total_revenue` number, double, required
  - `profit_margin` number, double, required
  - `markup` number, double, required

---

[API](https://skmtc.net/uselotus/apis/lotus-api.md) · [All operations](https://skmtc.net/uselotus/apis/lotus-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/uselotus/lotus-api/versions/1f59f4fea13f/schema)
