Update a policy
Changes a policy, which publishes a new version of it. A field left out stays as it is; guardrails and pipeline are replaced whole, and model: null removes the condition.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const AgentGatewayPolicy = await client.agentGateways.policies.update('instance_id', 'name', {
description: 'description',
});
console.log(AgentGatewayPolicy.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_policy = client.agent_gateways.policies.update(
instance_id="instance_id",
name="name",
description="description",
)
print(agent_gateway_policy.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"),
)
policy, err := client.AgentGateways.Policies.Update(
context.TODO(),
"instance_id",
"name",
telnyx.AgentGatewayPolicyUpdateParams{
Description: telnyx.String("description"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", policy.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.policies.PolicyUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
PolicyUpdateParams params = PolicyUpdateParams.builder()
.description("description")
.build();
var response = client.agentGateways().policies().update("instance_id", "name", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
agent_gateway_policy = telnyx.agent_gateways.policies.update("instance_id", "name", description: "description")
puts(agent_gateway_policy)<?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_policy = $client->agentGateways->policies->update(
'instance_id',
'name',
description: 'description',
);
var_dump($agent_gateway_policy);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways:policies update \
--api-key 'My API Key' \
--instance-id 32ce035d-3165-4031-b1a7-a7c0c259590a \
--name strict \
--description descriptioncurl --request PATCH \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/policies/{name} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Baseline plus a word check"
}
'{
"data": {
"name": "strict",
"description": "Baseline plus a word check",
"base": "baseline",
"guardrails": {
"add": [
"no-forbidden"
],
"remove": []
},
"model": "GLM-5.3.*",
"pipeline": null,
"created_at": "2026-11-02T12:58:55.140000Z",
"updated_at": "2026-11-02T12:58:55.178000Z"
}
}{
"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": "10027",
"title": "Unprocessable Entity",
"detail": "Extra inputs are not permitted",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10027"
},
"source": {
"pointer": "/name"
}
}
]
}Authorizations
Telnyx API key
Path Parameters
The Agent Gateway's id.
The policy's name.
Body
A field left out stays as it is. guardrails and pipeline are replaced whole, and model: null removes the condition. The name cannot change.
What the policy is for.
A policy this one builds on, by name. The policy starts with the base's guardrails.
The guardrails a policy adds to its base's, and the ones it removes from them, by name.
Show child attributes
Show child attributes
A condition on the model, by name or regular expression. The policy's guardrails run only on requests for a matching model. null matches every model.
Ordered steps, in place of the guardrails running independently.
Show child attributes
Show child attributes
Response
The updated policy
A named set of guardrails.
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 AgentGatewayPolicy = await client.agentGateways.policies.update('instance_id', 'name', {
description: 'description',
});
console.log(AgentGatewayPolicy.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_policy = client.agent_gateways.policies.update(
instance_id="instance_id",
name="name",
description="description",
)
print(agent_gateway_policy.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"),
)
policy, err := client.AgentGateways.Policies.Update(
context.TODO(),
"instance_id",
"name",
telnyx.AgentGatewayPolicyUpdateParams{
Description: telnyx.String("description"),
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", policy.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.policies.PolicyUpdateParams;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
PolicyUpdateParams params = PolicyUpdateParams.builder()
.description("description")
.build();
var response = client.agentGateways().policies().update("instance_id", "name", params);
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
agent_gateway_policy = telnyx.agent_gateways.policies.update("instance_id", "name", description: "description")
puts(agent_gateway_policy)<?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_policy = $client->agentGateways->policies->update(
'instance_id',
'name',
description: 'description',
);
var_dump($agent_gateway_policy);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways:policies update \
--api-key 'My API Key' \
--instance-id 32ce035d-3165-4031-b1a7-a7c0c259590a \
--name strict \
--description descriptioncurl --request PATCH \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/policies/{name} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"description": "Baseline plus a word check"
}
'{
"data": {
"name": "strict",
"description": "Baseline plus a word check",
"base": "baseline",
"guardrails": {
"add": [
"no-forbidden"
],
"remove": []
},
"model": "GLM-5.3.*",
"pipeline": null,
"created_at": "2026-11-02T12:58:55.140000Z",
"updated_at": "2026-11-02T12:58:55.178000Z"
}
}{
"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": "10027",
"title": "Unprocessable Entity",
"detail": "Extra inputs are not permitted",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10027"
},
"source": {
"pointer": "/name"
}
}
]
}