Create a new requirement group
POST
/
requirement_groups
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const requirementGroup = await client.requirementGroups.create({
action: 'ordering',
country_code: 'US',
phone_number_type: 'local',
});
console.log(requirementGroup.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
)
requirement_group = client.requirement_groups.create(
action="ordering",
country_code="US",
phone_number_type="local",
)
print(requirement_group.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"),
)
requirementGroup, err := client.RequirementGroups.New(context.TODO(), telnyx.RequirementGroupNewParams{
Action: telnyx.RequirementGroupNewParamsActionOrdering,
CountryCode: "US",
PhoneNumberType: telnyx.RequirementGroupNewParamsPhoneNumberTypeLocal,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", requirementGroup.ID)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.requirementgroups.RequirementGroup;
import com.telnyx.sdk.models.requirementgroups.RequirementGroupCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
RequirementGroupCreateParams params = RequirementGroupCreateParams.builder()
.action(RequirementGroupCreateParams.Action.ORDERING)
.countryCode("US")
.phoneNumberType(RequirementGroupCreateParams.PhoneNumberType.LOCAL)
.build();
RequirementGroup requirementGroup = client.requirementGroups().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
requirement_group = telnyx.requirement_groups.create(action: :ordering, country_code: "US", phone_number_type: :local)
puts(requirement_group)<?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 {
$requirementGroup = $client->requirementGroups->create(
action: 'ordering',
countryCode: 'US',
phoneNumberType: 'local',
customerReference: 'My Requirement Group',
regulatoryRequirements: [
['fieldValue' => 'field_value', 'requirementID' => 'requirement_id']
],
);
var_dump($requirementGroup);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx requirement-groups create \
--api-key 'My API Key' \
--action ordering \
--country-code US \
--phone-number-type localcurl --request POST \
--url https://api.telnyx.com/v2/requirement_groups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"country_code": "US",
"phone_number_type": "local",
"action": "ordering",
"customer_reference": "My Requirement Group",
"regulatory_requirements": [
{
"requirement_id": "<string>",
"field_value": "<string>"
}
]
}
'{
"id": "<string>",
"country_code": "<string>",
"phone_number_type": "<string>",
"action": "<string>",
"customer_reference": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"record_type": "requirement_group",
"regulatory_requirements": [
{
"requirement_id": "<string>",
"field_value": "<string>",
"field_type": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not understand the provided credentials.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
ISO alpha 2 country code
Example:
"US"
Available options:
local, toll_free, mobile, national, shared_cost Example:
"local"
Available options:
ordering, porting Example:
"ordering"
Example:
"My Requirement Group"
Show child attributes
Show child attributes
Response
Requirement group created
Available options:
approved, unapproved, pending-approval, declined, expired Example:
"requirement_group"
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 requirementGroup = await client.requirementGroups.create({
action: 'ordering',
country_code: 'US',
phone_number_type: 'local',
});
console.log(requirementGroup.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
)
requirement_group = client.requirement_groups.create(
action="ordering",
country_code="US",
phone_number_type="local",
)
print(requirement_group.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"),
)
requirementGroup, err := client.RequirementGroups.New(context.TODO(), telnyx.RequirementGroupNewParams{
Action: telnyx.RequirementGroupNewParamsActionOrdering,
CountryCode: "US",
PhoneNumberType: telnyx.RequirementGroupNewParamsPhoneNumberTypeLocal,
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", requirementGroup.ID)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.requirementgroups.RequirementGroup;
import com.telnyx.sdk.models.requirementgroups.RequirementGroupCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
RequirementGroupCreateParams params = RequirementGroupCreateParams.builder()
.action(RequirementGroupCreateParams.Action.ORDERING)
.countryCode("US")
.phoneNumberType(RequirementGroupCreateParams.PhoneNumberType.LOCAL)
.build();
RequirementGroup requirementGroup = client.requirementGroups().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
requirement_group = telnyx.requirement_groups.create(action: :ordering, country_code: "US", phone_number_type: :local)
puts(requirement_group)<?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 {
$requirementGroup = $client->requirementGroups->create(
action: 'ordering',
countryCode: 'US',
phoneNumberType: 'local',
customerReference: 'My Requirement Group',
regulatoryRequirements: [
['fieldValue' => 'field_value', 'requirementID' => 'requirement_id']
],
);
var_dump($requirementGroup);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx requirement-groups create \
--api-key 'My API Key' \
--action ordering \
--country-code US \
--phone-number-type localcurl --request POST \
--url https://api.telnyx.com/v2/requirement_groups \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"country_code": "US",
"phone_number_type": "local",
"action": "ordering",
"customer_reference": "My Requirement Group",
"regulatory_requirements": [
{
"requirement_id": "<string>",
"field_value": "<string>"
}
]
}
'{
"id": "<string>",
"country_code": "<string>",
"phone_number_type": "<string>",
"action": "<string>",
"customer_reference": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"record_type": "requirement_group",
"regulatory_requirements": [
{
"requirement_id": "<string>",
"field_value": "<string>",
"field_type": "<string>",
"expires_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not understand the provided credentials.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}