---
title: "Query feature cost"
method: POST
path: "/openmeter/features/{featureId}/cost/query"
tags: ["OpenMeter Features"]
---

# Query feature cost

`POST /openmeter/features/{featureId}/cost/query`

Query the cost of a feature.

## Path parameters

- `featureId` string, required — ULID (Universally Unique Lexicographically Sortable Identifier).

## Request body

- MeterQueryRequest — A meter query request.
  - `from` string, date-time — [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.
  - `to` string, date-time — [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.
  - `granularity` 'PT1M' | 'PT1H' | 'P1D' | 'P1M' — The granularity of the time grouping. Time durations are specified in ISO 8601 format.
  - `time_zone` string — The value is the name of the time zone as defined in the IANA Time Zone Database (http://www.iana.org/time-zones). The time zone is used to determine the start and end of the time buckets. If not specified, the UTC timezone will be used.
  - `group_by_dimensions` string[] — The dimensions to group the results by.
  - `filters` MeterQueryFilters — Filters to apply to a meter query.
    - `dimensions` object — Filters to apply to the dimensions of the query. For `subject` and `customer_id` only equals ("eq", "in") comparisons are supported.

## Response `200`

The request has succeeded.

- FeatureCostQueryResult — Result of a feature cost query.
  - `from` string, date-time — [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.
  - `to` string, date-time — [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.
  - `data` FeatureCostQueryRow[], required — The cost data rows.
    - `usage` string, required — Numeric represents an arbitrary precision number.
    - `cost` string, required — Numeric represents an arbitrary precision number.
    - `currency` string, required — Three-letter [ISO4217](https://www.iso.org/iso-4217-currency-codes.html) currency code. Custom three-letter currency codes are also supported for convenience.
    - `detail` string — Detail message when cost amount is null, explaining why the cost could not be resolved.
    - `from` string, date-time, required — [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.
    - `to` string, date-time, required — [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.
    - `dimensions` object, required — The dimensions the value is aggregated over. `subject` and `customer_id` are reserved dimensions.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found

---

[API](https://skmtc.net/openmeterio/apis/openmeter-and-konnect-metering-billing-api.md) · [All operations](https://skmtc.net/openmeterio/apis/openmeter-and-konnect-metering-billing-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openmeterio/openmeter-and-konnect-metering-billing-api/versions/9bca44e2d61d/schema)
