Skip to main content
POST
cURL
Records one successful use of an active feature and charges its current creditCost. Send customerId, featureId, and a unique request_id for the logical action. Track checks the balance in a transaction; a successful response includes the remaining availableCredits, chargedCredits, and idempotent: false. If the network response is lost, retry the same customer, feature, and request_id. Ledger returns idempotent: true and does not charge again. Reusing the same customer and request ID for a different feature returns 409 request_id_conflict. An insufficient balance returns 409 insufficient_credits with availableCredits and creditCost. This can happen even if an earlier Check credits was allowed, because check does not reserve balance. An unknown customer or archived/unknown feature returns 404. See Credits and usage for the recommended check and track sequence.

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
customerId
string
required
Required string length: 1 - 255
featureId
string
required
Required string length: 1 - 100
request_id
string
required
Required string length: 1 - 255

Response

Usage recorded or previously recorded

allowed
boolean
required
availableCredits
integer
required
Required range: x >= 0
chargedCredits
integer
required
request_id
string
required
idempotent
boolean
required