Skip to main content
POST
Queue a usage event for creation.

Authorizations

x-api-key
string
header
required

LedgerUp API Key.

Headers

Idempotency-Key
string

Optional. Duplicate keys within the same company namespace and route return 409. Non-empty idempotency key for deduplicating write requests on the same route.

Example:

"6f31c20e-725c-4be8-96f4-835042f67602"

Body

application/json

Create-event request. Exactly one of metric_id or currency is required. Unknown JSON fields are rejected.

metric_id
string
required

LedgerUp metric identifier. Required when currency is null.

Pattern: ^metric_[0-9a-f]{32}$
Example:

"metric_0194f4e3a2b77c6aa91c4f6b4db2a980"

quantity
string
required

Decimal quantity as a string.

Pattern: ^-?\d+(\.\d+)?$
Example:

"1250.5"

account_id
string
required

LedgerUp account identifier.

Pattern: ^account_[0-9a-f]{32}$
Example:

"account_0194f4e3a2b77c6aa91c4f6b4db2a980"

occurred_at
integer<int64>
required

Must be within five years before or after the current time.

Example:

1767225600

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.

Pattern: ^[A-Za-z]{3}$
Example:

"usd"

properties
any
default:{}

Arbitrary JSON object or value. If omitted on write endpoints, the service stores an empty object.

Response

Accepted and queued.

id
string
required

LedgerUp event identifier.

Pattern: ^event_[0-9a-f]{32}$
Example:

"event_0194f4e3a2b77c6aa91c4f6b4db2a980"

metric_id
string
required

LedgerUp metric identifier, or the lowercase three-letter currency code for currency usage events.

Pattern: ^(metric_[0-9a-f]{32}|[a-z]{3})$
Example:

"metric_0194f4e3a2b77c6aa91c4f6b4db2a980"

currency
string | null
required

Three-letter lowercase currency code. Quantity is expressed in major currency units, not minor units. Null for metric usage events.

Pattern: ^[a-z]{3}$
Example:

"usd"

quantity
string
required

Decimal quantity serialized as a string.

Pattern: ^-?\d+(\.\d+)?$
Example:

"1250.5"

account_id
string
required

LedgerUp account identifier.

Pattern: ^account_[0-9a-f]{32}$
Example:

"account_0194f4e3a2b77c6aa91c4f6b4db2a980"

occurred_at
integer<int64>
required

Unix timestamp in seconds.

Example:

1767225600

properties
any
default:{}
required

Arbitrary JSON object or value. If omitted on write endpoints, the service stores an empty object.

accepted_at
integer<int64>
required

Unix timestamp in seconds.

Example:

1767225600

created_at
integer<int64> | null
required

ClickHouse insertion timestamp. Null in the initial 202 response while the event is queued.

Example:

1767225600