Queues resource
A Queue resource describes a call queue that contains individual calls, which are described by the queue's Members subsresource. 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 enqueuing calls, see Queueing Calls.
Warning
Queues persist. To optimize fetch operations, inactive Queues should be deleted.
The date and time in GMT that this resource was last updated, specified in RFC 2822 format.
The SID of the Account that created this Queue resource.
^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34The average wait time in seconds of the members in this queue. This is calculated at the time of the request.
0The unique string that that we created to identify this Queue resource.
^QU[0-9a-fA-F]{32}$Min length: 34Max length: 34The date and time in GMT that this resource was created specified in RFC 2822 format.
The maximum number of calls that can be in the queue. The default is 1000 and the maximum is 5000.
0POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Queues.json
application/x-www-form-urlencodedA descriptive string that you created to describe this resource. It can be up to 64 characters long.
The maximum number of calls allowed to be in the queue. The default is 1000. The maximum is 5000.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createQueue() {11const queue = await client.queues.create({ friendlyName: "FriendlyName" });1213console.log(queue.dateUpdated);14}1516createQueue();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"average_wait_time": 0,4"current_size": 0,5"date_created": "Tue, 04 Aug 2015 18:39:09 +0000",6"date_updated": "Tue, 04 Aug 2015 18:39:09 +0000",7"friendly_name": "FriendlyName",8"max_size": 100,9"sid": "QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",10"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues/QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"11}
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Queues/{Sid}.json
The SID of the Account that created the Queue resource to fetch.
^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34The Twilio-provided string that uniquely identifies the Queue resource to fetch
^QU[0-9a-fA-F]{32}$Min length: 34Max length: 341// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchQueue() {11const queue = await client12.queues("QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.fetch();1415console.log(queue.dateUpdated);16}1718fetchQueue();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"average_wait_time": 0,4"current_size": 0,5"date_created": "Tue, 04 Aug 2015 18:39:09 +0000",6"date_updated": "Tue, 04 Aug 2015 18:39:09 +0000",7"friendly_name": "0.361280134646222",8"max_size": 100,9"sid": "QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",10"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues/QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"11}
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Queues.json
How many resources to return in each list page. The default is 50, and the maximum is 1000.
1Maximum: 1000The page token. This is provided by the API.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function listQueue() {11const queues = await client.queues.list({ limit: 20 });1213queues.forEach((q) => console.log(q.dateUpdated));14}1516listQueue();
Response
1{2"end": 0,3"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues.json?PageSize=1&Page=0",4"next_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues.json?PageSize=1&Page=1&PageToken=PAQUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",5"page": 0,6"page_size": 1,7"previous_page_uri": null,8"queues": [9{10"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",11"average_wait_time": 0,12"current_size": 0,13"date_created": "Tue, 04 Aug 2015 18:39:09 +0000",14"date_updated": "Tue, 04 Aug 2015 18:39:09 +0000",15"friendly_name": "0.361280134646222",16"max_size": 100,17"sid": "QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues/QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"19}20],21"start": 0,22"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues.json?PageSize=1&Page=0"23}
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Queues/{Sid}.json
The SID of the Account that created the Queue resource to update.
^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34The Twilio-provided string that uniquely identifies the Queue resource to update
^QU[0-9a-fA-F]{32}$Min length: 34Max length: 34application/x-www-form-urlencodedA descriptive string that you created to describe this resource. It can be up to 64 characters long.
The maximum number of calls allowed to be in the queue. The default is 1000. The maximum is 5000.
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function updateQueue() {11const queue = await client12.queues("QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.update({ friendlyName: "FriendlyName" });1415console.log(queue.dateUpdated);16}1718updateQueue();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"average_wait_time": 0,4"current_size": 0,5"date_created": "Tue, 04 Aug 2015 18:39:09 +0000",6"date_updated": "Tue, 04 Aug 2015 18:39:09 +0000",7"friendly_name": "FriendlyName",8"max_size": 100,9"sid": "QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",10"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Queues/QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"11}
DELETE https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Queues/{Sid}.json
The SID of the Account that created the Queue resource to delete.
^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34The Twilio-provided string that uniquely identifies the Queue resource to delete
^QU[0-9a-fA-F]{32}$Min length: 34Max length: 341// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deleteQueue() {11await client.queues("QUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").remove();12}1314deleteQueue();