Handoff to a person API
When and to whom the assistant passes a call or chat to a person.
The same operations are in the interactive API reference, and the whole contract is in the OpenAPI document.
GET/v1/handoff/calls
Calls waiting for a person
Lists calls in progress that may need a person. By default that means calls with an attention reason (the assistant is stuck, the caller asked for a human, or the caller is upset) and calls someone has already taken over. Needs handoff:read.
Pass all=true to list every live call, which suits a wall display. The list is a live snapshot, not history: a call leaves it when it ends. Paged, newest first: limit is 1 to 100 (default 50, out of range values are clamped) and cursor is the next_cursor of the previous page. The cursor is opaque and never built by the client; a cursor this API did not return is a 400. has_more is true while another page exists. There is no total. Test keys see simulated calls only.
Scope handoff:read. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
all | query | boolean | No | `true` lists every call in progress. Default false: only calls that need a person or are already taken over. |
limit | query | integer | No | How many items to return. Default 50, at most 100. |
cursor | query | string | No | The `next_cursor` of the previous page. Opaque; never built by the client. |
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |
POST/v1/handoff/calls/{id}/takeover
Take a call over
Takes a call over from the assistant, or from the team member answering it, and returns a media room you join to speak. Needs handoff:write, and the person behind the key needs the permission to intervene in calls and to see this call; otherwise 403.
On an assistant call the assistant is paused. On a call between people, the member who was answering is taken off the call. Transcription starts so the conversation is kept. Taking over is recorded in the audit log.
Only one person can have a call at a time. If someone else has already taken it, the answer is 409; read the call again to see taken_over_by. The token is short-lived: join at once, and call this again for a fresh one if it expires. Hand the call back with release when you are done. Taking over does not itself cost anything; the call is billed as it already was. A call that has ended is 404.
Not idempotent: it changes who holds the call. Send Idempotency-Key so a retry after a lost response returns the first session instead of a 409.
Scope handoff:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |
POST/v1/handoff/calls/{id}/release
Hand a call back to the assistant
Hands a taken-over call back. On an assistant call the assistant resumes and is told a person spoke with the caller in the meantime. On a call between people it only clears who has the call. Needs handoff:write and the same permission to intervene as taking over.
Only the person who took the call may release it, with one exception: someone with organization-wide visibility can clear another person's takeover, for when they left without handing it back. If nobody you may release holds the call, the answer is 409. Recorded in the audit log. Costs nothing.
Scope handoff:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |
GET/v1/handoff/messages
Messages left for a person
Lists the messages callers left because nobody could be put through, each with the caller, a callback number, a summary and sometimes a recording length. Newest first. Needs handoff:read.
By default only messages still to be dealt with come back; all=true adds the handled ones. Paged, newest first: limit is 1 to 100 (default 50, out of range values are clamped) and cursor is the next_cursor of the previous page. The cursor is opaque and never built by the client; a cursor this API did not return is a 400. has_more is true while another page exists. There is no total. Recordings are not served here; they are shared in the console with the people a message was sent to.
Scope handoff:read. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
all | query | boolean | No | `true` includes messages already handled. Default false: only open ones. |
limit | query | integer | No | How many items to return. Default 50, at most 100. |
cursor | query | string | No | The `next_cursor` of the previous page. Opaque; never built by the client. |
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |
POST/v1/handoff/messages/{id}/claim
Claim a message
Marks a message as yours so no one else works on it. Needs handoff:write. The key acts as the person it belongs to, so claimed_by becomes that person.
If another person already claimed it, the answer is 409 and nothing changes. Claiming a message you already hold is fine. Pair it with the done operation when you have called the person back. Costs nothing.
Scope handoff:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |
POST/v1/handoff/messages/{id}/done
Mark a message handled
Marks a message as handled, so it leaves the default list. Needs handoff:write. It does not check who claimed the message: any key with the scope can finish it, including one other than the claimer. Finishing twice is harmless. Costs nothing.
Scope handoff:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |
GET/v1/handoff/rules
List handoff rules
Returns the rules that decide when the assistant puts a call through to a person, in the order they are tried. The first rule that matches wins. Needs handoff:read.
Built-in rules (built_in is set) ship with the account and can be switched off but follow fixed meanings. Paged, oldest first: limit is 1 to 100 (default 50, out of range values are clamped) and cursor is the next_cursor of the previous page. The cursor is opaque and never built by the client; a cursor this API did not return is a 400. has_more is true while another page exists. There is no total.
Scope handoff:read. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
limit | query | integer | No | How many items to return. Default 50, at most 100. |
cursor | query | string | No | The `next_cursor` of the previous page. Opaque; never built by the client. |
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |
POST/v1/handoff/rules
Create a handoff rule
Adds a rule at the end of the order. Only organization admins may change handoff settings; others get 403. Needs handoff:write.
A rule has a trigger (what the caller says or does), hours (when it applies: always, only in business hours, or only after) and a target (who to try). topic and words triggers need text. Use reorder to move it earlier; rules are tried top down.
Changes take effect for calls that start after the change; a call already in progress keeps the rules it began with. Costs nothing. Send Idempotency-Key: this is a POST that creates, and a repeat without a key creates a second identical rule. Despite creating a resource it answers 200, not 201.
Scope handoff:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | No | Makes a POST safe to repeat: the same key returns the first result for 24 hours. The same key with a different body is refused with `422 idempotency_key_reused`; while the first request still runs, `409 idempotency_in_progress`. |
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |
PUT/v1/handoff/rules/order
Reorder handoff rules
Sets the order rules are tried in. Send every rule id once, in the new order. Only organization admins may change handoff settings; others get 403. Needs handoff:write.
The same list sent twice gives the same result, so a retry is safe. Costs nothing.
Scope handoff:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |
PUT/v1/handoff/rules/{id}
Replace a handoff rule
Replaces a rule with the body given. This is a full replacement, not a patch: fields you leave out go back to their defaults, such as enabled and hours, so send the whole rule. Only organization admins may change handoff settings; others get 403. Needs handoff:write.
Use enabled: false to switch a rule off without deleting it. Idempotent. Takes effect for new calls only.
Scope handoff:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |
DELETE/v1/handoff/rules/{id}
Delete a handoff rule
Deletes a rule for good. Only organization admins may change handoff settings; others get 403. Needs handoff:write. To stop a rule from applying but keep it, replace it with enabled: false instead.
Built-in rules can be deleted too, and then they are gone for this account. A second delete is 404. Takes effect for new calls only.
Scope handoff:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string | Yes | The resource id. |
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |
GET/v1/handoff/hours
Read business hours
Returns the business hours that rules with hours: business or hours: after refer to, with their time zone and holidays. Needs handoff:read.
hours maps a day to a list of open ranges; an empty object {} means always open. The time zone is a name such as Asia/Kathmandu. Holidays are whole dates on which the office counts as closed.
Scope handoff:read. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |
PUT/v1/handoff/hours
Update business hours
Replaces the business hours. Only organization admins may change handoff settings; others get 403. Needs handoff:write.
hours must be an object keyed by day, otherwise 400, and timezone must be a known name or the request is refused. Leave timezone out to keep the current one. holidays is kept when omitted and cleared with []; it is sorted, deduplicated and cut to 400 dates. Idempotent. New calls use the change at once.
Scope handoff:write. Accepts: API key or personal access token. Open in the API reference
| Parameter | In | Type | Required | Description |
|---|---|---|---|---|
AirFone-Version | header | string | No | The API version to use, as a date. Defaults to the version the account was pinned to. |