Herald
OpenapiExt

Consume points from user account

Consumes points from a user's account for paid operations. Returns transaction details including the new balance. # Authentication Requires valid API Key via X-API-Key header # Realm Isolation The API key must belong to the same realm as the requested realm. Cross-realm requests will return 403 Forbidden. # Example ```bash curl -X POST \ https://api.example.com/api/ext/points/realm123/consume \ -H "X-API-Key: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "userId": "user-123", "clientAppId": "app-abc", "amount": 100, "description": "AI API call" }' ```

POST
/api/ext/points/{realmId}/consume

Consumes points from a user's account for paid operations. Returns transaction details including the new balance.

Authentication

Requires valid API Key via X-API-Key header

Realm Isolation

The API key must belong to the same realm as the requested realm. Cross-realm requests will return 403 Forbidden.

Example

curl -X POST \  https://api.example.com/api/ext/points/realm123/consume \  -H "X-API-Key: your-api-key" \  -H "Content-Type: application/json" \  -d '{    "userId": "user-123",    "clientAppId": "app-abc",    "amount": 100,    "description": "AI API call"  }'
X-API-Key<token>

Client-app API key (third-party external API).

In: header

Path Parameters

realmId*string

Realm ID

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

amount*integer
Formatint64
clientAppId*string
description?string|null
idempotencyKey?string|null
userId*string

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/api/ext/points/string/consume" \  -H "Content-Type: application/json" \  -d '{    "amount": 0,    "clientAppId": "string",    "userId": "string"  }'
{  "allocations": [    {      "allocatedAmount": 0,      "bucketId": "string",      "creditType": "string",      "ledgerId": "string",      "walletId": "string"    }  ],  "amount": 0,  "correlationId": "string",  "transactions": [    {      "amount": 0,      "balanceAfter": 0,      "bucketId": "string",      "transactionId": "string",      "userId": "string",      "walletId": "string"    }  ],  "userId": "string"}
{  "code": "string",  "details": null,  "message": "string",  "requestId": "string",  "status": 0}
{  "code": "string",  "details": null,  "message": "string",  "requestId": "string",  "status": 0}
{  "code": "string",  "details": null,  "message": "string",  "requestId": "string",  "status": 0}
{  "code": "string",  "details": null,  "message": "string",  "requestId": "string",  "status": 0}
{  "code": "string",  "details": null,  "message": "string",  "requestId": "string",  "status": 0}
{  "code": "string",  "details": null,  "message": "string",  "requestId": "string",  "status": 0}