Create an Agent Gateway
Creates an Agent Gateway instance on one of the account’s WireGuard Interfaces. The instance starts pending, moves to provisioning, and then to ready or failed. It joins the WireGuard Interface as a peer named agw-<instance id>, and its gateway_url is set when it is ready.
POST
/
agent_gateways
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const AgentGateway = await client.agentGateways.create({
wireguard_interface_id: 'wireguard_interface_id',
});
console.log(AgentGateway.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
)
agent_gateway = client.agent_gateways.create(
wireguard_interface_id="wireguard_interface_id",
)
print(agent_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"),
)
agentGateway, err := client.AgentGateways.New(
context.TODO(),
telnyx.AgentGatewayNewParams{
WireguardInterfaceID: "wireguard_interface_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", agentGateway.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.agentGateways.AgentGatewayCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
AgentGatewayCreateParams params = AgentGatewayCreateParams.builder()
.wireguardInterfaceId("wireguard_interface_id")
.build();
var response = client.agentGateways().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
agent_gateway = telnyx.agent_gateways.create(wireguard_interface_id: "wireguard_interface_id")
puts(agent_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 {
$agent_gateway = $client->agentGateways->create(
wireguard_interface_id: 'wireguard_interface_id',
);
var_dump($agent_gateway);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways create \
--api-key 'My API Key' \
--wireguard-interface-id wireguard_interface_idcurl --request POST \
--url https://api.telnyx.com/v2/agent_gateways \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "support-gw",
"wireguard_interface_id": "c788eb40-a4c0-4bf5-8f84-976027960f8e"
}
'{
"data": {
"id": "ecffdf4b-93ea-4a7b-8295-51dfd2077996",
"name": "support-gw",
"engine": "litellm",
"engine_version": "v1.105.1",
"status": "pending",
"gateway_url": null,
"wireguard_interface_id": "c788eb40-a4c0-4bf5-8f84-976027960f8e",
"network_id": "7ade8c3c-95a7-447b-92f2-c829f760159c",
"created_at": "2026-10-21T19:32:48.377714Z"
}
}{
"errors": [
{
"code": "10013",
"title": "Missing association",
"detail": "One of the associated fields does not exist.",
"source": {
"pointer": "/wireguard_interface_id"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10013"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10004",
"title": "Missing required parameter",
"detail": "Field required",
"source": {
"pointer": "/wireguard_interface_id"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10004"
}
}
]
}Authorizations
Telnyx API key
Body
application/json
Response
The instance, pending
An Agent Gateway instance on a WireGuard Interface.
Show child attributes
Show child attributes
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 AgentGateway = await client.agentGateways.create({
wireguard_interface_id: 'wireguard_interface_id',
});
console.log(AgentGateway.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
)
agent_gateway = client.agent_gateways.create(
wireguard_interface_id="wireguard_interface_id",
)
print(agent_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"),
)
agentGateway, err := client.AgentGateways.New(
context.TODO(),
telnyx.AgentGatewayNewParams{
WireguardInterfaceID: "wireguard_interface_id",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", agentGateway.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.agentGateways.AgentGatewayCreateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
AgentGatewayCreateParams params = AgentGatewayCreateParams.builder()
.wireguardInterfaceId("wireguard_interface_id")
.build();
var response = client.agentGateways().create(params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
agent_gateway = telnyx.agent_gateways.create(wireguard_interface_id: "wireguard_interface_id")
puts(agent_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 {
$agent_gateway = $client->agentGateways->create(
wireguard_interface_id: 'wireguard_interface_id',
);
var_dump($agent_gateway);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways create \
--api-key 'My API Key' \
--wireguard-interface-id wireguard_interface_idcurl --request POST \
--url https://api.telnyx.com/v2/agent_gateways \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "support-gw",
"wireguard_interface_id": "c788eb40-a4c0-4bf5-8f84-976027960f8e"
}
'{
"data": {
"id": "ecffdf4b-93ea-4a7b-8295-51dfd2077996",
"name": "support-gw",
"engine": "litellm",
"engine_version": "v1.105.1",
"status": "pending",
"gateway_url": null,
"wireguard_interface_id": "c788eb40-a4c0-4bf5-8f84-976027960f8e",
"network_id": "7ade8c3c-95a7-447b-92f2-c829f760159c",
"created_at": "2026-10-21T19:32:48.377714Z"
}
}{
"errors": [
{
"code": "10013",
"title": "Missing association",
"detail": "One of the associated fields does not exist.",
"source": {
"pointer": "/wireguard_interface_id"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10013"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "The required authentication headers were either invalid or not included in the request.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10004",
"title": "Missing required parameter",
"detail": "Field required",
"source": {
"pointer": "/wireguard_interface_id"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10004"
}
}
]
}