REST API: Queues

The Queue instance resource allows you to query and manage the state of individual call queues. When a caller is enqueued in a named Queue via the <Enqueue> verb, a Queue with that name is created if it doesn't exist. A Queue can also be created beforehand using the API. Each individual call in the queue is represented as a Member instance resource. See the Members documentation for details.

The Queues list resource allows you to list the queues within an account.

Queue Instance Resource

This resource represents an individual Queue instance. Each Queue needs to have a unique friendly name within an account.

Resource URI

/2010-04-01/Accounts/{AccountSid}/Queues/{QueueSid}

Resource Properties

A Queue resource is represented by the following properties:

Property Description
Sid A 34 character string that uniquely identifies this queue.
FriendlyName A user-provided string that identifies this queue.
CurrentSize The count of calls currently in the queue.
MaxSize The upper limit of calls allowed to be in the queue. The default is 100. The maximum is 1000.
AverageWaitTime The average wait time of the members of this queue in seconds. This is calculated at the time of the request.

HTTP GET

Returns a representation of the Queue identified by {QueueSid}.

Example
Get a Queue
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$queue = $client
    ->queues("QU5ef8732a3c49700934481addd5ce1659")
    ->fetch();

echo $queue->averageWaitTime;
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

queue = client.queues.get("QU5ef8732a3c49700934481addd5ce1659")
print(queue.average_wait_time)
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QU5ef8732a3c49700934481addd5ce1659 \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.Queue;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    Queue queue = client.getAccount().getQueue("QU5ef8732a3c49700934481addd5ce1659");
    System.out.println(queue.getAverageWaitTime());
    
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

queue = client.queues("QU5ef8732a3c49700934481addd5ce1659") \
              .fetch()

print(queue.average_wait_time)
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Queue;

public class Example {
  /// Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    Queue queue = Queue.fetch("QU5ef8732a3c49700934481addd5ce1659").execute();

    System.out.println(queue.getAverageWaitTime());
  }
}
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QU5ef8732a3c49700934481addd5ce1659.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$queue = $client->account->queues->get("QU5ef8732a3c49700934481addd5ce1659");
echo $queue->average_wait_time;
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var queue = twilio.GetQueue("QU5ef8732a3c49700934481addd5ce1659");
    
    Console.WriteLine(queue.AverageWaitTime);
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.queues("QU5ef8732a3c49700934481addd5ce1659").get(function(err, queue) {
    console.log(queue.averageWaitTime);
});
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
@queue = @client.account.queues.get("QU5ef8732a3c49700934481addd5ce1659")
puts @queue.average_wait_time
Show Output
  • JSON
  • XML
{
    "sid": "QUxxxxxxxxx",
    "friendly_name": "persistent_queue1",
    "current_size": 0,
    "average_wait_time": 0,
    "max_size": 10,
    "date_created": "Mon, 26 Mar 2012 22:00:14 +0000",
    "date_updated": "Mon, 26 Mar 2012 22:00:14 +0000",
    "uri": "/2010-04-01/Accounts/AC5ef87.../Queues/QUxxxxxxxxx.json"
}
<TwilioResponse>
    <Queue>
        <Sid>QUxxxxxxxxx</Sid>
        <FriendlyName>persistent_queue1</FriendlyName>
        <CurrentSize>0</CurrentSize>
        <AverageWaitTime>0</AverageWaitTime>
        <MaxSize>10</MaxSize>
        <DateCreated>Mon, 26 Mar 2012 22:00:14 +0000</DateCreated>
        <DateUpdated>Mon, 26 Mar 2012 22:00:14 +0000</DateUpdated>
        <Uri>/2010-04-01/Accounts/AC5ef87.../Queues/QUxxxxxxxxx</Uri>
    </Queue>
</TwilioResponse>
Get a Queue

HTTP POST

The POST request allows you to change the FriendlyName or MaxSize. Changing the MaxSize of a Queue to something smaller than its current size will result in the Queue rejecting incoming requests until it shrinks below the new MaxSize.

Example
Update a Queue
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$queue = $client
    ->queues("QU5ef8732a3c49700934481addd5ce1659")
    ->update(
        array("maxSize" => "123")
    );

echo $queue->averageWaitTime;
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

