The debit API

demowho and where

Not a feature. Sign-in decides both of these; until then, this does.

Demo map

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/debit

Request body

FieldTypeWhat it means
amountnumberrequiredThe BASE amount, before the wallet's multiplier — what actually gets deducted can be more.
remarksstringoptionalFree text. Defaults to "Organization wallet debit".
resource_typestringoptionalWhat in Corto caused it — e.g. "ai", "mcp", "connector".
resource_idstringoptionalWhich 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"}'