Skip to main content
POST
Create a metric.

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-metric request. Unknown JSON fields are rejected.

name
string
required

Human-readable name. Maximum 256 Unicode scalar values.

Maximum string length: 256
Example:

"Acme"

description
string | null

Optional description. Maximum 2048 Unicode scalar values.

Maximum string length: 2048
Example:

"Usage tracked for Acme."

measurement_units
string | null

Optional unit of measure for the metric, such as m, ft, seconds, or tokens.

Maximum string length: 256
Example:

"m"

Response

Created.

id
string
required

LedgerUp metric identifier.

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

"metric_0194f4e3a2b77c6aa91c4f6b4db2a980"

name
string
required

Human-readable name. Maximum 256 Unicode scalar values.

Maximum string length: 256
Example:

"Acme"

description
string | null
required

Optional description. Maximum 2048 Unicode scalar values.

Maximum string length: 2048
Example:

"Usage tracked for Acme."

measurement_units
string | null
required

Optional unit of measure for the metric, such as m, ft, seconds, or tokens.

Maximum string length: 256
Example:

"m"

created_at
integer<int64>
required

Unix timestamp in seconds.

Example:

1767225600

updated_at
integer<int64>
required

Unix timestamp in seconds.

Example:

1767225600

archived_at
integer<int64> | null
required

Unix timestamp in seconds.

Example:

1767225600