---
title: "Update a meter"
description: "After the first counted event or the first price on the meter, only name can change."
canonical_url: "https://twominutebilling.com/help/developers/api-reference/usage/update-a-meter"
---
# Update a meter

> After the first counted event or the first price on the meter, only name can change.

<api-operation method="PATCH" path="/v1/businesses/{biz}/meters/{meter}">
<template v-slot:docs="">

After the first counted event or the first price on the meter, only `name` can change. Any other field is refused with 409: create a new meter instead.

## Path parameters

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        biz
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      The business's id (biz_…).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        meter
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <strong>
        yes
      </strong>
    </td>
    
    <td>
      The meter's id: the slug you chose.
    </td>
  </tr>
</tbody>
</table>

## Headers

<table>
<thead>
  <tr>
    <th>
      Parameter
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        Idempotency-Key
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Safely retry writes — repeats return the original response. If a write FAILED after it had already taken effect, that failure is what repeats: the key is spent, and a new attempt needs a new key.
    </td>
  </tr>
</tbody>
</table>

## Body

The request body is **required**.

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Required
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The meter's name.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        event_name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The event name it reads.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        aggregation
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      How events combine in a period. <code>
        avg
      </code>
      
       = total of the values ÷ number of events. <code>
        unique
      </code>
      
       counts distinct values of <code>
        unique_property
      </code>
      
      . <code>
        weighted_sum
      </code>
      
       bills a level × the time it held. One of <code>
        sum
      </code>
      
      , <code>
        count
      </code>
      
      , <code>
        min
      </code>
      
      , <code>
        max
      </code>
      
      , <code>
        avg
      </code>
      
      , <code>
        last
      </code>
      
      , <code>
        unique
      </code>
      
      , <code>
        weighted_sum
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        value_property
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The property holding the number. Required except for <code>
        count
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        unique_property
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      <code>
        unique
      </code>
      
       only: the property whose distinct values are counted.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        recurring
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      sum, last, max and unique only: the level carries into the next period.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        time_unit
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      <code>
        weighted_sum
      </code>
      
       only. One of <code>
        hour
      </code>
      
      , <code>
        day
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        filters
      </code>
    </td>
    
    <td>
      <code>
        object
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      An event counts only when every listed property has one of its values.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        group_by
      </code>
    </td>
    
    <td>
      <code>
        array of string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Up to 5 property names, in order. A price can set a rate for each combination.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        limit_dimensions
      </code>
    </td>
    
    <td>
      <code>
        array of string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Up to 3 event properties a spend limit can name (<code>
        property_key
      </code>
      
      ), so each value of the property has its own limit. Can change after the meter has usage.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        price_list
      </code>
    </td>
    
    <td>
      <code>
        object
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Maps each combination to a model price list key, for <code>
        model_price_list
      </code>
      
       prices and line cost. Each key it reads must be in <code>
        group_by
      </code>
      
      . Can change after the meter has usage.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        price_list.provider
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The list provider for every event.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        price_list.provider_key
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Or: the group key that names the provider.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        price_list.model_key
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The group key that names the model. Default <code>
        model
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        price_list.token_type
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The token type for every event, such as <code>
        input
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        price_list.token_type_key
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Or: the group key that names the token type.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        cost_currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      The currency of event <code>
        cost
      </code>
      
       for events that name none. Null = the price's currency.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        expected_version
      </code>
    </td>
    
    <td>
      <code>
        integer
      </code>
    </td>
    
    <td>
      no
    </td>
    
    <td>
      Refuse the write if the meter changed.
    </td>
  </tr>
</tbody>
</table>

## Response

