Skip to main content
POST
/
networks
/
{id}
/
default_gateway
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});

const defaultGateway = await client.networks.defaultGateway.create(
  '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);

console.log(defaultGateway.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
)
default_gateway = client.networks.default_gateway.create(
network_identifier="6a09cdc3-8948-47f0-aa62-74ac943d6c58",
)
print(default_gateway.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"),
)
defaultGateway, err := client.Networks.DefaultGateway.New(
context.TODO(),
"6a09cdc3-8948-47f0-aa62-74ac943d6c58",
telnyx.NetworkDefaultGatewayNewParams{},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", defaultGateway.Data)
}
package com.telnyx.sdk.example;

import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.networks.defaultgateway.DefaultGatewayCreateParams;
import com.telnyx.sdk.models.networks.defaultgateway.DefaultGatewayCreateResponse;

public final class Main {
private Main() {}

public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();

DefaultGatewayCreateResponse defaultGateway = client.networks().defaultGateway().create("6a09cdc3-8948-47f0-aa62-74ac943d6c58");
}
}
require "telnyx"

telnyx = Telnyx::Client.new(api_key: "My API Key")

default_gateway = telnyx.networks.default_gateway.create("6a09cdc3-8948-47f0-aa62-74ac943d6c58")

puts(default_gateway)
<?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 {
$defaultGateway = $client->networks->defaultGateway->create(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
wireguardPeerID: 'e66c496d-4a85-423b-8b2a-8e63fac20320',
);

var_dump($defaultGateway);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx networks:default-gateway create \
--api-key 'My API Key' \
--network-identifier 6a09cdc3-8948-47f0-aa62-74ac943d6c58
curl --request POST \
--url https://api.telnyx.com/v2/networks/{id}/default_gateway \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"wireguard_peer_id": "e66c496d-4a85-423b-8b2a-8e63fac20320"
}
'
{
  "data": [
    {
      "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
      "record_type": "default_gateway",
      "created_at": "2018-02-02T22:25:27.521Z",
      "updated_at": "2018-02-02T22:25:27.521Z",
      "network_id": "e66c496d-4a85-423b-8b2a-8e63fac20320",
      "wireguard_peer_id": "e66c496d-4a85-423b-8b2a-8e63fac20320",
      "status": "provisioned"
    }
  ],
  "meta": {
    "total_pages": 3,
    "total_results": 55,
    "page_number": 2,
    "page_size": 25
  }
}
{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}
{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

id
string<uuid>
required

Identifies the resource.

Example:

"6a09cdc3-8948-47f0-aa62-74ac943d6c58"

Body

application/json
wireguard_peer_id
string<uuid>

Wireguard peer ID.

Example:

"e66c496d-4a85-423b-8b2a-8e63fac20320"

Response

Successful response

data
DefaultGateway · object[]
meta
object