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

Property nameTypePIIDescription
date_updatedstring<date-time-rfc-2822>
Not PII

current_sizeinteger

The number of calls currently in the queue.


friendly_namestring

A string that you assigned to describe this resource.


uristring

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


account_sidSID<AC>

The SID of the Account that created this Queue resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

average_wait_timeinteger

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


sidSID<QU>

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

Pattern: ^QU[0-9a-fA-F]{32}$Min length: 34Max length: 34

date_createdstring<date-time-rfc-2822>

The date and time in GMT that this resource was created specified in RFC 2822 format.


max_sizeinteger

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


Create a Queue resource

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

Path parameters

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that will create the resource.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

Request body parameters

Property nameTypeRequiredPIIDescription
FriendlyNamestringrequired

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


MaxSizeintegerOptional

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

Create a Queue resource

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

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function createQueue() {
_16
const queue = await client.queues.create({ friendlyName: "FriendlyName" });
_16
_16
console.log(queue.dateUpdated);
_16
}
_16
_16
createQueue();

Output

_14
{
_14
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"average_wait_time": 0,
_14
"current_size": 0,
_14
"date_created": "Tue, 04 Aug 2015 18:39:09 +0000",
_14
"date_updated": "Tue, 04 Aug 2015 18:39:09 +0000",
_14
"friendly_name": "FriendlyName",
_14
"max_size": 100,
_14
"sid": "QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues/QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
_14
"subresource_uris": {
_14
"members": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues/QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members.json"
_14
}
_14
}


Fetch a Queue resource

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

Path parameters

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the Queue resource to fetch.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<QU>required

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

Pattern: ^QU[0-9a-fA-F]{32}$Min length: 34Max length: 34

Fetch a Queue resource

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

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function fetchQueue() {
_18
const queue = await client
_18
.queues("QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.fetch();
_18
_18
console.log(queue.dateUpdated);
_18
}
_18
_18
fetchQueue();

Output

_14
{
_14
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"average_wait_time": 0,
_14
"current_size": 0,
_14
"date_created": "Tue, 04 Aug 2015 18:39:09 +0000",
_14
"date_updated": "Tue, 04 Aug 2015 18:39:09 +0000",
_14
"friendly_name": "0.361280134646222",
_14
"max_size": 100,
_14
"sid": "QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues/QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
_14
"subresource_uris": {
_14
"members": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues/QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members.json"
_14
}
_14
}


Read multiple Queue resources

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

Path parameters

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the Queue resources to read.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

Query parameters

Property nameTypeRequiredPIIDescription
PageSizeintegerOptional

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

Minimum: 1Maximum: 1000

PageintegerOptional

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

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

Read multiple Queue resources

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

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function listQueue() {
_16
const queues = await client.queues.list({ limit: 20 });
_16
_16
queues.forEach((q) => console.log(q.dateUpdated));
_16
}
_16
_16
listQueue();

Output

_26
{
_26
"end": 0,
_26
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues.json?PageSize=1&Page=0",
_26
"next_page_uri": null,
_26
"page": 0,
_26
"page_size": 1,
_26
"previous_page_uri": null,
_26
"queues": [
_26
{
_26
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_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": "QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_26
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues/QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
_26
"subresource_uris": {
_26
"members": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues/QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members.json"
_26
}
_26
}
_26
],
_26
"start": 0,
_26
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues.json?PageSize=1&Page=0"
_26
}


Update a Queue resource

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

Path parameters

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the Queue resource to update.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<QU>required

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

Pattern: ^QU[0-9a-fA-F]{32}$Min length: 34Max length: 34

Request body parameters

Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

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


MaxSizeintegerOptional

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

Update a Queue resource

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

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function updateQueue() {
_18
const queue = await client
_18
.queues("QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")
_18
.update({ friendlyName: "FriendlyName" });
_18
_18
console.log(queue.dateUpdated);
_18
}
_18
_18
updateQueue();

Output

_14
{
_14
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"average_wait_time": 0,
_14
"current_size": 0,
_14
"date_created": "Tue, 04 Aug 2015 18:39:09 +0000",
_14
"date_updated": "Tue, 04 Aug 2015 18:39:09 +0000",
_14
"friendly_name": "FriendlyName",
_14
"max_size": 100,
_14
"sid": "QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_14
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues/QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json",
_14
"subresource_uris": {
_14
"members": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues/QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Members.json"
_14
}
_14
}


Delete a Queue resource

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

Path parameters

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that created the Queue resource to delete.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

SidSID<QU>required

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

Pattern: ^QU[0-9a-fA-F]{32}$Min length: 34Max length: 34

Delete a Queue resource

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

_14
// Download the helper library from https://www.twilio.com/docs/node/install
_14
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_14
_14
// Find your Account SID and Auth Token at twilio.com/console
_14
// and set the environment variables. See http://twil.io/secure
_14
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14
const authToken = process.env.TWILIO_AUTH_TOKEN;
_14
const client = twilio(accountSid, authToken);
_14
_14
async function deleteQueue() {
_14
await client.queues("QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").remove();
_14
}
_14
_14
deleteQueue();


Rate this page: