Track usage
Creates the customer if needed and immediately issues a separate grant for each configured customer.created policy before charging usage. Customer creation, grants, and usage commit together; failures roll back all writes. Consumes only grants listing the requested feature. Grants share their balance across their listed features. Subscription grants require an active or trialing subscription before its access expiry; purchased grants remain independent. New events use pricing from the active, ready deployment. Grant feature lists remain fixed when plans or deployments change. Even zero-cost usage requires a positive matching balance. The sum aggregation reads a numeric scalar payload directly. For object payloads, set aggregation.field to a numeric field path such as usage.items[3].value. A fixed-price sum with no field defaults an omitted payload to 1. The distinct aggregation records one unit on first use within a window and zero on later activity. A configured grouping field is read from payload. The count aggregation records one unit per event and applies the configured cost to that unit, regardless of payload values. Its optional payload participates in idempotency checks. Object field names must follow Convex's rules: printable ASCII, at most 1024 characters, and no leading $. Percentage and markup inputs use integer ledger units, where one displayed credit is 1000000000 units. Charges round up only to this smallest unit. Exact bigint values use decimal strings in JSON; resolved usage and debits must fit Convex's supported integer range. Repeating the same payload with its idempotency key returns the original event ID using its original definition; a conflicting request returns 409. Optional costUsdInNanos records application expense in integer nano dollars separately from customer pricing. One USD is 1000000000 units, matching the credit scale. Omit it when unknown or send zero for a known zero expense. Native callers use bigint; JSON uses integer strings. Cost participates in idempotency. Grant-based revenue is recorded in nano dollars with the debit; retrieve the original charge and margin using getEvent.
bearerAuthAuthorizationBearer <token>Environment API key or OAuth access token. OAuth requests select context with X-Orbyte-Environment or X-Orbyte-Organization when required by the operation.
X-Orbyte-Environment?stringRequired for environment-scoped OAuth operations. API keys remain bound to their own environment.
1 <= lengthapplication/json- body
identity*string1 <= length <= 128featureKey*string^[a-z][a-z0-9_-]*$1 <= length <= 128costUsdInNanos?stringActual application expense in nano dollars, where one USD is 1000000000 units. Omit when unknown; zero means a known zero expense.
^-?(0|[1-9][0-9]*)$length <= 20payload?||idempotencyKey*string1 <= length <= 128Recorded event ID, including idempotent replays
response?stringapplication/jsoncurl -X POST 'https://api.orbytelabs.com/v1/events' \ -H 'Content-Type: application/json' \ -d '{ "identity": "string", "featureKey": "string", "idempotencyKey": "string"}'"string"