Follow and cancel transfers
Watch a transfer to a person or another agent as it happens, read why it failed, and cancel one that is stuck.
When an agent transfers a caller, we create a transfer record for each attempt. Use these records to show transfer progress in your own tools, to report why transfers fail, and to clear one that won't finish. Which transfers an agent can make is configured in Transfers & call actions.
There is no endpoint to start a transfer: transfers only start from a live call, when the agent decides to make one.
What your trunk supports
GET /v1/calls/transfer-capabilities returns which kind and method
pairs work on sip and twilio_automated trunks. Check it instead of
assuming. The answer changes rarely, so you can cache it privately for 24
hours.
| Method | What happens |
|---|---|
refer | We ask your carrier to move the call (SIP REFER). Cold transfers only. |
bridge | We dial the target and join the two legs ourselves. Required for warm transfers. |
Following a transfer
GET /v1/calls/{id}/transfers returns every transfer attempt on a call,
with a timeline of events. GET /v1/transfers/{id} returns one transfer's
latest state with an ETag. While the transfer is active, the response
includes Retry-After: wait that long before polling again. Calls in other
workspaces and eval calls return the same not-found response as a missing
call.
States progress through:
requested, dialing, ringing, briefing, bridging, bridged,
failed, recovering, resolvedThe record includes kind/method, destination, attempt number, nullable
target/caller/consult/SIP details, deadlines, and timestamps; trunk_id here
is a provider identifier, not necessarily a UUID.
A handoff to another agent is listed too, as kind: agent with method: handoff. Its destination is the slug of the agent that took over, and it is
recorded in its final state — bridged, or failed when the other agent could
not be started — with an agent_handoff timeline event.
Timeline events carry event_type, from_state, to_state, source, and a
timestamp — order by those. Payloads pass a fail-closed allowlist of scalar
operational fields; anything nested, unknown, or overlong is removed and
payload_redacted: true is set. Tolerate absent fields; payload_redacted: false is not clearance for public display.
When a transfer fails
Branch on failure_code — stable, sanitized codes for caller-meaningful
outcomes (target_busy, target_no_answer, target_voicemail,
toll_fraud_blocked; full list in the API reference).
failure_message and failure_advice are safe human-readable context. Raw
provider and network error text can contain secrets, phone numbers, and
network detail — it never appears in the public record and no API-key scope
enables it. Correlate support escalations with the safe transfer, call, and
request IDs.
Stuck transfers clean themselves up. We never mark a transfer failed until
the transfer leg is confirmed gone, so cleanup can't cut off a connected call.
While cleanup is pending, GET /v1/transfers/{id} keeps returning 200 with
Retry-After: 2; keep polling until it settles.
Cancelling a stuck transfer
POST /v1/transfers/{id}/cancel is administrative recovery for a
non-terminal transfer that won't settle on its own. It is conditional: send
the ETag in If-Match and an
Idempotency-Key.
curl -X POST https://api.kejue.co/v1/transfers/TRANSFER_ID/cancel \
-H "Authorization: Bearer kejue_<prefix>_<secret>" \
-H "Content-Type: application/json" \
-H 'If-Match: "TRANSFER_ETAG"' \
-H "Idempotency-Key: incident-294-transfer-cancel" \
--data '{"reason": "Provider leg remained ringing after caller recovery"}'reason is optional (8–500 characters). We remove the target leg — or
confirm it is already gone — before marking the transfer failed with
failure_code: admin_canceled, writing the admin and audit events
together.
| Response | Meaning |
|---|---|
412 | Stale ETag — re-read and retry |
409 | Transfer already terminal |
503 transfer_cancel_unavailable | No provider control or no durably captured target identity |
502 transfer_cancel_provider_failed | Provider explicitly rejected the removal |
504 transfer_cancel_outcome_unknown | Ambiguous provider result; details.retryable: true — retry with the same Idempotency-Key |
The 5xx outcomes leave the transfer non-terminal and write no
admin_canceled event, so retrying is always safe.
Permissions
| Permission | Grants |
|---|---|
agents:read | GET /v1/calls/transfer-capabilities |
transfers:read | Transfer timelines and point reads |
transfers:cancel | Cancelling a stuck transfer |