Delete a Network Route
Deletes a route that was added with POST /network_routes. Traffic to its CIDR stops going via the next hop at once. Routes that an attachment installs (origin attachment) leave with the attachment and cannot be deleted here.
DELETE
/
network_routes
/
{id}
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
await client.networkRoutes.delete('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
)
client.network_routes.delete(
"id",
)
package main
import (
"context"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.NetworkRoutes.Delete(
context.TODO(),
"id",
)
if err != nil {
panic(err.Error())
}
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
client.networkRoutes().delete("id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.network_routes.delete("id")
puts(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 {
$response = $client->networkRoutes->delete(
'id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx network-routes delete \
--api-key 'My API Key' \
--id e8a2c5d0-3f7b-4a19-b6d2-9c1e0f8a7b53curl --request DELETE \
--url https://api.telnyx.com/v2/network_routes/{id} \
--header 'Authorization: Bearer <token>'{
"errors": [
{
"code": "10020",
"title": "Resource not found",
"detail": "get route: not found"
}
]
}{
"errors": [
{
"code": "10021",
"title": "Resource conflict",
"detail": "network_route b6a10cb9-2d4e-4f61-9a3b-7e5c8d1f0a26 was installed by an attachment (wireguard_interface on network 91446ee3-5b1c-4f0e-8d2a-6c7e9b0a1f24); it is read-only and is removed with the attachment"
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}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
});
await client.networkRoutes.delete('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
)
client.network_routes.delete(
"id",
)
package main
import (
"context"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.NetworkRoutes.Delete(
context.TODO(),
"id",
)
if err != nil {
panic(err.Error())
}
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
client.networkRoutes().delete("id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
response = telnyx.network_routes.delete("id")
puts(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 {
$response = $client->networkRoutes->delete(
'id',
);
var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx network-routes delete \
--api-key 'My API Key' \
--id e8a2c5d0-3f7b-4a19-b6d2-9c1e0f8a7b53curl --request DELETE \
--url https://api.telnyx.com/v2/network_routes/{id} \
--header 'Authorization: Bearer <token>'{
"errors": [
{
"code": "10020",
"title": "Resource not found",
"detail": "get route: not found"
}
]
}{
"errors": [
{
"code": "10021",
"title": "Resource conflict",
"detail": "network_route b6a10cb9-2d4e-4f61-9a3b-7e5c8d1f0a26 was installed by an attachment (wireguard_interface on network 91446ee3-5b1c-4f0e-8d2a-6c7e9b0a1f24); it is read-only and is removed with the attachment"
}
]
}{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}