The debit API
how usage-based billing would call it — documentation, not a control
← Back to the wallet
How whatever in Corto starts metering real usage would call this — not built yet, and nothing on this page can call it either. Worked against this wallet's current multiplier (1×), read live, not hardcoded.
Endpoint
POST /api/wallet/debitRequest body
| Field | Type | What it means | |
|---|---|---|---|
| amount | number | required | The BASE amount, before the wallet's multiplier — what actually gets deducted can be more. |
| remarks | string | optional | Free text. Defaults to "Organization wallet debit". |
| resource_type | string | optional | What in Corto caused it — e.g. "ai", "mcp", "connector". |
| resource_id | string | optional | Which one, e.g. "claude-assistant". Carried onto the ledger row. |
Example request — Claude — assistant conversations
{
"amount": 4320,
"remarks": "Claude — assistant conversations — 96 per 1,000 tokens",
"resource_type": "ai",
"resource_id": "claude-assistant"
}Response — 200
{
"via": "simulated",
"ok": true,
"balance": {
"available_amount": "…",
"multiplier": 1
},
"finalAmount": 4320
}finalAmount is amount × this wallet's multiplier (1×): ₹4,320 asked for, ₹4,320 actually deducted. Never assume they're the same number.
Response — 422
{
"via": "simulated",
"ok": false,
"error": "Insufficient wallet balance"
}Same shape for an unconnected tenant — the reason changes, nothing else.
Try it
curl -X POST http://localhost:3999/api/wallet/debit \
-H "content-type: application/json" \
--data-raw '{"amount":4320,"remarks":"Claude — assistant conversations","resource_type":"ai","resource_id":"claude-assistant"}'