v1
latestOpenAPI 3.1.02026-08-042453938.9 KBUsage
Record usage (async)
Record a billable usage event and return immediately without waiting for settlement.
Requires a secret key (sk_*) with at least the OPERATOR role.
The charge will be processed in the background. Subscribe to webhooks (charge.succeeded, charge.failed) to get notified of the final status.
Use this endpoint when you need fast response times and can handle eventual consistency via webhooks.
post/v1/usage/async
Request body
Example request
{
"customerId": "cus_abc123def456",
"externalCustomerId": "user_42",
"stripeCustomerId": "cus_NffrFeUfNV2Hib",
"usageType": "api_call",
"quantity": 100,
"units": "API calls",
"description": "Eligibility check for Pharmacy ABC (workflow: insurance_verify)",
"idempotencyKey": "req_20240115_abc123",
"metadata": {
"endpoint": "/v1/chat",
"model": "gpt-4"
}
}Response
Usage recorded, charge queued
Example response
{
"success": true,
"charge": {
"status": "PENDING"
},
"message": "Charge queued for processing. Subscribe to webhooks for status updates."
}