---
title: "Queue a usage event for creation."
method: POST
path: "/v2/events"
tags: ["Events"]
---

# Queue a usage event for creation.

`POST /v2/events`

## Headers

- `Idempotency-Key` string — Non-empty idempotency key for deduplicating write requests on the same route.

## Request body

- union — Create-event request. Exactly one of metric_id or currency is required. Unknown JSON fields are rejected.
  - object
    - `metric_id` string, required — LedgerUp metric identifier. Required when currency is null.
    - `currency` string — Three-letter ISO 4217-style currency code. Quantity is expressed in major currency units, not minor units. Required when metric_id is omitted. Stored lowercase and also used as metric_id.
    - `quantity` string, required — Decimal quantity as a string.
    - `account_id` string, required — LedgerUp account identifier.
    - `occurred_at` integer, required — Unix timestamp in seconds.
    - `properties` unknown
  - object
    - `metric_id` string — LedgerUp metric identifier. Required when currency is null.
    - `currency` string, required — Three-letter ISO 4217-style currency code. Quantity is expressed in major currency units, not minor units. Required when metric_id is omitted. Stored lowercase and also used as metric_id.
    - `quantity` string, required — Decimal quantity as a string.
    - `account_id` string, required — LedgerUp account identifier.
    - `occurred_at` integer, required — Unix timestamp in seconds.
    - `properties` unknown

## Response `202`

Accepted and queued.

- Event
  - `id` string, required — LedgerUp event identifier.
  - `metric_id` string, required — LedgerUp metric identifier, or the lowercase three-letter currency code for currency usage events.
  - `currency` string, nullable, required — Three-letter lowercase currency code. Quantity is expressed in major currency units, not minor units. Null for metric usage events.
  - `quantity` string, required — Decimal quantity serialized as a string.
  - `account_id` string, required — LedgerUp account identifier.
  - `occurred_at` integer, required — Unix timestamp in seconds.
  - `properties` unknown, required
  - `accepted_at` integer, required — Unix timestamp in seconds.
  - `created_at` integer, required — Unix timestamp in seconds.

## Other responses

- `400` — Bad request, invalid header, invalid amount/quantity/currency, or text validation failure.
- `401` — Missing or invalid API key.
- `403` — API key lacks the required permission, or reset was attempted outside the test namespace.
- `408` — Request exceeded the 30 second timeout.
- `409` — Duplicate idempotency key, uniqueness conflict, or foreign-key conflict.
- `413` — Request body exceeded the 256 KiB limit.
- `415` — Write request content type was not application/json.
- `422` — Semantically invalid request, such as a service period with start greater than end.
- `429` — Rate limit exceeded.
- `500` — Internal server error or queue failure.

---

[API](https://skmtc.dev/ledgerup/apis/ledgerup-api.md) · [All operations](https://skmtc.dev/ledgerup/apis/ledgerup-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/ledgerup/ledgerup-api/revisions/be257191807b/schema)