<table>
<thead>
  <tr>
    <th>
      Field
    </th>
    
    <th>
      Type
    </th>
    
    <th>
      Description
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        object
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The object type; always <code>
        meter
      </code>
      
      . One of <code>
        meter
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        id
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The meter's id.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The meter's name.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        event_name
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The event name it reads.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        aggregation
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      How events combine in a period. <code>
        avg
      </code>
      
       = total of the values ÷ number of events. <code>
        unique
      </code>
      
       counts distinct values of <code>
        unique_property
      </code>
      
      . <code>
        weighted_sum
      </code>
      
       bills a level × the time it held. One of <code>
        sum
      </code>
      
      , <code>
        count
      </code>
      
      , <code>
        min
      </code>
      
      , <code>
        max
      </code>
      
      , <code>
        avg
      </code>
      
      , <code>
        last
      </code>
      
      , <code>
        unique
      </code>
      
      , <code>
        weighted_sum
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        value_property
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The property holding the number. Required except for <code>
        count
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        unique_property
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        unique
      </code>
      
       only: the property whose distinct values are counted.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        recurring
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      sum, last, max and unique only: the level carries into the next period.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        time_unit
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      <code>
        weighted_sum
      </code>
      
       only. One of <code>
        hour
      </code>
      
      , <code>
        day
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        filters
      </code>
    </td>
    
    <td>
      <code>
        object
      </code>
    </td>
    
    <td>
      An event counts only when every listed property has one of its values.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        group_by
      </code>
    </td>
    
    <td>
      <code>
        array of string
      </code>
    </td>
    
    <td>
      Up to 5 property names, in order. A price can set a rate for each combination.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        limit_dimensions
      </code>
    </td>
    
    <td>
      <code>
        array of string
      </code>
    </td>
    
    <td>
      Up to 3 event properties a spend limit can name (<code>
        property_key
      </code>
      
      ), so each value of the property has its own limit. Can change after the meter has usage.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        price_list
      </code>
    </td>
    
    <td>
      <code>
        object
      </code>
    </td>
    
    <td>
      Maps each combination to a model price list key, for <code>
        model_price_list
      </code>
      
       prices and line cost. Each key it reads must be in <code>
        group_by
      </code>
      
      . Can change after the meter has usage.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        cost_currency
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The currency of event <code>
        cost
      </code>
      
       for events that name none. Null = the price's currency.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        status
      </code>
    </td>
    
    <td>
      <code>
        string
      </code>
    </td>
    
    <td>
      The meter's status. One of <code>
        active
      </code>
      
      , <code>
        archived
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        locked
      </code>
    </td>
    
    <td>
      <code>
        boolean
      </code>
    </td>
    
    <td>
      True once the meter has a counted event or a price: only <code>
        name
      </code>
      
       can change.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        created_at
      </code>
    </td>
    
    <td>
      <code>
        string · ISO-8601
      </code>
    </td>
    
    <td>
      When the meter was created (ISO-8601 UTC).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        updated_at
      </code>
    </td>
    
    <td>
      <code>
        string · ISO-8601
      </code>
    </td>
    
    <td>
      When the meter was last changed (ISO-8601 UTC).
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        resource_version
      </code>
    </td>
    
    <td>
      <code>
        integer
      </code>
    </td>
    
    <td>
      A number that goes up on every change.
    </td>
  </tr>
</tbody>
</table>

## Status codes

<table>
<thead>
  <tr>
    <th>
      Status
    </th>
    
    <th>
      Meaning
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        200
      </code>
    </td>
    
    <td>
      The meter.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        404
      </code>
    </td>
    
    <td>
      No such meter.
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        409
      </code>
    </td>
    
    <td>
      The meter has usage, so this field cannot change.
    </td>
  </tr>
</tbody>
</table>
</template>

<template v-slot:request="">

```bash [Request]
curl -X PATCH "$TMBILLING_URL/v1/businesses/biz_XXXXXXXXXXXX01/meters/Meter" \
  -H "Authorization: Bearer $TMBILLING_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "AI tokens"
  }'
```

</template>

<template v-slot:response="">
<code-group>

```json [200 OK]
{
  "object": "meter",
  "id": "ai_tokens",
  "name": "AI tokens",
  "event_name": "ai_tokens",
  "aggregation": "sum",
  "value_property": "tokens",
  "unique_property": "Unique property",
  "recurring": false,
  "time_unit": "hour",
  "filters": {
    "region": [
      "eu",
      "us"
    ]
  },
  "group_by": [
    "model",
    "token_type"
  ],
  "limit_dimensions": [
    "user"
  ],
  "price_list": {
    "provider": "openai",
    "token_type_key": "token_type"
  },
  "cost_currency": "USD",
  "status": "active",
  "locked": false,
  "created_at": "2026-03-14T09:30:00Z",
  "updated_at": "2026-03-14T09:30:00Z",
  "resource_version": 1
}
```

```json [404 Not Found]
{
  "error": {
    "type": "invalid_request_error",
    "message": "No such meter."
  }
}
```

```json [409 Conflict]
{
  "error": {
    "type": "conflict_error",
    "message": "The meter has usage, so this field cannot change."
  }
}
```

</code-group>
</template>
</api-operation>


## Sitemap

See the full [sitemap](https://twominutebilling.com/sitemap.md) for all pages.
