Create an Ip
Create a new IP object.
POST
/
ips
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const ip = await client.ips.create({ ip_address: '192.168.0.0' });
console.log(ip.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
)
ip = client.ips.create(
ip_address="192.168.0.0",
)
print(ip.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"),
)
ip, err := client.IPs.New(context.TODO(), telnyx.IPNewParams{
IPAddress: "192.168.0.0",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", ip.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ips.IpCreateParams;
import com.telnyx.sdk.models.ips.IpCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
IpCreateParams params = IpCreateParams.builder()
.ipAddress("192.168.0.0")
.build();
IpCreateResponse ip = client.ips().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
ip = telnyx.ips.create(ip_address: "192.168.0.0")
puts(ip)<?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 {
$ip = $client->ips->create(
ipAddress: '192.168.0.0',
connectionID: '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
port: 5060,
);
var_dump($ip);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ips create \
--api-key 'My API Key' \
--ip-address 192.168.0.0curl --request POST \
--url https://api.telnyx.com/v2/ips \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"connection_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
"ip_address": "192.168.0.0",
"port": 5060
}
'{
"data": {
"id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
"record_type": "ip",
"connection_id": "3456789987654",
"ip_address": "192.168.0.0",
"port": 5060,
"created_at": "2018-02-02T22:25:27.521Z",
"updated_at": "2018-02-02T22:25:27.521Z"
}
}{
"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": "10010",
"title": "Not authorized",
"detail": "You are not authorized to access the requested resource.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10010"
},
"source": {
"pointer": "/"
}
}
]
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "Invalid dnis_format: test, was provided. Acceptable formats are +e164, e164, national, sip_username",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
},
"source": {
"pointer": "/inbound/dnis_number_format"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
application/json
Response
Successful response with details about an IP.
Show child attributes
Show child attributes
Example:
{
"id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
"record_type": "ip",
"connection_id": "3456789987654",
"ip_address": "192.168.0.0",
"port": 5060,
"created_at": "2018-02-02T22:25:27.521Z",
"updated_at": "2018-02-02T22:25:27.521Z"
}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 ip = await client.ips.create({ ip_address: '192.168.0.0' });
console.log(ip.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
)
ip = client.ips.create(
ip_address="192.168.0.0",
)
print(ip.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"),
)
ip, err := client.IPs.New(context.TODO(), telnyx.IPNewParams{
IPAddress: "192.168.0.0",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", ip.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.ips.IpCreateParams;
import com.telnyx.sdk.models.ips.IpCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
IpCreateParams params = IpCreateParams.builder()
.ipAddress("192.168.0.0")
.build();
IpCreateResponse ip = client.ips().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
ip = telnyx.ips.create(ip_address: "192.168.0.0")
puts(ip)<?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 {
$ip = $client->ips->create(
ipAddress: '192.168.0.0',
connectionID: '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
port: 5060,
);
var_dump($ip);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx ips create \
--api-key 'My API Key' \
--ip-address 192.168.0.0curl --request POST \
--url https://api.telnyx.com/v2/ips \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"connection_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
"ip_address": "192.168.0.0",
"port": 5060
}
'{
"data": {
"id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
"record_type": "ip",
"connection_id": "3456789987654",
"ip_address": "192.168.0.0",
"port": 5060,
"created_at": "2018-02-02T22:25:27.521Z",
"updated_at": "2018-02-02T22:25:27.521Z"
}
}{
"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": "10010",
"title": "Not authorized",
"detail": "You are not authorized to access the requested resource.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10010"
},
"source": {
"pointer": "/"
}
}
]
}{
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "Invalid dnis_format: test, was provided. Acceptable formats are +e164, e164, national, sip_username",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
},
"source": {
"pointer": "/inbound/dnis_number_format"
}
}
]
}