Validate a list of call reasons
Check up to 10 candidate call_reasons strings against Telnyx’s vetting heuristics before sending them on a DIR create or update. The endpoint flags strings that are likely to be rejected during vetting (too generic, banned phrases, length issues, etc.) so you can fix them up front.
POST
/
call_reasons
/
validate
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.callReasons.validate({
body: ['Appointment reminders', 'Billing inquiries'],
});
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.call_reasons.validate(
body=["Appointment reminders", "Billing inquiries"],
)
print(response.data)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"),
)
response, err := client.CallReasons.Validate(context.TODO(), telnyx.CallReasonValidateParams{
Body: []string{"Appointment reminders", "Billing inquiries"},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.callreasons.CallReasonValidateResponse;
import java.util.List;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
List<String> params = List.of(
"Appointment reminders", "Billing inquiries"
);
CallReasonValidateResponse response = client.callReasons().validate(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.call_reasons.validate(body: ["Appointment reminders", "Billing inquiries"])
puts(response)<?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 {
$response = $client->callReasons->validate(
body: ['Appointment reminders', 'Billing inquiries']
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx call-reasons validate \
--api-key 'My API Key' \
--body 'Appointment reminders' \
--body 'Billing inquiries'curl --request POST \
--url https://api.telnyx.com/v2/call_reasons/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
"Appointment reminders",
"Billing inquiries"
]
'{
"data": {
"all_pre_approved": false,
"non_approved_reasons": [
"Appointment reminders",
"Billing inquiries"
],
"requires_manual_vetting": true
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Required array length:
1 - 10 elementsMaximum string length:
64Example:
[
"Appointment reminders",
"Billing inquiries"
]
Response
Per-string validation result.
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const response = await client.callReasons.validate({
body: ['Appointment reminders', 'Billing inquiries'],
});
console.log(response.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
response = client.call_reasons.validate(
body=["Appointment reminders", "Billing inquiries"],
)
print(response.data)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"),
)
response, err := client.CallReasons.Validate(context.TODO(), telnyx.CallReasonValidateParams{
Body: []string{"Appointment reminders", "Billing inquiries"},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.callreasons.CallReasonValidateResponse;
import java.util.List;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
List<String> params = List.of(
"Appointment reminders", "Billing inquiries"
);
CallReasonValidateResponse response = client.callReasons().validate(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.call_reasons.validate(body: ["Appointment reminders", "Billing inquiries"])
puts(response)<?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 {
$response = $client->callReasons->validate(
body: ['Appointment reminders', 'Billing inquiries']
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx call-reasons validate \
--api-key 'My API Key' \
--body 'Appointment reminders' \
--body 'Billing inquiries'curl --request POST \
--url https://api.telnyx.com/v2/call_reasons/validate \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
[
"Appointment reminders",
"Billing inquiries"
]
'{
"data": {
"all_pre_approved": false,
"non_approved_reasons": [
"Appointment reminders",
"Billing inquiries"
],
"requires_manual_vetting": true
}
}