Queue Commands API

Queue commands operations API

Retrieve a call queue

Retrieve an existing call queue

SecuritybearerAuth
Request
path Parameters
queue_name
required
string

Uniquely identifies the queue by name

Responses
200

Successful response with details about a queue.

Response Schema: application/json
object (Queue)
average_wait_time_secs
required
integer

The average time that the calls currently in the queue have spent waiting, given in seconds.

created_at
required
string

ISO 8601 formatted date of when the queue was created

current_size
required
integer

The number of calls currently in the queue

id
required
string

Uniquely identifies the queue

max_size
required
integer

The maximum number of calls allowed in the queue

name
required
string

Name of the queue

record_type
required
string
Value: "queue"
updated_at
required
string

ISO 8601 formatted date of when the queue was last updated

404

Fax does not exist

get/queues/{queue_name}
Request samples
import telnyx
telnyx.api_key = "YOUR_API_KEY"

telnyx.Queue.retrieve("queue_name")import telnyx
telnyx.api_key = "YOUR_API_KEY"

telnyx.Queue.retrieve("queue_name")
Response samples
application/json
{
  • "data": {
    • "average_wait_time_secs": 175,
    • "created_at": "2019-01-23T18:10:02.574Z",
    • "current_size": 20,
    • "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    • "max_size": 50,
    • "name": "support",
    • "record_type": "queue",
    • "updated_at": "2019-01-23T18:10:02.574Z"
    }
}

Retrieve calls from a queue

Retrieve the list of calls in an existing queue

SecuritybearerAuth
Request
path Parameters
queue_name
required
string

Uniquely identifies the queue by name

query Parameters
page[number]
integer >= 1
Default: 1

The page number to load

page[size]
integer [ 1 .. 250 ]
Default: 20

The size of the page

Responses
200

Successful response with a list of calls in a queue.

Response Schema: application/json
Array of objects (QueueCall)
object (PaginationMeta)
404

Fax does not exist

get/queues/{queue_name}/calls
Request samples
import telnyx
telnyx.api_key = "YOUR_API_KEY"

queue = telnyx.Queue.retrieve("tier_1_support_queue")
queue_calls = queue.list_calls()
Response samples
application/json
{
  • "data": [
    • {
      • "call_control_id": "v2:T02llQxIyaRkhfRKxgAP8nY511EhFLizdvdUKJiSw8d6A9BborherQ",
      • "call_leg_id": "2dc6fc34-f9e0-11ea-b68e-02420a0f7768",
      • "call_session_id": "2dc1b3c8-f9e0-11ea-bc5a-02420a0f7768",
      • "connection_id": "7267xxxxxxxxxxxxxx",
      • "enqueued_at": "2019-01-23T18:10:02.574Z",
      • "from": "+18005550101",
      • "queue_id": "ae1626cc-6f42-11ea-becd-02420a0f8b69",
      • "queue_position": 3,
      • "record_type": "queue_call",
      • "to": "+18005550102",
      • "wait_time_secs": 145
      }
    ],
  • "meta": {
    • "page_number": 2,
    • "page_size": 25,
    • "total_pages": 3,
    • "total_results": 55
    }
}

Retrieve a call from a queue

Retrieve an existing call from an existing queue

SecuritybearerAuth
Request
path Parameters
queue_name
required
string

Uniquely identifies the queue by name

call_control_id
required
string

Unique identifier and token for controlling the call

Responses
200

Successful response with details about a call in a queue.

Response Schema: application/json
object (QueueCall)
call_control_id
required
string

Unique identifier and token for controlling the call.

call_leg_id
required
string

ID that is unique to the call and can be used to correlate webhook events

call_session_id
required
string

ID that is unique to the call session and can be used to correlate webhook events. Call session is a group of related call legs that logically belong to the same phone call, e.g. an inbound and outbound leg of a transferred call

connection_id
required
string

Telnyx connection ID used in the call.

enqueued_at
required
string

ISO 8601 formatted date of when the call was put in the queue

from
required
string

Number or SIP URI placing the call.

queue_id
required
string

Unique identifier of the queue the call is in.

queue_position
required
integer

Current position of the call in the queue

record_type
required
string
Value: "queue_call"
to
required
string

Destination number or SIP URI of the call.

wait_time_secs
required
integer

The time the call has been waiting in the queue, given in seconds

404

Fax does not exist

get/queues/{queue_name}/calls/{call_control_id}
Request samples
import telnyx
telnyx.api_key = "YOUR_API_KEY"

queue = telnyx.Queue.retrieve("tier_1_support_queue")
queue_call = queue.retrieve_call(call_control_id)
Response samples
application/json
{
  • "data": {
    • "call_control_id": "v2:T02llQxIyaRkhfRKxgAP8nY511EhFLizdvdUKJiSw8d6A9BborherQ",
    • "call_leg_id": "2dc6fc34-f9e0-11ea-b68e-02420a0f7768",
    • "call_session_id": "2dc1b3c8-f9e0-11ea-bc5a-02420a0f7768",
    • "connection_id": "7267xxxxxxxxxxxxxx",
    • "enqueued_at": "2019-01-23T18:10:02.574Z",
    • "from": "+18005550101",
    • "queue_id": "ae1626cc-6f42-11ea-becd-02420a0f8b69",
    • "queue_position": 3,
    • "record_type": "queue_call",
    • "to": "+18005550102",
    • "wait_time_secs": 145
    }
}