queue = client.queues.update("QU32a3c49700934481addd5ce1659f04d2", max_size="123")
print(queue.average_wait_time)
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QU32a3c49700934481addd5ce1659f04d2 \
    -d "MaxSize=123" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.Queue;
import com.twilio.sdk.resource.list.QueueList;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    Queue queue = client.getAccount().getQueue("QU32a3c49700934481addd5ce1659f04d2");
    // Build a filter for the QueueList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("MaxSize", "123"));
    queue.update(params); 
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

queue = client.queues("QU32a3c49700934481addd5ce1659f04d2") \
              .update(max_size="123")

print(queue.average_wait_time)
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Queue;

public class Example {
  /// Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    Queue queue = Queue.update("QU32a3c49700934481addd5ce1659f04d2").setMaxSize(123).execute();

    System.out.println(queue.getAverageWaitTime());
  }
}
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QU32a3c49700934481addd5ce1659f04d2.json \
    -d "MaxSize=123" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$queue = $client->account->queues->get("QU32a3c49700934481addd5ce1659f04d2");
$queue->update(array(
        "MaxSize" => "123"
    ));
echo $queue->average_wait_time;
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken); 
    
    twilio.UpdateQueue("QU32a3c49700934481addd5ce1659f04d2", null, 123);
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.queues("QU32a3c49700934481addd5ce1659f04d2").update({
    maxSize: "123"
}, function(err, queue) {
    console.log(queue.averageWaitTime);
});
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
@queue = @client.account.queues.get("QU32a3c49700934481addd5ce1659f04d2")
@queue.update(:max_size => "123")
puts @queue.average_wait_time
Show Output
  • JSON
  • XML
{ 
    "average_wait_time": 0,
    "current_size": 0,
    "date_created": "Thu, 21 Jun 2012 23:55:36 +0000",
    "date_updated": "Fri, 22 Jun 2012 00:02:15 +0000",
    "friendly_name": "newqueue",
    "max_size": 123,
    "sid": "QUxxxxxxxxxxxx",
    "uri": "/2010-04-01/Accounts/AC5ef87.../Queues/QUxxxxxxxxxxxx.json"
}
<TwilioResponse>
    <Queue>
        <Sid>QUxxxxxxxxxxxx</Sid>
        <FriendlyName>newqueue</FriendlyName>
        <CurrentSize>0</CurrentSize>
        <AvgWaitTime>0</AvgWaitTime>
        <MaxSize>123</MaxSize>
        <DateCreated>2012-06-21 23:55:36</DateCreated>
        <DateUpdated>2012-06-22 00:02:15</DateUpdated>
        <Uri>/2010-04-01/Accounts/AC5ef87.../Queues/QUxxxxxxxxxxxx</Uri>
    </Queue>
</TwilioResponse>
Update a Queue

HTTP PUT

Not supported

HTTP DELETE

The DELETE method allows you to remove a Queue. Only empty queues are deletable. Deleting a queue will not prevent another queue with the same friendly name from being dynamically created.

Queue Instance Subresources

Each Queue instance resource has a Members subresource which represents the set of members currently in the queue.

Members List Subresource
/2010-04-01/Accounts/{AccountSid}/Queues/{QueueSid}/Members

Represents the set of members currently connected to the queue identified by {QueueSid}. See the Members resource documentation for properties and response formats.

Queues List Resource

Resource URI

/2010-04-01/Accounts/{AccountSid}/Queues

HTTP GET

Returns a list of queues within an account. The list includes paging information.

Example 1
List all Queues
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Loop over the list of queues and echo a property for each one
foreach ($client->queues->read() as $queue) {
    echo $queue->averageWaitTime;
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

# A list of queue objects with the properties described above
queues = client.queues.list()
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.Queue;
import com.twilio.sdk.resource.list.QueueList;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
 
    QueueList queues = client.getAccount().getQueues();
    
    // Loop over queues and print out a property for each one.
    for (Queue queue : queues) {
      System.out.println(queue.getAverageWaitTime());
    }
    
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# A list of queue objects with the properties described above
for queue in client.queues.list():
    print(queue.average_wait_time)
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.api.v2010.account.Queue;

public class Example {
  /// Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    ResourceSet<Queue> queues = Queue.read().execute();

    // Loop over queues and print out a property for each one.
    for (Queue queue : queues) {
      System.out.println(queue.getAverageWaitTime());
    }
  }
}
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Loop over the list of queues and echo a property for each one
foreach ($client->account->queues as $queue) {
    echo $queue->average_wait_time;
}
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var queues = twilio.ListQueues();
    
    foreach (var queue in queues.Queues)
    {
      Console.WriteLine(queue.AverageWaitTime);
    }
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.queues.list(function(err, data) {
    data.queues.forEach(function(queue) {
        console.log(queue.AverageWaitTime);
    });
});
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Loop over queues and print out a property for each one
@client.account.queues.list.each do |queue|
    puts queue.average_wait_time
