Skip to Content
Transfers

Cancel a transfer

Permissiontransfers:cancelRetriesIdempotency-Key requiredAuthentication
POST
/transfers/{id}/cancel

Cancels a transfer that will not settle on its own.

Row-locks a non-terminal transfer and synchronously terminates an identified provider target leg before marking it failed with admin_canceled. The state change, transfer event and audit record are atomic.

When there is nothing to clean up

A requested transfer with no target yet needs no provider cleanup.

After dialing begins, a missing target identity or an unconfirmed provider outcome fails closed without changing saga state — so a cancel never leaves a live leg behind.

Optional reason text is trimmed and, when present, must be 8–500 characters.

Use Idempotency-Key for network retries and If-Match for concurrency control.

Authorization

bearerAuth
headerAuthorizationBearer <token>

Use a Voice API key or connected-app OAuth access token. Authentication.

Path Parameters

id*string
Formatuuid

Header Parameters

If-Match?string

Optional strong ETag (or *) from a prior response. A stale tag returns 412 without changing the resource.

Idempotency-Key*string

Required. Reuse the same key to retry this write safely. Retries and idempotency.

Match^[A-Za-z0-9!#$%&'*+.^_`|~-]+$
Length1 <= length <= 255

Request Body

application/json
  1. body
reason?|

Optional operator reason. Null is equivalent to omission.

Response Body

Updated terminal transfer.

application/json
  1. response

Complete customer-safe transfer state. Every nullable field is explicit. Raw provider errors and infrastructure pod identity are excluded.

id*string
Formatuuid
org_id*string
Formatuuid
session_id*string
Formatuuid
attempt*integer

One-based transfer attempt within this call, including unsuccessful attempts. Older records may reuse one.

Range1 <= value
kind*string

cold or warm for a transfer to a human by phone; agent for a same-call handoff to another Kejue Voice agent (always method handoff, recorded in its final state - bridged when the other agent took over, failed when it could not be started).

Value in"cold""warm""agent"
method*string
Value in"refer""bridge""handoff"
state*TransferState
Value in"requested""dialing""ringing""briefing""bridging""bridged""failed""recovering""resolved"
destination*string

The number or SIP URI dialled, or for an agent handoff the slug of the agent that took over.

Length1 <= length <= 2048
trunk_id*|

LiveKit/provider trunk identifier; it is not necessarily a UUID.

label*|null
announcement*|null
caller_identity*|null
caller_number*|null
consult_room*|null
target_identity*|null
sip_status_code*|null
sip_status_text*|null
failure_code*|null
failure_message*|null
failure_advice*|null
state_entered_at*string
Formatdate-time
state_deadline_at*|null
absolute_deadline_at*string
Formatdate-time
last_heartbeat_at*string
Formatdate-time
version*integer
Formatint64
Range1 <= value
created_at*string
Formatdate-time
updated_at*string
Formatdate-time
Example Request
curl -X POST 'https://api.kejue.co/v1/transfers/497f6eca-6276-4993-bfeb-53cbbbba6f08/cancel' \  -H 'Idempotency-Key: string' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "org_id": "a40f5d1f-d889-42e9-94ea-b9b33585fc6b",  "session_id": "1ffd059c-17ea-40a8-8aef-70fd0307db82",  "attempt": 1,  "kind": "cold",  "method": "refer",  "state": "requested",  "destination": "string",  "trunk_id": "string",  "label": "string",  "announcement": "string",  "caller_identity": "string",  "caller_number": "string",  "consult_room": "string",  "target_identity": "string",  "sip_status_code": 100,  "sip_status_text": "string",  "failure_code": "capability_denied",  "failure_message": "string",  "failure_advice": "string",  "state_entered_at": "2019-08-24T14:15:22Z",  "state_deadline_at": "2019-08-24T14:15:22Z",  "absolute_deadline_at": "2019-08-24T14:15:22Z",  "last_heartbeat_at": "2019-08-24T14:15:22Z",  "version": 1,  "created_at": "2019-08-24T14:15:22Z",  "updated_at": "2019-08-24T14:15:22Z"}