Retrieve a policy
Returns one policy, in its current version.
GET
/
agent_gateways
/
{instance_id}
/
policies
/
{name}
JavaScript
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.retrieve('instance_id', 'name');
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.retrieve(
"instance_id",
"name",
)
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.Get(
context.TODO(),
"instance_id",
"name",
)
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;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.agentGateways().policies().retrieve("instance_id", "name");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
agent_gateway_policy = telnyx.agent_gateways.policies.retrieve("instance_id", "name")
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->retrieve(
'instance_id',
'name',
);
var_dump($agent_gateway_policy);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways:policies retrieve \
--api-key 'My API Key' \
--instance-id 32ce035d-3165-4031-b1a7-a7c0c259590a \
--name strictcurl --request GET \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/policies/{name} \
--header 'Authorization: Bearer <token>'{
"data": {
"name": "strict",
"description": null,
"base": "baseline",
"guardrails": {
"add": [
"no-forbidden"
],
"remove": []
},
"model": "GLM-5.3.*",
"pipeline": null,
"created_at": "2026-11-02T12:58:54.285000Z",
"updated_at": "2026-11-02T12:58:54.285000Z"
}
}{
"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"
}
}
]
}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 AgentGatewayPolicy = await client.agentGateways.policies.retrieve('instance_id', 'name');
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.retrieve(
"instance_id",
"name",
)
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.Get(
context.TODO(),
"instance_id",
"name",
)
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;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
var response = client.agentGateways().policies().retrieve("instance_id", "name");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
agent_gateway_policy = telnyx.agent_gateways.policies.retrieve("instance_id", "name")
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->retrieve(
'instance_id',
'name',
);
var_dump($agent_gateway_policy);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways:policies retrieve \
--api-key 'My API Key' \
--instance-id 32ce035d-3165-4031-b1a7-a7c0c259590a \
--name strictcurl --request GET \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/policies/{name} \
--header 'Authorization: Bearer <token>'{
"data": {
"name": "strict",
"description": null,
"base": "baseline",
"guardrails": {
"add": [
"no-forbidden"
],
"remove": []
},
"model": "GLM-5.3.*",
"pipeline": null,
"created_at": "2026-11-02T12:58:54.285000Z",
"updated_at": "2026-11-02T12:58:54.285000Z"
}
}{
"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"
}
}
]
}