Skip to main content
Product-credit values are exact decimal strings. Do not convert balances, transfer amounts, or deductions to JavaScript number when precision matters.

List credit systems

list() fetches every active page and returns normalized camel-case CreditSystem objects.

Customer balances

CreditBalance includes credit-system metadata, available, an as_of timestamp, and ordered balance sources. Sources identify their type, initial and remaining amounts, validity window, priority, scope, and transfer flags.

Customer operation history

limit must be an integer from 1 to 100. Operations expose exact credit amounts, status, reason, rate snapshot, event time, and source allocations.

Entity balances

pool_policy is entity_only, entity_then_customer, customer_only, or null when no policy applies.

Entity operation history

Allocate credits

Transfers require a secret key, a positive decimal string with at most 12 decimal places, and an idempotency key.

Deallocate credits

Transfers are subject to Nozle’s exact transfer policy and source eligibility rules. Retry an uncertain transfer with the same key and payload.

Advisory usage check

occurredAt is the event time as an RFC 3339 string with an offset or Z, or Unix seconds as a numeric string (the latter from the Engine release that includes the broader timestamp forms). It defaults to now. usage.check() does not reserve or mutate credits. Another request can spend the projected sources before a later consume request.

Atomic usage tracking

usage.track() atomically evaluates the metric conversion, selects eligible sources, deducts credits, and records the operation. The optional Entity ID enables Entity attribution and configured pool policy.
Retrying. Pass the same idempotencyKey and the same timestamp on every retry of one unit of work. If you omit timestamp, the SDK fills in the current time once per idempotency key and reuses it when the same key is sent again on the same client (it remembers the last 1,000 keys). A retry from another process, or after a restart, gets a new time, no longer matches the first request, and the API returns 409 idempotency_key_reused; pass a fixed timestamp there. With a fixed timestamp, a retry replays the original result, including a denial, and does not charge again. A timestamp from before the credit rate became effective returns 422 no effective credit rate. See errors and retries.

Legacy wallet adapter

nozle.checkAndDeduct({ customerId, credits }) is deprecated and remains available for the legacy wallet path. It is not idempotent: a retry after a timeout can deduct again, so the SDK never retries it. The feature field is deprecated: it is still accepted but is not sent and has no effect. Use usage.check() and usage.track() with a credit system instead.

Security

Keep credit reads and all mutations behind authenticated backend routes. Derive customer and Entity IDs from server-owned identity data and return only fields the browser needs.