MCPBundler Docs
MCPBundler Docs
Back to marketplaceGetting StartedAuthenticationTutorial - Bundle to Connected Agent
API Reference
Agent A2A Tools
Agent Channels
Agent Configuration (Staging)
Agent Configuration (Versions)
Agent Tools
agents
Agents
Attachments
Auth
Billing
bundler
Bundler
Append Conversation Messages (M2M)Append Workflow Run Trace Step (M2M, fail-open)Close Conversation (M2M)Commit Pending Page Action (M2M)Commit Workflow Run Turn (M2M)Create Conversation (M2M)Create Workflow Run (M2M)Dispatch a Matched Tool-Call Webhook (M2M)Exchange A Run Token For A Hand-off Target's Token (M2M)Exchange A Widget Session For A Run Token (M2M)Finalize Call Recording (M2M)Finalize Workflow Run Outputs (M2M, fail-closed on the caller's side)Forget Web Visitor (M2M)Ingest Remote Attachment (M2M)Ingest Request TelemetryLoad Workflow Run State (M2M)Mint Widget Session Token (M2M)Read Own Attachment (M2M)Read Held Original (M2M)Read Web Visitor Thread (M2M)Reconcile Token LedgerRelease Attachments (M2M)Report An Outbound Call Outcome (M2M)Report Per-Leg Latency Samples (M2M)Report Observed Widget Host (M2M)Request Recording Chunk Upload URL (M2M)Resolve Agent (M2M)Resolve Agent Config Snapshot (M2M)Resolve Agent for Inbound A2A (M2M, conditionally authenticated)Resolve Attachments (M2M)Resolve BundleResolve Inbound Channel Credentials (M2M)Resolve Inbound Channel (M2M)Resolve Page Action (M2M)Resolve An Agent's S2S Decision Model (M2M)Resolve Genesys Probe Credentials (M2M)Resolve An Agent's LLM Config (M2M)Resolve The Run's Own Agent (M2M)Resolve Telephony Credential For Outbound Origination (M2M)Resolve Tool-Call Override Bindings (M2M)Resolve Tool-Call Webhook Bindings (M2M)Resolve Visitor Context (M2M)Resolve Public Widget Embed Key (M2M)Resolve Agent Workflow (M2M)Search Agent Knowledge Bases (M2M)Start Call Recording (M2M)Store Conversation Output Variables (M2M)Store Reply Timings (M2M)Store Workflow Node Samples (M2M, fail-open)Submit Conversation Extraction (M2M)Supersede Pending Page Action (M2M)Update Conversation Status (M2M)Upload Attachment (M2M)Search the Web for an Agent (M2M)Record Channel Status (M2M)
Bundler Tool
Bundles
Call Campaigns
Catalog
Conversations
Credentials
Deployments
Discover
Fleet
Genesys
Insights
internal
Knowledge Base Website Sources
Knowledge Bases
MCP Listings
Media
OAuth Clients
OAuth2
Observability
Organisation roles
Organisations
Providers
Reviews
Roadmap
SCIM
Simulation Tests
Suppression
Triggers
TTS
Users
Utils
Visitors
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 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. model names the specific vendor model this usage ran on; input_tokens/output_tokens, when both given for an llm_completion_debit, must sum to consumed and price the two directions separately through that model's own input/output rates. cache_read_tokens/cache_write_tokens, which require that split, price prompt-cache reads and writes through the same model (see model_pricing.llm_debit_amount).

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

Read Web Visitor Thread (M2M)

Previous Page

Release Attachments (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
model?|null
input_tokens?|null
output_tokens?|null
cache_read_tokens?Cache Read Tokens
Range0 <= value
Default0
cache_write_tokens?Cache Write Tokens
Range0 <= value
Default0