end
Show Output
  • JSON
  • XML
{
    "uri": "/2010-04-01/Accounts/AC5ef87.../Queues.json",
    "first_page_uri": "/2010-04-01/Accounts/AC5ef87.../Queues.json?Page=0&PageSize=50",
    "next_page_uri": "",
    "page": 0,
    "page_size": 50,
    "previous_page_uri": "",
    "queues": [
        {
            "average_wait_time": 0,
            "current_size": 0,
            "date_created": "Thu, 17 May 2012 23:50:39 +0000",
            "date_updated": "Thu, 17 May 2012 23:50:39 +0000",
            "friendly_name": "persistent_queue1",
            "max_size": 1000,
            "sid": "QUxxxxxxxxx",
            "uri": "/2010-04-01/Accounts/AC5ef87.../Queues/QUxxxxxxxxx.json"
        },
        { 
            "average_wait_time": 0,
            "current_size": 0,
            "date_created": "Thu, 26 Apr 2012 20:12:45 +0000",
            "date_updated": "Thu, 26 Apr 2012 20:12:45 +0000",
            "friendly_name": "persistent_queue2",
            "max_size": 100,
            "sid": "QUyyyyyyyyy",
            "uri": "/2010-04-01/Accounts/AC5ef87.../Queues/QUyyyyyyyyy.json"
        }
    ]
}
<TwilioResponse>
    <Queues  [paging attributes]>
        <Queue>
            <Sid>QUxxxxxxxxx</Sid>
            <FriendlyName>persistent_queue1</FriendlyName>
            <CurrentSize>32</CurrentSize>
            <AverageWaitTime>140<AverageWaitTime>
            <MaxSize>1000</MaxSize>
            <DateCreated>2012-02-04 12:44:15</DateCreated>
            <DateUpdated>2012-02-05 17:33:44</DateUpdated>
        </Queue>
        <Queue>
            <Sid>QUyyyyyyyyy</Sid>
            <FriendlyName>persistent_queue2</FriendlyName>
            <CurrentSize>10</CurrentSize>
            <AverageWaitTime>140<AverageWaitTime>
            <MaxSize>100</MaxSize>
            <DateCreated>2012-02-04 12:44:15</DateCreated>
            <DateUpdated>2012-02-05 17:33:44</DateUpdated>
        </Queue>
    </Queues>
</TwilioResponse>
List all Queues

HTTP POST

You can create a new Queue resource by POSTing to the Queues list resource. The FriendlyName and MaxSize parameters can be specified at creation.

Optional Parameters

You may POST the following parameters:

Parameter Description
FriendlyName A unique identifier for this queue.
MaxSize The maximum size of this queue. The default is 100. The maximum is 1000.
Example
Create New Queue
  • C#
  • Java
  • Node.js
  • PHP
  • Python
  • Ruby
  • curl
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$queue = $client->queues->create(
    array("friendlyName" => "newqueue")
);

echo $queue->sid;
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

queue = client.queues.create("newqueue", )
print(queue.sid)
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues \
    -d "FriendlyName=newqueue" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.factory.QueueFactory;
import com.twilio.sdk.resource.instance.Queue;
import com.twilio.sdk.resource.list.QueueList;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Build a filter for the QueueList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("FriendlyName", "newqueue"));
    
    QueueFactory queueFactory = client.getAccount().getQueueFactory();
    Queue queue = queueFactory.create(params);
    System.out.println(queue.getSid());
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

queue = client.queues.create(friendly_name="newqueue")
print(queue.sid)
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Queue;

public class Example {
  /// Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    Queue queue = Queue.create().setFriendlyName("newqueue").execute();

    System.out.println(queue.getSid());
  }
}
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues.json \
    -d "FriendlyName=newqueue" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

