Knowledge Center

Run billing with Floatless.

Product guides, billing concepts, operational playbooks, developer references, and security notes for teams running subscription revenue.

Usage events API

Usage events record consumption for metered subscription items. Floatless stores raw usage events and uses them when rating usage and generating invoices.

Endpoint

Method Endpoint Description
POST /usage/events Create a metered usage event

Idempotency

Send an Idempotency-Key header with every usage event. If your system retries after a timeout or network error, reuse the same key for the same event.

Idempotency-Key: 1d7a3870-2f87-4c31-b5df-0b4f59aaaf73

Keys can be up to 255 characters. Use a UUID or another high-entropy event identifier. Do not put personal data or secrets in idempotency keys.

Create a usage event

curl https://api.floatless.com/api/public/v1/usage/events \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 1d7a3870-2f87-4c31-b5df-0b4f59aaaf73" \
  -d '{
    "subscription_item_id": 789,
    "quantity": 42,
    "timestamp": "2026-07-07T10:15:00Z"
  }'

Parameters

Parameter Type Required Description
subscription_item_id integer Yes Metered subscription item ID
quantity number Yes Usage quantity for this event, greater than zero
timestamp datetime No When usage happened; defaults to receipt time
idempotency_key string No Body fallback if the header is not sent

Response

{
  "data": {
    "id": "2fbc3997-56cf-4fbf-8f98-40a521abfb6a",
    "object": "usage_event",
    "subscription_item_id": 789,
    "quantity": 42,
    "timestamp": "2026-07-07T10:15:00Z",
    "idempotency_key": "1d7a3870-2f87-4c31-b5df-0b4f59aaaf73",
    "recorded_at": "2026-07-07T10:15:02Z"
  }
}

Error cases

Code Meaning
400 Missing Idempotency-Key, invalid quantity, or subscription item is not metered
401 Missing or invalid API key
404 Subscription item does not exist in your organization
500 Unexpected server error

Next steps