Kaiten
Core Concepts

Usage & Metering

How entitlement usage is tracked, reported, and monitored.

Usage & Metering

Kaiten tracks entitlement usage per instance, allowing you to monitor consumption against license thresholds.

How Usage Works

  1. An instance is linked to a license with entitlements and threshold values
  2. Your application reports usage via the API
  3. Kaiten stores the current consumption in entitlement_usage
  4. When usage reaches the threshold, an INSTANCE_ENTITLEMENT_USAGE_REACHED event is emitted

Reporting Usage

POST /api/instances/{instanceSlug}/entitlements/{entitlementSlug}/usage
{"value": 42}

The reported value is aggregated according to the entitlement's aggregation_method (SUM, COUNT, AVERAGE, MAX, MIN, LATEST).

Usage Value Shape

Usage is stored as structured JSON:

{
  "type": "number",
  "value": 42,
  "event_count": 5
}
FieldDescription
typeAlways "number"
valueCurrent aggregated value
event_countNumber of usage reports received

Feature Audit Trail

Kaiten maintains an append-only audit trail for entitlement operations on each instance:

EventStatusDescription
kaiten.v1.entitlement.value.getACCEPTEDAn entitlement value was read
kaiten.v1.entitlement.usage.report.acceptedACCEPTEDUsage report was accepted (below threshold)
kaiten.v1.entitlement.usage.report.rejectedREJECTEDUsage report was rejected (above threshold)

Querying the Audit Trail

GET /api/instances/{instanceSlug}/audit-trails?event_name=kaiten.v1.entitlement.usage.report.accepted&limit=50

Filter parameters: event_name, after, before (RFC3339), limit (1-200), offset.

Audit Trail vs Domain Events

AspectFeature Audit TrailDomain Events (Outbox)
PurposeTrack entitlement reads/reports per instanceTrack CRUD mutations across all entities
Storagefeature_audit_trail tableoutbox_events table → CDC → webhooks
ScopePer instance, per entitlement operationPer organization, per entity type
DeliveryQueried via REST/GraphQLDelivered via webhooks (Svix)

See It in the Console

The Instance detail page in the Console shows live entitlement usage charts, per-entitlement consumption vs threshold, and the full audit trail with filters and event inspection.

On this page