Create a new queue
Creates a new queue resource for the account with the provided settings and returns it.
POST
/
texml
/
Accounts
/
{account_sid}
/
Queues
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const queue = await client.texml.accounts.queues.create('account_sid');
console.log(queue.account_sid);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
queue = client.texml.accounts.queues.create(
account_sid="account_sid",
)
print(queue.account_sid)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
queue, err := client.Texml.Accounts.Queues.New(
context.TODO(),
"account_sid",
telnyx.TexmlAccountQueueNewParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", queue.AccountSid)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.texml.accounts.queues.QueueCreateParams;
import com.telnyx.sdk.models.texml.accounts.queues.QueueCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
QueueCreateResponse queue = client.texml().accounts().queues().create("account_sid");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
queue = telnyx.texml.accounts.queues.create("account_sid")
puts(queue)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$queue = $client->texml->accounts->queues->create(
'account_sid', friendlyName: 'Support Queue', maxSize: 10
);
var_dump($queue);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx texml:accounts:queues create \
--api-key 'My API Key' \
--account-sid account_sidcurl --request POST \
--url https://api.telnyx.com/v2/texml/Accounts/{account_sid}/Queues \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data MaxSize=10 \
--data 'FriendlyName=Support Queue'{
"account_sid": "4e71926f-8f13-450e-b91c-23c2ef786aa6",
"average_wait_time": 30,
"current_size": 3,
"date_created": "Fri, 27 Oct 2023 07:41:58 +0000",
"date_updated": "Fri, 27 Oct 2023 07:41:58 +0000",
"max_size": 10,
"sid": "my-queue",
"uri": "/Accounts/4e71926f-8f13-450e-b91c-23c2ef786aa6/Queues/my-queue.json",
"subresource_uris": {
"members": "/Accounts/4e71926f-8f13-450e-b91c-23c2ef786aa6/Queues/my-queue/Members.json"
}
}{
"errors": [
{
"detail": "Resource not found"
}
]
}Authorizations
Path Parameters
The UUID of the Telnyx account that owns the resource, for example f5586561-8ff0-4291-a51b-c7dfe4139ff9. The account_sid path segment is kept for Twilio API compatibility, but the value is a Telnyx account UUID, not a Twilio AC... SID. It must match the account that owns the API key used to authenticate the request, otherwise the endpoint returns 404. The same value is sent as AccountSid in TeXML webhooks.
Example:
"f5586561-8ff0-4291-a51b-c7dfe4139ff9"
Body
application/x-www-form-urlencoded
Create Queue request object
Response
Queue resource.
Was this page helpful?
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const queue = await client.texml.accounts.queues.create('account_sid');
console.log(queue.account_sid);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
queue = client.texml.accounts.queues.create(
account_sid="account_sid",
)
print(queue.account_sid)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
queue, err := client.Texml.Accounts.Queues.New(
context.TODO(),
"account_sid",
telnyx.TexmlAccountQueueNewParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", queue.AccountSid)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.texml.accounts.queues.QueueCreateParams;
import com.telnyx.sdk.models.texml.accounts.queues.QueueCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
QueueCreateResponse queue = client.texml().accounts().queues().create("account_sid");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
queue = telnyx.texml.accounts.queues.create("account_sid")
puts(queue)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$queue = $client->texml->accounts->queues->create(
'account_sid', friendlyName: 'Support Queue', maxSize: 10
);
var_dump($queue);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx texml:accounts:queues create \
--api-key 'My API Key' \
--account-sid account_sidcurl --request POST \
--url https://api.telnyx.com/v2/texml/Accounts/{account_sid}/Queues \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data MaxSize=10 \
--data 'FriendlyName=Support Queue'{
"account_sid": "4e71926f-8f13-450e-b91c-23c2ef786aa6",
"average_wait_time": 30,
"current_size": 3,
"date_created": "Fri, 27 Oct 2023 07:41:58 +0000",
"date_updated": "Fri, 27 Oct 2023 07:41:58 +0000",
"max_size": 10,
"sid": "my-queue",
"uri": "/Accounts/4e71926f-8f13-450e-b91c-23c2ef786aa6/Queues/my-queue.json",
"subresource_uris": {
"members": "/Accounts/4e71926f-8f13-450e-b91c-23c2ef786aa6/Queues/my-queue/Members.json"
}
}{
"errors": [
{
"detail": "Resource not found"
}
]
}