$queue = $client->account->queues->create("newqueue", array());
echo $queue->sid;
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var queue = twilio.CreateQueue("newqueue");
    
    Console.WriteLine(queue.Sid);
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.queues.create({
    friendlyName: "newqueue"
}, function(err, queue) {
    process.stdout.write(queue.sid);
});
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

queue = @client.account.queues.create(:friendly_name => "newqueue")
puts queue.average_wait_time
Create New Queue

HTTP PUT

Not supported

HTTP DELETE

Not supported

1 / 1
Loading Code Samples...
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
Response Format:
  • json
  • xml
Format:
  • JSON
  • XML
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$queue = $client
    ->queues("QU5ef8732a3c49700934481addd5ce1659")
    ->fetch();

echo $queue->averageWaitTime;
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

queue = client.queues.get("QU5ef8732a3c49700934481addd5ce1659")
print(queue.average_wait_time)
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QU5ef8732a3c49700934481addd5ce1659 \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.Queue;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    Queue queue = client.getAccount().getQueue("QU5ef8732a3c49700934481addd5ce1659");
    System.out.println(queue.getAverageWaitTime());
    
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

queue = client.queues("QU5ef8732a3c49700934481addd5ce1659") \
              .fetch()

print(queue.average_wait_time)
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Queue;

public class Example {
  /// Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    Queue queue = Queue.fetch("QU5ef8732a3c49700934481addd5ce1659").execute();

    System.out.println(queue.getAverageWaitTime());
  }
}
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QU5ef8732a3c49700934481addd5ce1659.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$queue = $client->account->queues->get("QU5ef8732a3c49700934481addd5ce1659");
echo $queue->average_wait_time;
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var queue = twilio.GetQueue("QU5ef8732a3c49700934481addd5ce1659");
    
    Console.WriteLine(queue.AverageWaitTime);
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.queues("QU5ef8732a3c49700934481addd5ce1659").get(function(err, queue) {
    console.log(queue.averageWaitTime);
});
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
@queue = @client.account.queues.get("QU5ef8732a3c49700934481addd5ce1659")
puts @queue.average_wait_time
{
    "sid": "QUxxxxxxxxx",
    "friendly_name": "persistent_queue1",
    "current_size": 0,
    "average_wait_time": 0,
    "max_size": 10,
    "date_created": "Mon, 26 Mar 2012 22:00:14 +0000",
    "date_updated": "Mon, 26 Mar 2012 22:00:14 +0000",
    "uri": "/2010-04-01/Accounts/AC5ef87.../Queues/QUxxxxxxxxx.json"
}
<TwilioResponse>
    <Queue>
        <Sid>QUxxxxxxxxx</Sid>
        <FriendlyName>persistent_queue1</FriendlyName>
        <CurrentSize>0</CurrentSize>
        <AverageWaitTime>0</AverageWaitTime>
        <MaxSize>10</MaxSize>
        <DateCreated>Mon, 26 Mar 2012 22:00:14 +0000</DateCreated>
        <DateUpdated>Mon, 26 Mar 2012 22:00:14 +0000</DateUpdated>
        <Uri>/2010-04-01/Accounts/AC5ef87.../Queues/QUxxxxxxxxx</Uri>
    </Queue>
</TwilioResponse>
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
Response Format:
  • json
  • xml
Format:
  • JSON
  • XML
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$queue = $client
    ->queues("QU5ef8732a3c49700934481addd5ce1659")
    ->update(
        array("maxSize" => "123")
    );

echo $queue->averageWaitTime;
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

queue = client.queues.update("QU32a3c49700934481addd5ce1659f04d2", max_size="123")
print(queue.average_wait_time)
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QU32a3c49700934481addd5ce1659f04d2 \
    -d "MaxSize=123" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.Queue;
import com.twilio.sdk.resource.list.QueueList;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    Queue queue = client.getAccount().getQueue("QU32a3c49700934481addd5ce1659f04d2");
    // Build a filter for the QueueList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("MaxSize", "123"));
    queue.update(params); 
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

queue = client.queues("QU32a3c49700934481addd5ce1659f04d2") \
              .update(max_size="123")

print(queue.average_wait_time)
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Queue;

public class Example {
  /// Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    // Get an object from its sid. If you do not have a sid,
    // check out the list resource examples on this page
    Queue queue = Queue.update("QU32a3c49700934481addd5ce1659f04d2").setMaxSize(123).execute();

