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" }' ```
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"
}'api_keyX-API-Key<token>Client-app API key (third-party external API).
realmId*stringRealm ID
application/json- body
Consume points request (SDK-compatible)
amount*integerint64clientAppId*stringdescription?string|nullidempotencyKey?string|nulluserId*stringPoints consumed successfully
application/json- response
Consume points response (SDK-compatible).
Breaking change: the previous single-transaction shape is replaced by a
per-bucket multi-transaction shape. correlation_id groups the N
transactions of one consume (DB points_transactions.correlation_id);
single-pool hits still produce exactly one transaction.
allocations*array<>Ledger-level allocations. See [AllocationDetail].
amount*integerTotal points consumed in this request (sum across all affected buckets).
int64correlationId*stringGrouping key shared by the N transactions of this consume. Falls back to the primary transaction id when the underlying row has no correlation_id (legacy single-pool replay).
transactions*array<>One entry per affected bucket, sorted by bucket_id ASC. Length 1 for a
single-pool hit.
userId*stringcurl -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"
}