---
title: "Estimate costs from existing usage"
method: POST
path: "/v1/cost-estimate/from-usage"
tags: ["Charges"]
---

# Estimate costs from existing usage

`POST /v1/cost-estimate/from-usage`

Estimate costs from existing usage events without creating charges.

Queries usage events in the specified period and calculates what they would cost
based on pricing plans. Supports custom pricing overrides for "what-if" scenarios.

**Use cases:**
- Budget planning and forecasting
- Cost allocation previews
- Retroactive pricing analysis
- Comparing pricing strategies

The response includes per-usage-type line items with quantity, unit price,
and estimated cost. Notes indicate which usage types used custom pricing,
default pricing, or had no pricing plan available.

## Request body

- object
  - `customerId` string — Filter to a specific customer. Omit to estimate across all customers.
  - `periodStart` string, date-time, required — Start of the estimation period (ISO 8601)
  - `periodEnd` string, date-time, required — End of the estimation period (ISO 8601)
  - `defaultUnitPrice` string — Default unit price (USDC) for usage types without a pricing plan
  - `includeChargedEvents` boolean — Include events that already have charges (default: true)
  - `usageTypes` string[] — Filter to specific usage types
  - `customPricing` object — Custom pricing overrides: usageType → unitPrice. Takes precedence over DB pricing plans.

## Response `200`

Cost estimate with line item breakdown

- object — Cost estimate with line item breakdown
  - `businessId` string
  - `customerId` string
  - `periodStart` string
  - `periodEnd` string
  - `lineItems` object[]
    - `usageType` string
    - `quantity` string
    - `unitPrice` string
    - `estimatedCostUsdc` string
    - `eventCount` integer
    - `hasPricingPlan` boolean
  - `subtotalUsdc` string
  - `estimatedTotalUsdc` string
  - `currency` 'USDC'
  - `isEstimate` true
  - `generatedAt` string, date-time
  - `notes` string[]

## Other responses

- `400` — Invalid request parameters
- `401` — Missing or invalid API key
- `404` — Customer not found
- `429` — Rate limit exceeded

---

[API](https://skmtc.net/usedrip/apis/drip-api.md) · [All operations](https://skmtc.net/usedrip/apis/drip-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/usedrip/drip-api/revisions/2cb1567969ca/schema)
