Delete a key
Revokes a key and returns it as it was, without its value. The instance must be ready; otherwise the request answers 409.
DELETE
/
agent_gateways
/
{instance_id}
/
keys
/
{key_id}
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
await client.agentGateways.keys.delete('instance_id', 'key_id');import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
client.agent_gateways.keys.delete(
"instance_id",
"key_id",
)
package main
import (
"context"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.AgentGateways.Keys.Delete(
context.TODO(),
"instance_id",
"key_id",
)
if err != nil {
panic(err.Error())
}
}
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();
client.agentGateways().keys().delete("instance_id", "key_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
agent_gateway_key = telnyx.agent_gateways.keys.delete("instance_id", "key_id")
puts(agent_gateway_key)<?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_key = $client->agentGateways->keys->delete(
'instance_id',
'key_id',
);
var_dump($agent_gateway_key);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways:keys delete \
--api-key 'My API Key' \
--instance-id ecffdf4b-93ea-4a7b-8295-51dfd2077996 \
--key-id 5f1c3a0e9b7d4c2a8e6f0b1d3c5a7e9f2b4d6c8a0e1f3a5c7e9b1d3f5a7c9e0bcurl --request DELETE \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/keys/{key_id} \
--header 'Authorization: Bearer <token>'{
"data": {
"id": "5f1c3a0e9b7d4c2a8e6f0b1d3c5a7e9f2b4d6c8a0e1f3a5c7e9b1d3f5a7c9e0b",
"name": "support-agent",
"team_id": "0b6c5d4e-3f2a-4b1c-9d8e-7f6a5b4c3d2e",
"models": [
"GLM-5.3-Flash"
],
"max_budget": 20,
"budget_resets_every": "30d",
"budget_resets_at": "2026-11-20T19:40:00Z",
"spend": 0,
"expires_at": null,
"created_at": "2026-10-21T19:40:00Z",
"blocked": false,
"requests_per_minute": 60,
"tokens_per_minute": null,
"max_parallel_requests": 4
}
}{
"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 revoked key
A key on an instance, without its value.
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
});
await client.agentGateways.keys.delete('instance_id', 'key_id');import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
client.agent_gateways.keys.delete(
"instance_id",
"key_id",
)
package main
import (
"context"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
err := client.AgentGateways.Keys.Delete(
context.TODO(),
"instance_id",
"key_id",
)
if err != nil {
panic(err.Error())
}
}
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();
client.agentGateways().keys().delete("instance_id", "key_id");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
agent_gateway_key = telnyx.agent_gateways.keys.delete("instance_id", "key_id")
puts(agent_gateway_key)<?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_key = $client->agentGateways->keys->delete(
'instance_id',
'key_id',
);
var_dump($agent_gateway_key);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx agent-gateways:keys delete \
--api-key 'My API Key' \
--instance-id ecffdf4b-93ea-4a7b-8295-51dfd2077996 \
--key-id 5f1c3a0e9b7d4c2a8e6f0b1d3c5a7e9f2b4d6c8a0e1f3a5c7e9b1d3f5a7c9e0bcurl --request DELETE \
--url https://api.telnyx.com/v2/agent_gateways/{instance_id}/keys/{key_id} \
--header 'Authorization: Bearer <token>'{
"data": {
"id": "5f1c3a0e9b7d4c2a8e6f0b1d3c5a7e9f2b4d6c8a0e1f3a5c7e9b1d3f5a7c9e0b",
"name": "support-agent",
"team_id": "0b6c5d4e-3f2a-4b1c-9d8e-7f6a5b4c3d2e",
"models": [
"GLM-5.3-Flash"
],
"max_budget": 20,
"budget_resets_every": "30d",
"budget_resets_at": "2026-11-20T19:40:00Z",
"spend": 0,
"expires_at": null,
"created_at": "2026-10-21T19:40:00Z",
"blocked": false,
"requests_per_minute": 60,
"tokens_per_minute": null,
"max_parallel_requests": 4
}
}{
"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."
}
]
}