/api/v1/inbox and /api/v1/voice
Authentication: Clerk session (Authorization: Bearer <token>) or API key (X-API-Key).
Scope: write operations require an owner or admin role (voice:write scope on the API-key route, plus the inbox surface for digital queues); reads require a signed-in session or API key. Supervisors reach the queue-monitoring surfaces.
1. Concepts — digital queues vs voice queues
A voice queue (/api/v1/voice/queues) is an ACD target for PSTN and in-app voice: callers wait in FIFO, the platform dispatches to an eligible available agent, and overflow plays out as voicemail / forward / disconnect. A digital queue (/api/v1/inbox/digital-queues) routes inbox conversations through the same skill-match / SLA / overflow machinery but the work item is a conversation thread on a digital channel, not a call leg.
The two models differ in the places a CCaaS operator cares about:
Voice and digital queues converge at the monitoring surface: the omnichannel queue view (
GET /api/v1/voice/supervisor/omnichannel-queue) blends both backlogs into ONE position-numbered, wait/SLA/priority-ordered list — the same ordering the routing engine assigns by — so a supervisor sees the shared queue, not two silos.
2. Attribute routing and affinity rules
Before a work item ever enters a queue, two optional server-side policies can reshape it. Both are opt-in (each disabled by default) and both operate on the inbound conversation’s contact attributes and the agent roster — never on outbound signalling.Attribute routing
GET / PUT /api/v1/voice/attribute-routing reads and replaces your attribute-routing policy: an ordered list of rules that append extra requiredSkills and an optional priorityBoost to a queue entry based on the contact’s tags and CDP attributes. Storage is a single JSONB key (organizations.settings.acd_attribute_routing), so a change takes effect on the next enqueue with no migration.
A rule has the shape:
extraSkills entries are validated against your tenant’s active skill catalog — an unknown skill slug returns 422 UNKNOWN_SKILL instead of being persisted. priorityBoost is an integer from 0 to 99 (rejected out of range), and label is a free-text operator name shown in the settings panel.
Replace the policy from the dashboard at Settings → Voice → Attribute routing (no JSON editing), or over the API with a full-document PUT:
cURL
Affinity routing
GET / PUT /api/v1/voice/affinity-routing reads and replaces your behavioral affinity config: the pairing objective that routes an inbound contact to the agent best-matched to them (customer-segment ↔ agent-affinity fit) rather than the globally best-scoring agent. Storage is organizations.settings.acd_affinity_routing; both writes are audited.
enabled— opt-in; defaults to false. A malformed or disabled config resolves to the safe disabled default in the router.treatment_percent— share of eligible queue items (0–100) routed on the affinity arm. Ramp the rollout instead of flipping globally.affinity_weight/headroom_weight— server-clamped to 0–1; the pair balances contact↔agent fit against agent headroom.agent_profiles— map of Clerk user id to affinity tags the agent pairs well with, e.g.segment:enterprise,style:analytical.
3. Routing-rules evaluator
Once a conversation arrives in the inbox, the routing-rules engine (/api/v1/inbox/routing-rules) assigns it. Rules are evaluated in priority order (lower priority first, firewall-style first-match-wins) and AND-combine their conditions.
Conditions
Actions
Create a rule dynamically over the API:
cURL
overflow_action: "routing_rules" falls back to this same engine — so a queue that cannot place an item never silently hijacks the conversation; it defers to the universal escape hatch.
4. On-queue SLA forecast preview
After an item joins a queue (digital or voice), the SLA forecast estimates breach-before-answer and suggests the callback/overflow capacity that absorbs the backlog before the SLA lands. This is advisory — no dispatch fires from the preview.POST /api/v1/voice/queues/:id/sla-forecast takes a live queue snapshot and returns the forecast. The response tells you the expected head-of-line wait, the projected breach over the queue’s SLA threshold, and how much callback capacity would absorb the backlog pre-breach — so a supervisor sees “offer 3 callback slots” before the wallboard turns red, not after.
cURL
5. Verification — queue analytics stream
Every routing decision lands in observable queues. Three read-only surfaces let you verify end to end:GET /api/v1/voice/queues/:id/analytics— aggregated per-queue metrics (offered/answered, service-level rate, ASA, AHT, abandon rate) against your SLA target. Use this to confirm a rule change actually shifted the numbers you intended.GET /api/v1/voice/supervisor/omnichannel-queue— the blended voice + digital backlog as one position-numbered, wait/SLA/priority-ordered list. Confirm the item that should sit at position N actually does, and that apriorityBoostrule bumps a VIP chat above older normal-priority items.- Queue live SSE stream (
GET /api/v1/voice/queues/:id/live) — Server-Sent Events pushing real-time queue state every 5 s (keepalive every 15 s, sessions capped at 30 min, hard-capped to 100 concurrent connections per tenant). Subscribe while you toggle a rule and watch the queue respond — the stream is tenant-scoped and CORS-locked to trusted origins.
cURL
GET /api/v1/inbox/digital-queues/:id) — one queue’s waiting / assigned / sla_breached counters, mirroring the voice surface.
Next steps: Set up and run voice queues for the voice-side counterpart, Inbox setup to wire the inbox’s digital channels, Queue SLA escalation policies, and Supervisor live monitoring — digital for the blended supervisor surface.