CXB API is the control plane of CX Bridge. It owns durable business state, exposes the admin/CRM APIs, builds runtime bot config for CXB Core, receives post-call results, and coordinates outbound call routing. The simplest boundary is:
SystemResponsibility
CXB APIAuth, bots, campaigns, calls, CRM integrations, settings, recordings, API keys, fleet routing
CXB CoreLive media execution: STT, LLM, TTS, tools, transfer, recordings, post-call packaging
CXB ConsoleAdmin and operator interface on top of CXB API
CXB DiallerCampaign pacing, SIP dial attempts, AMD screening, and attach orchestration

Runtime Role

CXB API does not run the live audio pipeline. It prepares the information needed for the call and stores the result after CXB Core finishes.

What It Owns

AreaWhat CXB API owns
Auth and usersJWT login, roles, admin users, agent/supervisor access boundaries
Bot configBot CRUD, prompts, policy config, provider config, tools, transfer settings, RAG attachment
Runtime config/api/v1/config/{bot_id} response consumed by CXB Core at call start
CallsCall records, transcripts, events, analysis, QC, stable recording access URLs
CampaignsCampaign CRUD, CSV ingestion, number pools, retry settings, attempt reports
Fleet routingHealth-checks CXB Core fleet servers and picks available capacity for direct dialout
Carriers and SIPLiveKit trunk mapping, DID lookup, outbound trunk selection
CRM integrationsAPI-key dialout, CRM pre-fetch, post-call push, variable mapping
Knowledge baseDocument upload, chunking, embeddings, vector-database search, bot attachment
Agent DeskQueue state, timeout policy, handoff records, agent/supervisor APIs

Important Modules

ModuleWhy it matters
App entrypointFastAPI app, startup checks, Mongo/Redis startup, route registration, trunk health loop
SettingsEnvironment settings for MongoDB, Redis, JWT, CXB Core, LiveKit, storage, Agent Desk
Config routeRuntime config endpoint called by CXB Core
Config serviceBuilds the call-time config contract from stored bot/settings data
Results routeReceives final call results from CXB Core
Call serviceStores call results and sends CRM post-call payloads
SIP routeCRM/admin dialout endpoint and SIP lookup helpers
Fleet serviceFleet health checks and best-server selection
Campaigns routeCampaign creation, lifecycle actions, upload, reporting
Knowledge servicesKnowledge-base ingestion, embedding, vector-database search
API keys routeCRM API key management
Agent Desk routeAgent Desk queue and handoff APIs

API Boundaries

CXB API exposes three broad kinds of API:
API typeUsed byPurpose
Admin APIsCXB ConsoleBots, calls, campaigns, settings, users, carriers, knowledge bases
Internal APIsCXB Core / CXB DiallerRuntime config, SIP lookup, call result delivery, fleet checks
External APIsCRMsAPI-key dialout and post-call webhooks
The internal CXB Core boundary is protected by X-CXBCore-Secret. CRM-triggered dialout uses X-API-Key so external systems do not need admin JWTs.

Data Stores

StoreUse
MongoDBDurable source of truth for users, bots, calls, campaigns, settings, API keys, KB metadata
RedisRuntime cache and Agent Desk state/listener support
Vector databaseKnowledge-base vector search
S3 / MinIO / SpacesCall recordings and uploaded assets, depending on deployment

Operational Checks

When debugging CXB API, start with the surface that owns the failing state:
SymptomFirst place to check
CXB Core cannot fetch configBot status, active hours, the config route, the config service
Direct dialout picks the wrong workercxbcore_fleet settings and the fleet service
Campaign rows do not progressCampaign status, dialler health, campaign_calls indexes, CXB Dialler logs
Call result missingCXB Core result outbox, the results route, call storage logs
CRM did not receive resultIntegration config, the call service, post-call push logs
Recording does not playrecording_key, recording access token, storage settings, fleet recording backend
RAG answer is wrongKB attachment, document status, vector-database collection, trigger instructions

Engineering Rules

  • Keep live media logic out of CXB API. That belongs in CXB Core.
  • Keep durable business state out of CXB Core. That belongs in CXB API and MongoDB.
  • Do not expose raw recording URLs to CRMs when stable CXB API recording links are available.
  • Do not hard-code client-specific behavior in shared API code; use bot config, system settings, brand config, or integration config.
  • Protect production startup with real JWT_SECRET and CXBCORE_SECRET values.

Architecture

How the four services fit together.

Call lifecycle

How a call moves through CXB Core and CXB API.

Services and boundaries

Ownership rules and key modules for each service.

CRM dialout API

How external systems trigger calls through CXB API.