Events

Preview usage events

Changed on

Dry-run of POST /v1/events/ingest: send the exact batch you would ingest and get a per-event report of what would happen — nothing is stored.

For each event: whether it passes validation (invalid events are reported in place instead of rejecting the batch, unlike ingest), the event_id it would be recorded under, whether it would deduplicate against an already-stored event or an earlier entry of the same batch (advisory — another writer can land between preview and ingest), the active meters that would consume it, and the same warnings ingest returns.

Usage events are immutable once ingested, so preview is the way to gain first-run confidence: wire your integration against preview, check valid is true and every event matches the meters you expect, then switch the path to ingest.

post/v1/events/preview

Request

Request body

Example request

{
  "events": [
    {
      "name": "image.generated",
      "customer_id": "cust_abc123",
      "external_customer_id": "user-42",
      "event_id": "order-1234",
      "timestamp": "2026-08-15T10:30:00.000Z",
      "properties": {
        "tokens": 1200,
        "tier": "pro"
      }
    }
  ]
}

Response

Per-event report; nothing was stored

validboolean required

Whether the batch as submitted would be accepted by POST /v1/events/ingest (ingest validation is all-or-nothing)

Example response

{
  "events": [
    {
      "event_id": "order-1234",
      "customer_id": "cust_abc123",
      "error": {
        "code": "invalid_usage_event",
        "param": "customer_id"
      },
      "matched_meters": [
        "mtr_abc123"
      ],
      "warnings": [
        {
          "code": "no_matching_meter"
        }
      ]
    }
  ]
}

Changes

    • breaking

      the // response's property type changed from object to string for status

    • breaking

      the // response's property type changed from object to boolean for status

    • breaking

      the /////// response's property type changed from object to string for status

    • breaking

      the // response's property type changed from object to string for status

    • info

      endpoint added