Create an inexplicit number order
Create an inexplicit number order to programmatically purchase phone numbers without specifying exact numbers.
POST
/
inexplicit_number_orders
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const inexplicitNumberOrder = await client.inexplicitNumberOrders.create({
ordering_groups: [
{
count_requested: 'count_requested',
country_iso: 'US',
phone_number_type: 'phone_number_type',
},
],
});
console.log(inexplicitNumberOrder.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
)
inexplicit_number_order = client.inexplicit_number_orders.create(
ordering_groups=[{
"count_requested": "count_requested",
"country_iso": "US",
"phone_number_type": "phone_number_type",
}],
)
print(inexplicit_number_order.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"),
)
inexplicitNumberOrder, err := client.InexplicitNumberOrders.New(context.TODO(), telnyx.InexplicitNumberOrderNewParams{
OrderingGroups: []telnyx.InexplicitNumberOrderNewParamsOrderingGroup{{
CountRequested: "count_requested",
CountryISO: "US",
PhoneNumberType: "phone_number_type",
}},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", inexplicitNumberOrder.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.inexplicitnumberorders.InexplicitNumberOrderCreateParams;
import com.telnyx.sdk.models.inexplicitnumberorders.InexplicitNumberOrderCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
InexplicitNumberOrderCreateParams params = InexplicitNumberOrderCreateParams.builder()
.addOrderingGroup(InexplicitNumberOrderCreateParams.OrderingGroup.builder()
.countRequested("count_requested")
.countryIso(InexplicitNumberOrderCreateParams.OrderingGroup.CountryIso.US)
.phoneNumberType("phone_number_type")
.build())
.build();
InexplicitNumberOrderCreateResponse inexplicitNumberOrder = client.inexplicitNumberOrders().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
inexplicit_number_order = telnyx.inexplicit_number_orders.create(
ordering_groups: [{count_requested: "count_requested", country_iso: :US, phone_number_type: "phone_number_type"}]
)
puts(inexplicit_number_order)<?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 {
$inexplicitNumberOrder = $client->inexplicitNumberOrders->create(
orderingGroups: [
[
'countRequested' => 'count_requested',
'countryISO' => 'US',
'phoneNumberType' => 'phone_number_type',
'administrativeArea' => 'administrative_area',
'excludeHeldNumbers' => true,
'features' => ['string'],
'locality' => 'locality',
'nationalDestinationCode' => 'national_destination_code',
'phoneNumber' => [
'contains' => 'contains',
'endsWith' => 'ends_with',
'startsWith' => 'starts_with',
],
'quickship' => true,
'strategy' => 'always',
],
],
billingGroupID: 'billing_group_id',
connectionID: 'connection_id',
customerReference: 'customer_reference',
messagingProfileID: 'messaging_profile_id',
);
var_dump($inexplicitNumberOrder);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx inexplicit-number-orders create \
--api-key 'My API Key' \
--ordering-group '{count_requested: count_requested, country_iso: US, phone_number_type: phone_number_type}'curl --request POST \
--url https://api.telnyx.com/v2/inexplicit_number_orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ordering_groups": [
{
"country_iso": "US",
"count_requested": "5",
"phone_number_type": "local",
"administrative_area": "CA",
"features": [
"voice"
]
}
]
}
'{
"data": {
"id": "string",
"connection_id": "string",
"messaging_profile_id": "string",
"customer_reference": "string",
"billing_group_id": "string",
"ordering_groups": [
{
"country_iso": "string",
"phone_number_type": "string",
"count_requested": 0,
"count_allocated": 0,
"status": "pending",
"national_destination_code": "string",
"phone_number[starts_with]": "string",
"phone_number[ends_with]": "string",
"phone_number[contains]": "string",
"administrative_area": "string",
"strategy": "always",
"quickship": false,
"exclude_held_numbers": false,
"error_reason": "string",
"orders": [
{
"number_order_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"sub_number_order_ids": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
]
}
],
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z"
}
],
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z"
}
}{
"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"
}
}
]
}{
"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
Body
application/json
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 inexplicitNumberOrder = await client.inexplicitNumberOrders.create({
ordering_groups: [
{
count_requested: 'count_requested',
country_iso: 'US',
phone_number_type: 'phone_number_type',
},
],
});
console.log(inexplicitNumberOrder.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
)
inexplicit_number_order = client.inexplicit_number_orders.create(
ordering_groups=[{
"count_requested": "count_requested",
"country_iso": "US",
"phone_number_type": "phone_number_type",
}],
)
print(inexplicit_number_order.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"),
)
inexplicitNumberOrder, err := client.InexplicitNumberOrders.New(context.TODO(), telnyx.InexplicitNumberOrderNewParams{
OrderingGroups: []telnyx.InexplicitNumberOrderNewParamsOrderingGroup{{
CountRequested: "count_requested",
CountryISO: "US",
PhoneNumberType: "phone_number_type",
}},
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", inexplicitNumberOrder.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.inexplicitnumberorders.InexplicitNumberOrderCreateParams;
import com.telnyx.sdk.models.inexplicitnumberorders.InexplicitNumberOrderCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
InexplicitNumberOrderCreateParams params = InexplicitNumberOrderCreateParams.builder()
.addOrderingGroup(InexplicitNumberOrderCreateParams.OrderingGroup.builder()
.countRequested("count_requested")
.countryIso(InexplicitNumberOrderCreateParams.OrderingGroup.CountryIso.US)
.phoneNumberType("phone_number_type")
.build())
.build();
InexplicitNumberOrderCreateResponse inexplicitNumberOrder = client.inexplicitNumberOrders().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
inexplicit_number_order = telnyx.inexplicit_number_orders.create(
ordering_groups: [{count_requested: "count_requested", country_iso: :US, phone_number_type: "phone_number_type"}]
)
puts(inexplicit_number_order)<?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 {
$inexplicitNumberOrder = $client->inexplicitNumberOrders->create(
orderingGroups: [
[
'countRequested' => 'count_requested',
'countryISO' => 'US',
'phoneNumberType' => 'phone_number_type',
'administrativeArea' => 'administrative_area',
'excludeHeldNumbers' => true,
'features' => ['string'],
'locality' => 'locality',
'nationalDestinationCode' => 'national_destination_code',
'phoneNumber' => [
'contains' => 'contains',
'endsWith' => 'ends_with',
'startsWith' => 'starts_with',
],
'quickship' => true,
'strategy' => 'always',
],
],
billingGroupID: 'billing_group_id',
connectionID: 'connection_id',
customerReference: 'customer_reference',
messagingProfileID: 'messaging_profile_id',
);
var_dump($inexplicitNumberOrder);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx inexplicit-number-orders create \
--api-key 'My API Key' \
--ordering-group '{count_requested: count_requested, country_iso: US, phone_number_type: phone_number_type}'curl --request POST \
--url https://api.telnyx.com/v2/inexplicit_number_orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ordering_groups": [
{
"country_iso": "US",
"count_requested": "5",
"phone_number_type": "local",
"administrative_area": "CA",
"features": [
"voice"
]
}
]
}
'{
"data": {
"id": "string",
"connection_id": "string",
"messaging_profile_id": "string",
"customer_reference": "string",
"billing_group_id": "string",
"ordering_groups": [
{
"country_iso": "string",
"phone_number_type": "string",
"count_requested": 0,
"count_allocated": 0,
"status": "pending",
"national_destination_code": "string",
"phone_number[starts_with]": "string",
"phone_number[ends_with]": "string",
"phone_number[contains]": "string",
"administrative_area": "string",
"strategy": "always",
"quickship": false,
"exclude_held_numbers": false,
"error_reason": "string",
"orders": [
{
"number_order_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"sub_number_order_ids": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6"
]
}
],
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z"
}
],
"created_at": "2024-01-23T18:10:02.574Z",
"updated_at": "2024-01-23T18:10:02.574Z"
}
}{
"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"
}
}
]
}{
"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"
}
}
]
}