Update an API
Changes an API’s settings. A field left out stays as it is, "base_url": null clears the base URL, and auth is replaced whole. The instance must be ready; otherwise the request answers 409.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const AgentGatewayApi = await client.agentGateways.apis.update('instance_id', 'api_id', {
name: 'name',
});
console.log(AgentGatewayApi.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_api = client.agent_gateways.apis.update(
instance_id="instance_id",
api_id="api_id",
name="name",
)
print(agent_gateway_api.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"),
)
aPI, err := client.AgentGateways.Apis.Update(
context.TODO(),
"instance_id",
"api_id",
telnyx.AgentGatewayAPIUpdateParams{
Name: telnyx.String("name"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", aPI.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.apis.ApiUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ApiUpdateParams params = ApiUpdateParams.builder()
.name("name")
.build();
var response = client.agentGateways().apis().update("instance_id", "api_id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
agent_gateway_api = telnyx.agent_gateways.apis.update("instance_id", "api_id", name: "name")
puts(agent_gateway_api)<?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_api = $client->agentGateways->apis->update(
'instance_id',
'api_id',
name: 'name',
);
var_dump($agent_gateway_api);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways:apis update \
--api-key 'My API Key' \
--instance-id 32ce035d-3165-4031-b1a7-a7c0c259590a \
--api-id dbe53cc0-bf7e-4f7a-8d84-752d19890eb3 \
--name namecurl --request PATCH \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/apis/{api_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tools": [
"findpetsbystatus",
"getpetbyid"
]
}
'{
"data": {
"id": "dbe53cc0-bf7e-4f7a-8d84-752d19890eb3",
"name": "petstore",
"spec_url": "https://petstore3.swagger.io/api/v3/openapi.json",
"base_url": "https://petstore3.swagger.io/api/v3",
"auth": {
"type": "none"
},
"tools": [
"findpetsbystatus",
"getpetbyid"
],
"static_headers": {},
"forwarded_headers": [],
"open_to_every_key": true,
"created_at": "2026-10-28T17:07:27.083000Z",
"updated_at": "2026-10-28T17:07:27.083000Z"
}
}{
"errors": [
{
"code": "10012",
"title": "Duplicate resource",
"detail": "Resource is a duplicate.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10012"
},
"source": {
"pointer": "/name"
}
}
]
}{
"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": "10005",
"title": "Resource not found",
"detail": "The requested resource or URL could not be found.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10005"
}
}
]
}{
"errors": [
{
"code": "99901",
"title": "Instance not ready",
"detail": "The instance is not ready; its engine is not running."
}
]
}{
"errors": [
{
"code": "10027",
"title": "Unprocessable Entity",
"detail": "The value is invalid.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10027"
},
"source": {
"pointer": "/spec_url"
}
}
]
}{
"errors": [
{
"code": "99903",
"title": "Engine unavailable",
"detail": "The instance's engine did not answer; try again shortly."
}
]
}Authorizations
Telnyx API key
Path Parameters
The Agent Gateway's id.
The API's id.
Body
The fields to change. A field left out stays as it is, and "base_url": null clears the base URL.
A name for the API, unique on the instance across MCP servers and APIs, regardless of case. Letters, digits, _, and .. The gateway prefixes the API's tools with it and a hyphen.
^[A-Za-z0-9_.]{1,100}$The URL of the API's OpenAPI description: OpenAPI 3.0, OpenAPI 3.1, or Swagger 2.0.
Where the gateway sends the API's requests. Without it, the gateway takes the description's first servers entry.
How the gateway authenticates to the API. AWS Signature Version 4 is for MCP servers only. Replaced whole on an update.
- No authentication
- API key
- OAuth client credentials
- Token passthrough
Show child attributes
Show child attributes
The operations the API exposes as tools, by tool name. [] exposes every operation.
Headers sent on every request.
Show child attributes
Show child attributes
Headers copied from the agent's request, by name.
32true lets every key on the instance use the server, granted or not.
Response
The updated API
Show child attributes
Show child attributes
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const AgentGatewayApi = await client.agentGateways.apis.update('instance_id', 'api_id', {
name: 'name',
});
console.log(AgentGatewayApi.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_api = client.agent_gateways.apis.update(
instance_id="instance_id",
api_id="api_id",
name="name",
)
print(agent_gateway_api.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"),
)
aPI, err := client.AgentGateways.Apis.Update(
context.TODO(),
"instance_id",
"api_id",
telnyx.AgentGatewayAPIUpdateParams{
Name: telnyx.String("name"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", aPI.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.apis.ApiUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
ApiUpdateParams params = ApiUpdateParams.builder()
.name("name")
.build();
var response = client.agentGateways().apis().update("instance_id", "api_id", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
agent_gateway_api = telnyx.agent_gateways.apis.update("instance_id", "api_id", name: "name")
puts(agent_gateway_api)<?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_api = $client->agentGateways->apis->update(
'instance_id',
'api_id',
name: 'name',
);
var_dump($agent_gateway_api);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways:apis update \
--api-key 'My API Key' \
--instance-id 32ce035d-3165-4031-b1a7-a7c0c259590a \
--api-id dbe53cc0-bf7e-4f7a-8d84-752d19890eb3 \
--name namecurl --request PATCH \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/apis/{api_id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"tools": [
"findpetsbystatus",
"getpetbyid"
]
}
'{
"data": {
"id": "dbe53cc0-bf7e-4f7a-8d84-752d19890eb3",
"name": "petstore",
"spec_url": "https://petstore3.swagger.io/api/v3/openapi.json",
"base_url": "https://petstore3.swagger.io/api/v3",
"auth": {
"type": "none"
},
"tools": [
"findpetsbystatus",
"getpetbyid"
],
"static_headers": {},
"forwarded_headers": [],
"open_to_every_key": true,
"created_at": "2026-10-28T17:07:27.083000Z",
"updated_at": "2026-10-28T17:07:27.083000Z"
}
}{
"errors": [
{
"code": "10012",
"title": "Duplicate resource",
"detail": "Resource is a duplicate.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10012"
},
"source": {
"pointer": "/name"
}
}
]
}{
"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": "10005",
"title": "Resource not found",
"detail": "The requested resource or URL could not be found.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10005"
}
}
]
}{
"errors": [
{
"code": "99901",
"title": "Instance not ready",
"detail": "The instance is not ready; its engine is not running."
}
]
}{
"errors": [
{
"code": "10027",
"title": "Unprocessable Entity",
"detail": "The value is invalid.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10027"
},
"source": {
"pointer": "/spec_url"
}
}
]
}{
"errors": [
{
"code": "99903",
"title": "Engine unavailable",
"detail": "The instance's engine did not answer; try again shortly."
}
]
}