Retrieve a key's tool permissions
Returns the MCP servers and APIs the key may use, and the tools within each. servers: [] means none. The instance must be ready; otherwise the request answers 409.
GET
/
agent_gateways
/
{instance_id}
/
keys
/
{key_id}
/
tool_permissions
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const response of client.agentGateways.keys.toolPermissions.list()) {
console.log(response);
}import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
page = client.agent_gateways.keys.tool_permissions.list(
"instance_id",
"key_id",
)
print(page.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"),
)
toolPermissions, err := client.AgentGateways.Keys.ToolPermissions.List(
context.TODO(),
"instance_id",
"key_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", toolPermissions.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 page = client.agentGateways().keys().toolPermissions().list("instance_id", "key_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
page = telnyx.agent_gateways.keys.tool_permissions.list("instance_id", "key_id")
puts(page)<?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 {
$page = $client->agentGateways->keys->toolPermissions->list(
'instance_id',
'key_id',
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways:keys:tool-permissions list \
--api-key 'My API Key' \
--instance-id 32ce035d-3165-4031-b1a7-a7c0c259590a \
--key-id f739ad190d29e2a5e658c3a486111953e6c18d746fd04374962ab150aae17757curl --request GET \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/keys/{key_id}/tool_permissions \
--header 'Authorization: Bearer <token>'{
"data": {
"servers": [
{
"id": "88d5a97b-4080-4855-8bac-a39811b1dc24",
"tools": [
"get_order"
]
}
]
}
}{
"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": "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 key's id, a 64-character hash the instance stores in place of the key.
Pattern:
^[0-9a-f]{64}$Response
The grant
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
});
// Automatically fetches more pages as needed.
for await (const response of client.agentGateways.keys.toolPermissions.list()) {
console.log(response);
}import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
page = client.agent_gateways.keys.tool_permissions.list(
"instance_id",
"key_id",
)
print(page.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"),
)
toolPermissions, err := client.AgentGateways.Keys.ToolPermissions.List(
context.TODO(),
"instance_id",
"key_id",
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", toolPermissions.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 page = client.agentGateways().keys().toolPermissions().list("instance_id", "key_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
page = telnyx.agent_gateways.keys.tool_permissions.list("instance_id", "key_id")
puts(page)<?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 {
$page = $client->agentGateways->keys->toolPermissions->list(
'instance_id',
'key_id',
);
var_dump($page);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways:keys:tool-permissions list \
--api-key 'My API Key' \
--instance-id 32ce035d-3165-4031-b1a7-a7c0c259590a \
--key-id f739ad190d29e2a5e658c3a486111953e6c18d746fd04374962ab150aae17757curl --request GET \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/keys/{key_id}/tool_permissions \
--header 'Authorization: Bearer <token>'{
"data": {
"servers": [
{
"id": "88d5a97b-4080-4855-8bac-a39811b1dc24",
"tools": [
"get_order"
]
}
]
}
}{
"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": "99903",
"title": "Engine unavailable",
"detail": "The instance's engine did not answer; try again shortly."
}
]
}