MCPBundler Docs
MCPBundler Docs
Volver al marketplacePrimeros PasosAutenticacionTutorial - De un Bundle a un Agente Conectado
API Reference
Agent A2A Tools
Agent Channels
Agent Configuration (Staging)
Agent Configuration (Versions)
Agent Tools
Agents
Auth
Billing
Bundler
Append Conversation Messages (M2M)Append Workflow Run Trace Step (M2M, fail-open)Create Conversation (M2M)Create Workflow Run (M2M)Dispatch a Matched Tool-Call Webhook (M2M)Finalize Workflow Run Outputs (M2M, fail-closed on the caller's side)Ingest Request TelemetryResolve An SMS Conversation Thread (M2M)Mint Widget Session Token (M2M)Reconcile Token LedgerReport An Outbound Call Outcome (M2M)Resolve Agent (M2M)Resolve Agent Config Snapshot (M2M)Resolve Agent for Inbound A2A (M2M, conditionally authenticated)Resolve BundleResolve Inbound Channel (M2M)Resolve LLM Credential (M2M)Resolve Telephony Credential For Outbound Origination (M2M)Resolve Tool-Call Override Bindings (M2M)Resolve Tool-Call Webhook Bindings (M2M)Resolve Public Widget Embed Key (M2M)Resolve Agent Workflow (M2M)Search Agent Knowledge Bases (M2M)Store Workflow Node Samples (M2M, fail-open)Submit Conversation Extraction (M2M)Update Conversation Status (M2M)Record Channel Status (M2M)
Bundler Tool
Bundles
Call Campaigns
Catalog
Conversations
Credentials
Deployments
Discover
Embedding
Fleet
Knowledge Bases
LLM
MCP Listings
Media
OAuth Clients
OAuth2
Observability
Organisations
Realtime
Reviews
Roadmap
SCIM
STT
Suppression
Triggers
TTS
Users
Utils
Voices
Webhooks
Workflows
API ReferenceBundler

Reconcile Token Ledger

POST
/v1/bundler/ledger/reconcile

Record locally-consumed tokens as a usage_debit entry and return the caller's current token balance. Consumed by the mcpbundler daemon's spend-check middleware to refill its per-session token-bucket cache; called with consumed=0 for a pure balance read. Returns 200 for both a successful debit and a rejected one, reported as rejected=true with the unchanged balance, not recorded, and not surfaced as an HTTP error status. A debit is rejected either because it would take the balance negative, or because the deployment this token belongs to has billing paused (its owner's membership in the organisation it bills has ended), in which case no debit is attempted at all. See responses below for the two outcomes that are HTTP errors.

Authorization

BundleAccessToken
AuthorizationBearer <token>

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Tokens spent since the caller's last reconcile, and what kind of activity produced them.

consumed=0 is the expected shape for a pure balance read (used once per session/run, at cold start, before any billable activity has happened yet). consumption_type is required so this M2M endpoint can never be used to write a source other than the four debit categories it is meant for - grants, topups, and refunds each have their own dedicated, separately authorized call sites and must never be reachable here.

provider_id names the Provider whose credits_per_unit rate this debit should convert consumed through - required for tts_character_debit/stt_second_debit (see reconcile_ledger's own 422 validation, raises if that provider has no rate configured); optional for llm_completion_debit, which converts through the named provider's rate when it resolves to an LLM-kind provider with a configured rate, and otherwise defaults to 1 raw unit = 1 credit; ignored entirely for mcp_tool_debit, which always stays 1 raw unit = 1 credit.

Response Body

application/json

application/json

curl -X POST "https://example.com/v1/bundler/ledger/reconcile" \  -H "Content-Type: application/json" \  -d '{    "consumption_type": "llm_completion_debit"  }'
{  "balance": 0,  "rejected": false}
Empty
{  "detail": [    {      "loc": [        "string"      ],      "msg": "string",      "type": "string"    }  ]}
Empty
Empty

Mint Widget Session Token (M2M)

Previous Page

Report An Outbound Call Outcome (M2M)

Next Page

consumed?Consumed
Range0 <= value
Default0
consumption_type*Consumption Type

Value in

  • "llm_completion_debit"
  • "mcp_tool_debit"
  • "tts_character_debit"
  • "stt_second_debit"
provider_id?|null