# Record usage (one event or a batch of up to 1000)

`POST /api/v1/meter-events`

Needs the `usage:write` scope, or a full-access key.

## Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | string | optional | A unique value for this operation, chosen by you. A retry with the same key and the same body returns the first response instead of running again. The same key with a different body answers 409 `idempotency_key_reused`; a key whose first request is still running answers 409 `idempotency_in_progress`. |

## Request body

JSON Schema:

```json
{
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "minLength": 1,
          "maxLength": 200,
          "description": "Your idempotency id — a replay is a no-op reported as `duplicate: true`."
        },
        "meter": {
          "type": "string"
        },
        "customer_id": {
          "type": "string",
          "format": "uuid",
          "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
        },
        "customer_external_id": {
          "type": "string",
          "description": "Exactly one of customer_id / customer_external_id."
        },
        "quantity": {
          "type": "integer",
          "minimum": 0,
          "description": "Default 1."
        },
        "timestamp": {
          "type": "string",
          "format": "date-time"
        },
        "properties": {
          "type": "object",
          "additionalProperties": {}
        }
      },
      "required": [
        "id",
        "meter"
      ]
    },
    {
      "type": "object",
      "properties": {
        "events": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "description": "Your idempotency id — a replay is a no-op reported as `duplicate: true`."
              },
              "meter": {
                "type": "string"
              },
              "customer_id": {
                "type": "string",
                "format": "uuid",
                "example": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
              },
              "customer_external_id": {
                "type": "string",
                "description": "Exactly one of customer_id / customer_external_id."
              },
              "quantity": {
                "type": "integer",
                "minimum": 0,
                "description": "Default 1."
              },
              "timestamp": {
                "type": "string",
                "format": "date-time"
              },
              "properties": {
                "type": "object",
                "additionalProperties": {}
              }
            },
            "required": [
              "id",
              "meter"
            ]
          },
          "minItems": 1,
          "maxItems": 1000
        }
      },
      "required": [
        "events"
      ]
    }
  ]
}
```

## Responses

### 200

Batch: counts and per-event results (a single replayed event also answers 200 with `duplicate: true`). A bad reference rejects the whole batch with 422.

JSON Schema:

```json
{
  "type": "object",
  "properties": {
    "data": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string"
            },
            "duplicate": {
              "type": "boolean"
            }
          },
          "required": [
            "id",
            "duplicate"
          ]
        },
        {
          "type": "object",
          "properties": {
            "inserted": {
              "type": "integer"
            },
            "duplicates": {
              "type": "integer"
            },
            "results": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string"
                  },
                  "duplicate": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "id",
                  "duplicate"
                ]
              }
            }
          },
          "required": [
            "inserted",
            "duplicates",
            "results"
          ]
        }
      ]
    },
    "_agent": {
      "type": "object",
      "properties": {
        "summary": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "enum": [
            "ok"
          ]
        },
        "next_actions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "summary",
        "status",
        "next_actions",
        "warnings"
      ]
    },
    "api_version": {
      "type": "string",
      "example": "2026-07-01"
    }
  },
  "required": [
    "data",
    "_agent",
    "api_version"
  ]
}
```

### 201

A single new event: `{ id, duplicate: false }`.
