List standard call reasons
Telnyx maintains a library of pre-vetted call-reason phrases (e.g. “Appointment reminders”, “Billing inquiries”) that carry through DIR vetting smoothly. You can use any string that fits your use case in DirCreateRequest.call_reasons, but matching one of these reduces the chance the vetting team flags the phrasing for clarification.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const callReasonListResponse of client.callReasons.list()) {
console.log(callReasonListResponse.id);
}import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
page = client.call_reasons.list()
page = page.data[0]
print(page.id)
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"),
)
page, err := client.CallReasons.List(context.TODO(), telnyx.CallReasonListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.callreasons.CallReasonListPage;
import com.telnyx.sdk.models.callreasons.CallReasonListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CallReasonListPage page = client.callReasons().list();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
page = telnyx.call_reasons.list
puts(page)<?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 {
$page = $client->callReasons->list(pageNumber: 1, pageSize: 100);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx call-reasons list \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/call_reasons \
--header 'Authorization: Bearer <token>'{
"data": [
{
"id": "d29914a4-3c93-440c-af72-03778f442522",
"reason": "Account Alert",
"description": "Alert about account status or changes"
},
{
"id": "4cabcae2-6c61-415b-ac5b-753469458a56",
"reason": "Account Notification",
"description": "General account notifications"
}
],
"meta": {
"page_number": 1,
"page_size": 2,
"total_results": 45,
"total_pages": 23
}
}Authorizations
Telnyx API key. Generate one at https://portal.telnyx.com/#/app/api-keys.
Query Parameters
1-based page number. Out-of-range values return an empty page with correct meta.
x >= 11
Items per page. Default 100 for this endpoint (the call-reason library is small and most callers want the whole list in one call). Maximum 250; values above are clamped to 250.
1 <= x <= 250100
Response
Paginated list of standard call reasons.
Show child attributes
Show child attributes
JSON:API pagination metadata returned with every paginated list response. Page numbering is 1-based. page_size reports the number of items actually returned in data for this page; the requested size is taken from the page[size] query parameter.
Show child attributes
Show child attributes
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const callReasonListResponse of client.callReasons.list()) {
console.log(callReasonListResponse.id);
}import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
page = client.call_reasons.list()
page = page.data[0]
print(page.id)
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"),
)
page, err := client.CallReasons.List(context.TODO(), telnyx.CallReasonListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.callreasons.CallReasonListPage;
import com.telnyx.sdk.models.callreasons.CallReasonListParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
CallReasonListPage page = client.callReasons().list();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
page = telnyx.call_reasons.list
puts(page)<?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 {
$page = $client->callReasons->list(pageNumber: 1, pageSize: 100);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx call-reasons list \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/call_reasons \
--header 'Authorization: Bearer <token>'{
"data": [
{
"id": "d29914a4-3c93-440c-af72-03778f442522",
"reason": "Account Alert",
"description": "Alert about account status or changes"
},
{
"id": "4cabcae2-6c61-415b-ac5b-753469458a56",
"reason": "Account Notification",
"description": "General account notifications"
}
],
"meta": {
"page_number": 1,
"page_size": 2,
"total_results": 45,
"total_pages": 23
}
}