• Precios
  • Blog
Iniciar sesiónAgendá una demo
Check usage availability POSTSet current usage PUTTrack usage event POST
DocumentaciónRecursosConstruir con AIAPI ReferenceWebhooks

Check usage availability

Check if a customer can consume a feature before actual consumption. Returns availability and cost estimates based on the plan's consumption model.

POST
/usage/check

Check if a customer can consume a feature before actual consumption. Returns availability and cost estimates based on the plan's consumption model.

Authorization

ApiKeyAuth
x-api-key<token>

In: header

Header Parameters

Idempotency-Key?string

Unique key used to safely retry this write for 24 hours without applying it twice.

Length1 <= length <= 200

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/usage/check" \  -H "Content-Type: application/json" \  -d '{    "customerId": "string",    "featureCode": "string"  }'
{  "allowed": true,  "subscriptionStatus": "string",  "featureCode": "string",  "quantity": -9007199254740991,  "reason": "string",  "message": "string",  "consumptionModel": "metered",  "current": 0,  "remaining": 0,  "unlimited": true,  "included": 0,  "overageEnabled": true,  "overageUnitPrice": 0,  "object": "usage_check",  "livemode": true}
{  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}
{  "error": {    "type": "string",    "code": "string",    "message": "string",    "param": "string",    "details": null,    "doc_url": "string"  }}

Retry transaction POST

Retry a failed subscription renewal and return an honest retry result. The original failed transaction remains immutable.

Set current usage PUT

Set a metered feature's usage to an exact value for the current period. Use the Idempotency-Key header to make retries safe.

customerId*string
Length1 <= length <= 200
featureCode*string
Match^[a-z0-9_]+$
Length1 <= length <= 50
quantity?integer
Range0 < value <= 9007199254740991
Default1