    System.out.println(queue.getAverageWaitTime());
  }
}
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues/QU32a3c49700934481addd5ce1659f04d2.json \
    -d "MaxSize=123" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Get an object from its sid. If you do not have a sid,
// check out the list resource examples on this page
$queue = $client->account->queues->get("QU32a3c49700934481addd5ce1659f04d2");
$queue->update(array(
        "MaxSize" => "123"
    ));
echo $queue->average_wait_time;
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken); 
    
    twilio.UpdateQueue("QU32a3c49700934481addd5ce1659f04d2", null, 123);
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.queues("QU32a3c49700934481addd5ce1659f04d2").update({
    maxSize: "123"
}, function(err, queue) {
    console.log(queue.averageWaitTime);
});
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Get an object from its sid. If you do not have a sid,
# check out the list resource examples on this page
@queue = @client.account.queues.get("QU32a3c49700934481addd5ce1659f04d2")
@queue.update(:max_size => "123")
puts @queue.average_wait_time
{ 
    "average_wait_time": 0,
    "current_size": 0,
    "date_created": "Thu, 21 Jun 2012 23:55:36 +0000",
    "date_updated": "Fri, 22 Jun 2012 00:02:15 +0000",
    "friendly_name": "newqueue",
    "max_size": 123,
    "sid": "QUxxxxxxxxxxxx",
    "uri": "/2010-04-01/Accounts/AC5ef87.../Queues/QUxxxxxxxxxxxx.json"
}
<TwilioResponse>
    <Queue>
        <Sid>QUxxxxxxxxxxxx</Sid>
        <FriendlyName>newqueue</FriendlyName>
        <CurrentSize>0</CurrentSize>
        <AvgWaitTime>0</AvgWaitTime>
        <MaxSize>123</MaxSize>
        <DateCreated>2012-06-21 23:55:36</DateCreated>
        <DateUpdated>2012-06-22 00:02:15</DateUpdated>
        <Uri>/2010-04-01/Accounts/AC5ef87.../Queues/QUxxxxxxxxxxxx</Uri>
    </Queue>
</TwilioResponse>
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
Response Format:
  • json
  • xml
Format:
  • JSON
  • XML
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

// Loop over the list of queues and echo a property for each one
foreach ($client->queues->read() as $queue) {
    echo $queue->averageWaitTime;
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

# A list of queue objects with the properties described above
queues = client.queues.list()
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.Queue;
import com.twilio.sdk.resource.list.QueueList;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);
 
    QueueList queues = client.getAccount().getQueues();
    
    // Loop over queues and print out a property for each one.
    for (Queue queue : queues) {
      System.out.println(queue.getAverageWaitTime());
    }
    
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

# A list of queue objects with the properties described above
for queue in client.queues.list():
    print(queue.average_wait_time)
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.api.v2010.account.Queue;

public class Example {
  /// Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    ResourceSet<Queue> queues = Queue.read().execute();

    // Loop over queues and print out a property for each one.
    for (Queue queue : queues) {
      System.out.println(queue.getAverageWaitTime());
    }
  }
}
$ curl -G https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues.json \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

// Loop over the list of queues and echo a property for each one
foreach ($client->account->queues as $queue) {
    echo $queue->average_wait_time;
}
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var queues = twilio.ListQueues();
    
    foreach (var queue in queues.Queues)
    {
      Console.WriteLine(queue.AverageWaitTime);
    }
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.queues.list(function(err, data) {
    data.queues.forEach(function(queue) {
        console.log(queue.AverageWaitTime);
    });
});
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

# Loop over queues and print out a property for each one
@client.account.queues.list.each do |queue|
    puts queue.average_wait_time
