Skip to main content
Usage billing starts with an application-owned event. Each logical event should have a stable transaction ID, a customer, a Feature code, and the properties required by that metric.

1. Track from your backend

Node.js
Python
Go
The Go SDK defaults to https://api.nozle.app/engine and https://api.nozle.app/core. Its Track method converts RFC3339 timestamps to the Unix-seconds form accepted by Engine. Event writes use the Engine base URL; subscription discovery uses Core.

2. Ingest and deduplicate

Nozle accepts the event through the Go Engine at https://api.nozle.app/engine/api/v1/events. Preserve the transaction ID, the timestamp and the rest of the payload when retrying the same logical event. A transaction ID is unique within the organization. What happens to a repeated one depends on the organization’s event store: On the standard store, “same payload” means the same feature code, subscription, properties and precise_total_amount_cents, and the same timestamp when the request sends one. In a batch, a reused ID with a different payload, or the same ID twice in one batch, rejects the whole batch with 422 validation_errors and transaction_id: ["value_already_exist"] for that event. On the high-volume store, repeats are removed when usage is read for billing, not at ingestion. With deduplication turned on for the organization (off by default; Nozle sets it), only the first copy ingested for each transaction ID counts, whatever its timestamp or payload. Without it, copies that share the transaction ID, timestamp, feature code and subscription are merged into one by the store in the background, and a copy with a different timestamp counts as a separate event. Either way the response does not say which copy counts, so never reuse a transaction ID for a changed event.

3. Aggregate usage

Metered Features define how properties are aggregated, including count, sum, maximum, and unique count. Property names must match the Feature configuration exactly.

4. Invoice and analyze

Aggregated usage becomes invoice charges according to the plan’s pricing model. The same event metadata can feed cost models and margin reporting.

Product-credit events

For actions that must be authorized and deducted from product credits, call usage.track() in Node.js, usage.track() in Python, or TrackUsage() in Go instead of sending a plain event. Nozle records the credit operation and queues the matching billing event in one durable workflow.

Operational guidance

  • Publish from a durable worker for high-volume or business-critical telemetry.
  • Reuse the same transaction ID and timestamp on retries.
  • Supply a subscription ID explicitly when a customer can have multiple active subscriptions (subscriptionId in Node.js, subscription_id in Python, or SubscriptionID in Go).
  • Do not expect a plain event to reserve credits or synchronously update an invoice.