Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Queue Resource


The Queue resource describes a call queue that contains individual calls, which are described by the queue's Member resources. Your account can have more than one call queue. Each queue can be retrieved by its sid directly using fetch. Alternately, you can read the list of Queues and filter by friendly_name or any other property you prefer.

Call queues are created when you add a call to a queue that doesn't exist and when you create one explicitly.

For information about enqueing calls, see Queueing Calls.

(warning)

Warning

Queues persist. To optimize fetch operations, inactive Queues should be deleted.


Queue Properties

queue-properties page anchor
Resource properties
date_updatedtype: string<date-time-rfc-2822>
Not PII

current_sizetype: integer

The number of calls currently in the queue.


friendly_nametype: string

A string that you assigned to describe this resource.


uritype: string

The URI of this resource, relative to https://api.twilio.com.


account_sidtype: SID<AC>

The SID of the Account(link takes you to an external page) that created this Queue resource.


average_wait_timetype: integer

The average wait time in seconds of the members in this queue. This is calculated at the time of the request.


sidtype: SID<QU>

The unique string that that we created to identify this Queue resource.


date_createdtype: string<date-time-rfc-2822>

The date and time in GMT that this resource was created specified in RFC 2822(link takes you to an external page) format.


max_sizetype: integer

The maximum number of calls that can be in the queue. The default is 1000 and the maximum is 5000.


POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Queues.json

Parameters

create-parameters page anchor
URI parameters
AccountSidtype: SID<AC>
Path ParameterNot PII

The SID of the Account(link takes you to an external page) that will create the resource.


Request body parameters
FriendlyNametype: stringRequired

A descriptive string that you created to describe this resource. It can be up to 64 characters long.


MaxSizetype: integer

The maximum number of calls allowed to be in the queue. The default is 1000. The maximum is 5000.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.queues.create({friendlyName: 'friendly_name'})
_10
.then(queue => console.log(queue.sid));

Output

_11
{
_11
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11
"average_wait_time": 0,
_11
"current_size": 0,
_11
"date_created": "Tue, 04 Aug 2015 18:39:09 +0000",
_11
"date_updated": "Tue, 04 Aug 2015 18:39:09 +0000",
_11
"friendly_name": "0.361280134646222",
_11
"max_size": 100,
_11
"sid": "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json"
_11
}


GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Queues/{Sid}.json

URI parameters
AccountSidtype: SID<AC>
Path ParameterNot PII

The SID of the Account(link takes you to an external page) that created the Queue resource to fetch.


Sidtype: SID<QU>
Path ParameterNot PII

The Twilio-provided string that uniquely identifies the Queue resource to fetch

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.fetch()
_10
.then(queue => console.log(queue.friendlyName));

Output

_11
{
_11
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11
"average_wait_time": 0,
_11
"current_size": 0,
_11
"date_created": "Tue, 04 Aug 2015 18:39:09 +0000",
_11
"date_updated": "Tue, 04 Aug 2015 18:39:09 +0000",
_11
"friendly_name": "0.361280134646222",
_11
"max_size": 100,
_11
"sid": "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json"
_11
}


Read multiple Queue resources

read-multiple-queue-resources page anchor
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Queues.json

URI parameters
AccountSidtype: SID<AC>
Path ParameterNot PII

The SID of the Account(link takes you to an external page) that created the Queue resources to read.


PageSizetype: integer
Query ParameterNot PII

How many resources to return in each list page. The default is 50, and the maximum is 1000.


Pagetype: integer
Query ParameterNot PII

The page index. This value is simply for client state.


PageTokentype: string
Query ParameterNot PII

The page token. This is provided by the API.

Read multiple Queue resources

read-multiple-queue-resources-1 page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.queues.list({limit: 20})
_10
.then(queues => queues.forEach(q => console.log(q.sid)));

Output

_26
{
_26
"end": 0,
_26
"first_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues.json?PageSize=1&Page=0",
_26
"next_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues.json?PageSize=1&Page=1",
_26
"page": 0,
_26
"page_size": 1,
_26
"previous_page_uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues.json?PageSize=1&Page=0",
_26
"queues": [
_26
{
_26
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
"average_wait_time": 0,
_26
"current_size": 0,
_26
"date_created": "Tue, 04 Aug 2015 18:39:09 +0000",
_26
"date_updated": "Tue, 04 Aug 2015 18:39:09 +0000",
_26
"friendly_name": "0.361280134646222",
_26
"max_size": 100,
_26
"sid": "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_26
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json",
_26
"subresource_uris": {
_26
"members": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Members.json"
_26
}
_26
}
_26
],
_26
"start": 0,
_26
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues.json?PageSize=1&Page=0"
_26
}


POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Queues/{Sid}.json

URI parameters
AccountSidtype: SID<AC>
Path ParameterNot PII

The SID of the Account(link takes you to an external page) that created the Queue resource to update.


Sidtype: SID<QU>
Path ParameterNot PII

The Twilio-provided string that uniquely identifies the Queue resource to update


Request body parameters
FriendlyNametype: string

A descriptive string that you created to describe this resource. It can be up to 64 characters long.


MaxSizetype: integer

The maximum number of calls allowed to be in the queue. The default is 1000. The maximum is 5000.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.update({friendlyName: 'friendly_name'})
_10
.then(queue => console.log(queue.friendlyName));

Output

_11
{
_11
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11
"average_wait_time": 0,
_11
"current_size": 0,
_11
"date_created": "Tue, 04 Aug 2015 18:39:09 +0000",
_11
"date_updated": "Tue, 04 Aug 2015 18:39:09 +0000",
_11
"friendly_name": "0.361280134646222",
_11
"max_size": 100,
_11
"sid": "QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_11
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json"
_11
}


DELETE https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Queues/{Sid}.json

URI parameters
AccountSidtype: SID<AC>
Path ParameterNot PII

The SID of the Account(link takes you to an external page) that created the Queue resource to delete.


Sidtype: SID<QU>
Path ParameterNot PII

The Twilio-provided string that uniquely identifies the Queue resource to delete

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.queues('QUXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').remove();


Rate this page: