# Create Meter

<Note>
**Enabled per organization**

Usage-based billing must be enabled for your organization before these endpoints accept requests. Contact your WHITELABEL account manager to enable it. Requests from an organization where it is not enabled return `403 PRODUCT_NOT_ENABLED`.
</Note>

<Note>
**`event_name` and `aggregation` are immutable**

They define what your systems send and how it counts, so they can't change after creation (a PATCH that includes them is silently ignored). To change either, create a new meter with a new `event_name` and archive the old one with [Update Meter](/reference/meters/update-meter) (`status: INACTIVE`). `event_name` is unique per account across active **and** archived meters, so pick a name you won't need to reuse. `status` sent on creation is ignored — a new meter is always `ACTIVE`.
</Note>

See [The Meter Object](/reference/meters/the-meter-object) for every field, and the [Usage-Based Billing guide](/docs/payment-features/subscriptions/usage-based-billing) for the end-to-end flow. Refer to [Meter Error Codes](/reference/meters/meter-error-codes) for the possible error outcomes.

**POST** `/subscriptions/meters`

Base URL: `https://api-sandbox.whitelabel.com/v1`

Usage-based billing must be enabled for your organization before this endpoint accepts requests (otherwise `403 PRODUCT_NOT_ENABLED`). Creates a meter: a named, countable action your product performs (tokens, API requests, gigabytes held). The meter defines the `event_name` your systems send and how the reported values aggregate per billing cycle. Attach it to a plan as a metered price to bill usage.

## Authorization

- public-api-key (apiKey in header)
- private-secret-key (apiKey in header)

## Header parameters

- `X-Idempotency-Key` (string, required)
  Unique identifier used in HTTP headers to ensure that a request is processed only once, even if it is retried due to network issues or timeouts. Optional, as on the rest of the WHITELABEL API.

## Body

Content type: `application/json`

- `account_id` (string, required)
  The unique identifier of the account the meter belongs to (UUID, 36 chars).
- `name` (string, required)
  The meter display name (MAX 255; MIN 3). Leading and trailing spaces are trimmed.
- `description` (string)
  What the meter counts and how. Optional but recommended — it is how your team and WHITELABEL support understand the meter.
- `event_name` (string, required)
  The key your systems send on every usage event to reference this meter (MAX 100; lowercase letters, digits, `_` and `.` only — `^[a-z0-9_.]+$`). Must be unique across all meters of the account, `ACTIVE` or `INACTIVE`, else `409 METER_EVENT_NAME_CONFLICT`. Immutable after creation.
- `aggregation` ("SUM" | "COUNT" | "LAST", required)
  How reported events roll up into the cycle quantity. `SUM` adds every event `value` (tokens, minutes). `COUNT` counts events, ignoring `value` (API requests). `LAST` keeps the most recent `value` (a gauge such as gigabytes held). Immutable after creation.
- `unit_label` (string)
  Singular unit label used when the usage is displayed. Example: `token`.
- `plural_unit_label` (string)
  Plural unit label used when the usage is displayed. Example: `tokens`.
- `default_price` (object)
  - `currency` (string, required)
    MAX 3; MIN 3. Must be `USD` — any other currency is rejected with `400 INVALID_PARAMETERS`.
  - `value` (number<float>, required)
    Default price per unit beyond the included credits (multiple of 0.0001). Inherited by USD plans that attach this meter without an explicit `price_per_credit`.
- `metadata` (object[])
  Optional key-value pairs attached to the meter (MAX 48 entries; keys must be unique per meter).
  - `key` (string, required)
    MAX 48.
  - `value` (string, required)
    MAX 512.
- `status` ("ACTIVE" | "INACTIVE")
  Ignored on creation — a new meter is always `ACTIVE`. Use Update Meter to archive it.

Example:

```json
{
  "account_id": "string",
  "name": "string",
  "description": "string",
  "event_name": "string",
  "aggregation": "SUM",
  "unit_label": "string",
  "plural_unit_label": "string",
  "default_price": {
    "currency": "string",
    "value": 0
  },
  "metadata": [
    {
      "key": "string",
      "value": "string"
    }
  ],
  "status": "ACTIVE"
}
```

## Responses

### 201

201

- `id` (string)
  The unique identifier of the meter.
- `account_id` (string)
  The unique identifier of the account that owns the meter.
- `name` (string)
- `description` (string)
- `event_name` (string)
- `aggregation` ("SUM" | "COUNT" | "LAST")
- `unit_label` (string)
- `plural_unit_label` (string)
- `default_price` (object)
  - `currency` (string)
  - `value` (number)
- `metadata` (object[])
  - `key` (string)
  - `value` (string)
- `status` ("ACTIVE" | "INACTIVE")
- `created_at` (string)
  Set by WHITELABEL on creation.
- `updated_at` (string)
  Set by WHITELABEL on every update.

Example:

```json
{
  "id": "string",
  "account_id": "string",
  "name": "string",
  "description": "string",
  "event_name": "string",
  "aggregation": "SUM",
  "unit_label": "string",
  "plural_unit_label": "string",
  "default_price": {
    "currency": "string",
    "value": 0
  },
  "metadata": [
    {
      "key": "string",
      "value": "string"
    }
  ],
  "status": "ACTIVE",
  "created_at": "string",
  "updated_at": "string"
}
```

### 400

400

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "string",
  "messages": [
    "string"
  ]
}
```

### 403

403

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "PRODUCT_NOT_ENABLED",
  "messages": [
    "string"
  ]
}
```

### 409

409

- `code` (string)
- `messages` (string[])

Example:

```json
{
  "code": "string",
  "messages": [
    "string"
  ]
}
```