end
{
    "uri": "/2010-04-01/Accounts/AC5ef87.../Queues.json",
    "first_page_uri": "/2010-04-01/Accounts/AC5ef87.../Queues.json?Page=0&PageSize=50",
    "next_page_uri": "",
    "page": 0,
    "page_size": 50,
    "previous_page_uri": "",
    "queues": [
        {
            "average_wait_time": 0,
            "current_size": 0,
            "date_created": "Thu, 17 May 2012 23:50:39 +0000",
            "date_updated": "Thu, 17 May 2012 23:50:39 +0000",
            "friendly_name": "persistent_queue1",
            "max_size": 1000,
            "sid": "QUxxxxxxxxx",
            "uri": "/2010-04-01/Accounts/AC5ef87.../Queues/QUxxxxxxxxx.json"
        },
        { 
            "average_wait_time": 0,
            "current_size": 0,
            "date_created": "Thu, 26 Apr 2012 20:12:45 +0000",
            "date_updated": "Thu, 26 Apr 2012 20:12:45 +0000",
            "friendly_name": "persistent_queue2",
            "max_size": 100,
            "sid": "QUyyyyyyyyy",
            "uri": "/2010-04-01/Accounts/AC5ef87.../Queues/QUyyyyyyyyy.json"
        }
    ]
}
<TwilioResponse>
    <Queues  [paging attributes]>
        <Queue>
            <Sid>QUxxxxxxxxx</Sid>
            <FriendlyName>persistent_queue1</FriendlyName>
            <CurrentSize>32</CurrentSize>
            <AverageWaitTime>140<AverageWaitTime>
            <MaxSize>1000</MaxSize>
            <DateCreated>2012-02-04 12:44:15</DateCreated>
            <DateUpdated>2012-02-05 17:33:44</DateUpdated>
        </Queue>
        <Queue>
            <Sid>QUyyyyyyyyy</Sid>
            <FriendlyName>persistent_queue2</FriendlyName>
            <CurrentSize>10</CurrentSize>
            <AverageWaitTime>140<AverageWaitTime>
            <MaxSize>100</MaxSize>
            <DateCreated>2012-02-04 12:44:15</DateCreated>
            <DateUpdated>2012-02-05 17:33:44</DateUpdated>
        </Queue>
    </Queues>
</TwilioResponse>
SDK Version:
  • 6.x
  • 7.x
SDK Version:
  • 4.x
  • 5.x
SDK Version:
  • 5.x
  • 6.x
Response Format:
  • json
  • xml
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once '/path/to/vendor/autoload.php'; // Loads the library
use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Client($sid, $token);

$queue = $client->queues->create(
    array("friendlyName" => "newqueue")
);

echo $queue->sid;
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioRestClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token  = "your_auth_token"
client = TwilioRestClient(account_sid, auth_token)

queue = client.queues.create("newqueue", )
print(queue.sid)
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues \
    -d "FriendlyName=newqueue" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioRestClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.factory.QueueFactory;
import com.twilio.sdk.resource.instance.Queue;
import com.twilio.sdk.resource.list.QueueList;
import java.util.ArrayList;
import java.util.List;
import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;

public class Example { 

  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) throws TwilioRestException {
    TwilioRestClient client = new TwilioRestClient(ACCOUNT_SID, AUTH_TOKEN);

    // Build a filter for the QueueList
    List<NameValuePair> params = new ArrayList<NameValuePair>();
    params.add(new BasicNameValuePair("FriendlyName", "newqueue"));
    
    QueueFactory queueFactory = client.getAccount().getQueueFactory();
    Queue queue = queueFactory.create(params);
    System.out.println(queue.getSid());
  }
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

queue = client.queues.create(friendly_name="newqueue")
print(queue.sid)
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.api.v2010.account.Queue;

public class Example {
  /// Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    Queue queue = Queue.create().setFriendlyName("newqueue").execute();

    System.out.println(queue.getSid());
  }
}
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Queues.json \
    -d "FriendlyName=newqueue" \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
<?php
// Get the PHP helper library from twilio.com/docs/php/install
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; 
$token = "your_auth_token"; 
$client = new Services_Twilio($sid, $token);

$queue = $client->account->queues->create("newqueue", array());
echo $queue->sid;
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
class Example 
{
  static void Main(string[] args) 
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    string AccountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    string AuthToken = "your_auth_token";
    var twilio = new TwilioRestClient(AccountSid, AuthToken);

    var queue = twilio.CreateQueue("newqueue");
    
    Console.WriteLine(queue.Sid);
  }
}
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
var accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
var authToken = "your_auth_token";
var client = require('twilio')(accountSid, authToken);

client.queues.create({
    friendlyName: "newqueue"
}, function(err, queue) {
    process.stdout.write(queue.sid);
});
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'rubygems'          # This line not needed for ruby > 1.8
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new account_sid, auth_token

queue = @client.account.queues.create(:friendly_name => "newqueue")
puts queue.average_wait_time