# Meter

URL: /business/nouns/meter · Id: `noun:meter`

> A Meter is a billable measure of usage that turns usage Events into Entries exactly once.

A Meter is a billable measure of usage that turns usage [Events](/business/nouns/event) into [Entries](/business/nouns/entry) exactly once.

## Properties
| Property | Type | Required | Description |
| --- | --- | --- | --- |
| `unit` | `string` | Yes | What it counts, such as calls or tokens. |
| `of` | `string` | Yes | The declared Event the Meter counts. |
| `aggregation` | `string` | Yes | How counted Events combine over the window: a sum of a value, a count, or the last value. |
| `window` | `string` | Yes | The period usage accrues over before it bills, such as a month. |

## Object
```json
{
  "$id": "https://api.sb/ledgerlark.com/meters/meter_1",
  "$type": "Meter",
  "unit": "call",
  "of": "Reminder.sent",
  "aggregation": "sum",
  "window": "month"
}
```

## Relationships
- <a id="rel-counts"></a>A Meter **counts** many [Events](/business/nouns/event): the [Events](/business/nouns/event) the Meter counts toward usage billing. `counts`, inverse [`meteredBy`](/business/nouns/event#rel-metered-by).

## Verbs
| Verb | Description | Subject | Event | Class |
| --- | --- | --- | --- | --- |
| <a id="create"></a>[Meter.create](/business/nouns/meter/create) | Creates a Meter. Inherited from [Noun](/business/nouns/noun). | None. | `Meter.created` | Two-way: `try`, `send`, `do` |
| <a id="get"></a>[Meter.get](/business/nouns/meter/get) | Returns one Meter by id. Inherited from [Noun](/business/nouns/noun). | None. | None. | Read: `try`, `do` |
| <a id="list"></a>[Meter.list](/business/nouns/meter/list) | Returns Meters, newest first, one page at a time. Inherited from [Noun](/business/nouns/noun). | None. | None. | Read: `try`, `do` |
| <a id="update"></a>[Meter.update](/business/nouns/meter/update) | Changes the given properties of a Meter. Inherited from [Noun](/business/nouns/noun). | None. | `Meter.updated` | Two-way: `try`, `send`, `do` |
| <a id="delete"></a>[Meter.delete](/business/nouns/meter/delete) | Deletes a Meter; its history is kept. Inherited from [Noun](/business/nouns/noun). | None. | `Meter.deleted` | One-way: `send`, `do` |

## Permissions
Which Access level may call each Verb. One-way Verbs wait their delay window.

| Operation | `owner` | `admin` | `member` | `viewer` |
| --- | --- | --- | --- | --- |
| `Meter.create` | Yes | Yes | Yes | No |
| `Meter.get` | Yes | Yes | Yes | Yes |
| `Meter.list` | Yes | Yes | Yes | Yes |
| `Meter.update` | Yes | Yes | Yes | No |
| `Meter.delete` | Yes | Yes | Yes | No |

## Call it

**Ask**

```text
Add a meter to PatentPad.
```

**API**

```bash
curl -X POST https://api.sb/patentpad.com/meters \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"unit":"call","of":"Reminder.sent","aggregation":"sum","window":"month"}'
```

```json
{
  "api": "https://api.sb/patentpad.com",
  "meter": {
    "$id": "https://api.sb/patentpad.com/meters/meter_1",
    "$type": "Meter",
    "unit": "call",
    "of": "Reminder.sent",
    "aggregation": "sum",
    "window": "month"
  },
  "action": {
    "$id": "https://api.sb/patentpad.com/actions/action_1",
    "operation": "Meter.create",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/patentpad.com/actions/action_1"
  }
}
```

**SDK**

```ts
import { $ } from 'startup-builder'

const meter = await $.Meter.create({ unit: 'call', of: 'Reminder.sent', aggregation: 'sum', window: 'month' })
```

**CLI**

```bash
npx startup-builder do Meter.create --json '{"unit":"call","of":"Reminder.sent","aggregation":"sum","window":"month"}'
```

**MCP**

```json
{
  "name": "do",
  "arguments": {
    "code": "return await $.Meter.create({ unit: 'call', of: 'Reminder.sent', aggregation: 'sum', window: 'month' })"
  }
}
```

## Example
The `reminder` Meter of a clinic-reminder [SaaS](/products/templates/saas) counts each `Reminder.sent` [Event](/business/nouns/event) once and posts one [Entry](/business/nouns/entry) per reminder at $0.03.