Ingest a usage event

Records a single usage event for billing and tracking. Events feed into invoice calculations for usage-based and hybrid plans.

Idempotency: Pass an eventIdempotencyKey to enable safe retries. If omitted, one is auto-generated. Duplicate keys return 409 Conflict.

Customer identification: Use customerReferenceId (your internal ID), stripeCustomerId (your Stripe customer ID), or customerId (Tanso UUID). Use one, not multiple.

Cost tracking: Optionally include costAmount to track provider costs (COGS) alongside usage. If omitted, Tanso calculates cost automatically using costInput (model + inputTokens/outputTokens for two-rate pricing) with fallback chain: account default cost config > global model pricing table.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
string

A unique key for this event. Used to prevent duplicate processing on retries. Auto-generated if omitted.

string
required

Name of the event. Should match a feature key or a meaningful tracking label.

date-time

When the event occurred. ISO 8601 format. Defaults to the current time if omitted.

string

Optional flow identifier to correlate related events.

string

The key of the feature this event tracks usage for. Used to resolve pricing rules and billing.

uuid

Feature UUID. If provided, supersedes featureKey.

string

Your internal customer ID. Use one of customerReferenceId, stripeCustomerId, or customerId.

string

Stripe customer ID (cus_...). Creates a customer linked via Stripe bridge table. Preferred for Observe mode.

uuid

Tanso's internal customer UUID. Use one of customerReferenceId, stripeCustomerId, or customerId.

uuid

Optional subscription ID to associate the event with a specific subscription.

uuid

Optional entitlement ID for direct entitlement attribution.

uuid

Optional invoice ID for direct invoice attribution.

number

Provider cost (COGS) for this event. If omitted, Tanso calculates it automatically — either from costInput (model + provider lookup) or from the feature's configured cost model and usageUnits.

number

What you charged your customer for this event. Used for margin analysis in Observe mode. If omitted and a pricing rule is configured, Tanso calculates it from usageUnits.

number

The quantity of usage to record (e.g., API calls, tokens, storage GB). Used for billing calculations and margin analysis.

costInput
object

Model and provider information for automatic cost calculation. When provided, Tanso looks up current provider pricing to calculate cost automatically. Use this instead of costAmount when you want Tanso to track costs based on the model you called. Pass inputTokens and outputTokens for accurate two-rate pricing (e.g., different rates for input vs output tokens).

meta
object

Arbitrary metadata to attach to the event.

Headers
string

Optional idempotency key. Overrides eventIdempotencyKey in the body if provided.

Responses

Language
Credentials
URL
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json