Create new Access IP Address
POST
/
access_ip_address
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const accessIPAddressResponse = await client.accessIPAddress.create({ ip_address: 'ip_address' });
console.log(accessIPAddressResponse.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
)
access_ip_address_response = client.access_ip_address.create(
ip_address="ip_address",
)
print(access_ip_address_response.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"),
)
accessIPAddressResponse, err := client.AccessIPAddress.New(context.TODO(), telnyx.AccessIPAddressNewParams{
IPAddress: "ip_address",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accessIPAddressResponse.ID)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.accessipaddress.AccessIpAddressCreateParams;
import com.telnyx.sdk.models.accessipaddress.AccessIpAddressResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
AccessIpAddressCreateParams params = AccessIpAddressCreateParams.builder()
.ipAddress("ip_address")
.build();
AccessIpAddressResponse accessIpAddressResponse = client.accessIpAddress().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
access_ip_address_response = telnyx.access_ip_address.create(ip_address: "ip_address")
puts(access_ip_address_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 {
$accessIPAddressResponse = $client->accessIPAddress->create(
ipAddress: 'ip_address', description: 'description'
);
var_dump($accessIPAddressResponse);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx access-ip-address create \
--api-key 'My API Key' \
--ip-address ip_addresscurl --request POST \
--url https://api.telnyx.com/v2/access_ip_address \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ip_address": "<string>",
"description": "<string>"
}
'{
"id": "<string>",
"ip_address": "<string>",
"source": "<string>",
"user_id": "<string>",
"description": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
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 accessIPAddressResponse = await client.accessIPAddress.create({ ip_address: 'ip_address' });
console.log(accessIPAddressResponse.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
)
access_ip_address_response = client.access_ip_address.create(
ip_address="ip_address",
)
print(access_ip_address_response.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"),
)
accessIPAddressResponse, err := client.AccessIPAddress.New(context.TODO(), telnyx.AccessIPAddressNewParams{
IPAddress: "ip_address",
})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", accessIPAddressResponse.ID)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.accessipaddress.AccessIpAddressCreateParams;
import com.telnyx.sdk.models.accessipaddress.AccessIpAddressResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
AccessIpAddressCreateParams params = AccessIpAddressCreateParams.builder()
.ipAddress("ip_address")
.build();
AccessIpAddressResponse accessIpAddressResponse = client.accessIpAddress().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
access_ip_address_response = telnyx.access_ip_address.create(ip_address: "ip_address")
puts(access_ip_address_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 {
$accessIPAddressResponse = $client->accessIPAddress->create(
ipAddress: 'ip_address', description: 'description'
);
var_dump($accessIPAddressResponse);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx access-ip-address create \
--api-key 'My API Key' \
--ip-address ip_addresscurl --request POST \
--url https://api.telnyx.com/v2/access_ip_address \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"ip_address": "<string>",
"description": "<string>"
}
'{
"id": "<string>",
"ip_address": "<string>",
"source": "<string>",
"user_id": "<string>",
"description": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z"
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}