Telnyx Networking - JavaScript
SkillDev toolsConfigure private networks, WireGuard VPN gateways, internet gateways, and virtual cross connects. This skill provides JavaScript SDK examples.
Available today. Use it from your connected AI after setup.
No other account needed.
Connect ahel once, and every AI you use reads what you have installed.
Then ask your AI: use the Telnyx Networking - JavaScript skill
What this skill tells your AI
The instructions your AI receives, as published by team-telnyx/ai in skills/telnyx-networking-javascript/SKILL.md and read by ahel’s review.
Installation
npm install telnyx@6.74.2
Setup
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
All examples below assume client is already initialized as shown above.
Error Handling
All API calls can fail with network errors, rate limits (429), validation errors (422), or authentication errors (401). Always handle errors in production code:
try {
const result = await client.messages.send({ to: '+13125550001', from: '+13125550002', text: 'Hello' });
} catch (err) {
if (err instanceof Telnyx.APIConnectionError) {
console.error('Network error — check connectivity and retry');
} else if (err instanceof Telnyx.RateLimitError) {
// 429: rate limited — wait and retry with exponential backoff
const retryAfter = err.headers?.['retry-after'] || 1;
await new Promise(r => setTimeout(r, retryAfter * 1000));
} else if (err instanceof Telnyx.APIError) {
console.error(`API error ${err.status}: ${err.message}`);
if (err.status === 422) {
console.error('Validation error — check required fields and formats');
}
}
}
Common error codes: 401 invalid API key, 403 insufficient permissions,
404 resource not found, 422 validation error (check field formats),
429 rate limited (retry with exponential backoff).
Important Notes
- Pagination: List methods return an auto-paginating iterator. Use
for await (const item of result) { ... }to iterate through all pages automatically.
List all clusters
GET /ai/clusters
// Automatically fetches more pages as needed.
for await (const clusterListResponse of client.ai.clusters.list()) {
console.log(clusterListResponse.task_id);
}
Returns: bucket (string), created_at (date-time), finished_at (date-time), min_cluster_size (integer), min_subcluster_size (integer), status (enum: pending, starting, running, completed, failed), task_id (string)
Compute new clusters
Starts a background task to compute how the data in an embedded storage bucket is clustered. This helps identify common themes and patterns in the data.
POST /ai/clusters — Required: bucket
Optional: files (array[string]), min_cluster_size (integer), min_subcluster_size (integer), prefix (string)
const response = await client.ai.clusters.compute({ bucket: 'my-bucket' });
console.log(response.data);
Returns: task_id (string)
Fetch a cluster
GET /ai/clusters/{task_id}
const cluster = await client.ai.clusters.retrieve('task_id');
console.log(cluster.data);
Returns: bucket (string), clusters (array[object]), status (enum: pending, starting, running, completed, failed)
Delete a cluster
DELETE /ai/clusters/{task_id}
await client.ai.clusters.delete('task_id');
Fetch a cluster visualization
GET /ai/clusters/{task_id}/graph
const response = await client.ai.clusters.fetchGraph('task_id');
console.log(response);
const content = await response.blob();
console.log(content);
List Integrations
List all available integrations.
GET /ai/integrations
const integrations = await client.ai.integrations.list();
console.log(integrations.data);
Returns: available_tools (array[string]), description (string), display_name (string), id (string), logo_url (string), name (string), status (enum: disconnected, connected)
List User Integrations
List user setup integrations
GET /ai/integrations/connections
const connections = await client.ai.integrations.connections.list();
console.log(connections.data);
Returns: allowed_tools (array[string]), id (string), integration_id (string)
Get User Integration connection By Id
Get user setup integrations
GET /ai/integrations/connections/{user_connection_id}
const connection = await client.ai.integrations.connections.retrieve('user_connection_id');
console.log(connection.data);
Returns: allowed_tools (array[string]), id (string), integration_id (string)
Delete Integration Connection
Delete a specific integration connection.
DELETE /ai/integrations/connections/{user_connection_id}
await client.ai.integrations.connections.delete('user_connection_id');
List Integration By Id
Retrieve integration details
GET /ai/integrations/{integration_id}
const integration = await client.ai.integrations.retrieve('integration_id');
console.log(integration.id);
Returns: available_tools (array[string]), description (string), display_name (string), id (string), logo_url (string), name (string), status (enum: disconnected, connected)
List all Global IP Allowed Ports
GET /global_ip_allowed_ports
const globalIPAllowedPorts = await client.globalIPAllowedPorts.list();
console.log(globalIPAllowedPorts.data);
Returns: first_port (integer), id (uuid), last_port (integer), name (string), protocol_code (string), record_type (string)
Global IP Assignment Health Check Metrics
GET /global_ip_assignment_health
const globalIPAssignmentHealth = await client.globalIPAssignmentHealth.retrieve();
console.log(globalIPAssignmentHealth.data);
Returns: global_ip (object), global_ip_assignment (object), health (object), timestamp (date-time)
List all Global IP assignments
List all Global IP assignments.
GET /global_ip_assignments
// Automatically fetches more pages as needed.
for await (const globalIPAssignment of client.globalIPAssignments.list()) {
console.log(globalIPAssignment.id);
}
Returns: created_at (string), global_ip_id (uuid), id (uuid), is_announced (boolean), is_connected (boolean), is_in_maintenance (boolean), record_type (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string), wireguard_peer_id (uuid)
Create a Global IP assignment
Create a Global IP assignment.
POST /global_ip_assignments
Optional: created_at (string), global_ip_id (uuid), id (uuid), is_announced (boolean), is_connected (boolean), is_in_maintenance (boolean), record_type (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string), wireguard_peer_id (uuid)
const globalIPAssignment = await client.globalIPAssignments.create();
console.log(globalIPAssignment.data);
Returns: created_at (string), global_ip_id (uuid), id (uuid), is_announced (boolean), is_connected (boolean), is_in_maintenance (boolean), record_type (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string), wireguard_peer_id (uuid)
Retrieve a Global IP
Retrieve a Global IP assignment.
GET /global_ip_assignments/{id}
const globalIPAssignment = await client.globalIPAssignments.retrieve(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);
console.log(globalIPAssignment.data);
Returns: created_at (string), global_ip_id (uuid), id (uuid), is_announced (boolean), is_connected (boolean), is_in_maintenance (boolean), record_type (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string), wireguard_peer_id (uuid)
Update a Global IP assignment
Update a Global IP assignment.
PATCH /global_ip_assignments/{id}
Optional: created_at (string), global_ip_id (string), id (uuid), is_announced (boolean), is_connected (boolean), is_in_maintenance (boolean), record_type (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string), wireguard_peer_id (string)
const globalIPAssignment = await client.globalIPAssignments.update(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
{ globalIpAssignmentUpdateRequest: {} },
);
console.log(globalIPAssignment.data);
Returns: created_at (string), global_ip_id (uuid), id (uuid), is_announced (boolean), is_connected (boolean), is_in_maintenance (boolean), record_type (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string), wireguard_peer_id (uuid)
Delete a Global IP assignment
Delete a Global IP assignment.
DELETE /global_ip_assignments/{id}
const globalIPAssignment = await client.globalIPAssignments.delete(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);
console.log(globalIPAssignment.data);
Returns: created_at (string), global_ip_id (uuid), id (uuid), is_announced (boolean), is_connected (boolean), is_in_maintenance (boolean), record_type (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string), wireguard_peer_id (uuid)
Global IP Assignment Usage Metrics
GET /global_ip_assignments_usage
const globalIPAssignmentsUsage = await client.globalIPAssignmentsUsage.retrieve();
console.log(globalIPAssignmentsUsage.data);
Returns: global_ip (object), global_ip_assignment (object), received (object), timestamp (date-time), transmitted (object)
List all Global IP Health check types
List all Global IP Health check types.
GET /global_ip_health_check_types
const globalIPHealthCheckTypes = await client.globalIPHealthCheckTypes.list();
console.log(globalIPHealthCheckTypes.data);
Returns: health_check_params (object), health_check_type (string), record_type (string)
List all Global IP health checks
List all Global IP health checks.
GET /global_ip_health_checks
// Automatically fetches more pages as needed.
for await (const globalIPHealthCheckListResponse of client.globalIPHealthChecks.list()) {
console.log(globalIPHealthCheckListResponse);
}
Returns: created_at (string), global_ip_id (uuid), health_check_params (object), health_check_type (string), id (uuid), record_type (string), updated_at (string)
Create a Global IP health check
Create a Global IP health check.
POST /global_ip_health_checks
Optional: created_at (string), global_ip_id (uuid), health_check_params (object), health_check_type (string), id (uuid), record_type (string), updated_at (string)
const globalIPHealthCheck = await client.globalIPHealthChecks.create();
console.log(globalIPHealthCheck.data);
Returns: created_at (string), global_ip_id (uuid), health_check_params (object), health_check_type (string), id (uuid), record_type (string), updated_at (string)
Retrieve a Global IP health check
Retrieve a Global IP health check.
GET /global_ip_health_checks/{id}
const globalIPHealthCheck = await client.globalIPHealthChecks.retrieve(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);
console.log(globalIPHealthCheck.data);
Returns: created_at (string), global_ip_id (uuid), health_check_params (object), health_check_type (string), id (uuid), record_type (string), updated_at (string)
Delete a Global IP health check
Delete a Global IP health check.
DELETE /global_ip_health_checks/{id}
const globalIPHealthCheck = await client.globalIPHealthChecks.delete(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);
console.log(globalIPHealthCheck.data);
Returns: created_at (string), global_ip_id (uuid), health_check_params (object), health_check_type (string), id (uuid), record_type (string), updated_at (string)
Global IP Latency Metrics
GET /global_ip_latency
const globalIPLatency = await client.globalIPLatency.retrieve();
console.log(globalIPLatency.data);
Returns: global_ip (object), mean_latency (object), percentile_latency (object), prober_location (object), timestamp (date-time)
List all Global IP Protocols
GET /global_ip_protocols
const globalIPProtocols = await client.globalIPProtocols.list();
console.log(globalIPProtocols.data);
Returns: code (string), name (string), record_type (string)
Global IP Usage Metrics
GET /global_ip_usage
const globalIPUsage = await client.globalIPUsage.retrieve();
console.log(globalIPUsage.data);
Returns: global_ip (object), received (object), timestamp (date-time), transmitted (object)
List all Global IPs
List all Global IPs.
GET /global_ips
// Automatically fetches more pages as needed.
for await (const globalIPListResponse of client.globalIPs.list()) {
console.log(globalIPListResponse);
}
Returns: created_at (string), description (string), id (uuid), ip_address (string), name (string), ports (object), record_type (string), updated_at (string)
Create a Global IP
Create a Global IP.
POST /global_ips
Optional: created_at (string), description (string), id (uuid), ip_address (string), name (string), ports (object), record_type (string), updated_at (string)
const globalIP = await client.globalIPs.create();
console.log(globalIP.data);
Returns: created_at (string), description (string), id (uuid), ip_address (string), name (string), ports (object), record_type (string), updated_at (string)
Retrieve a Global IP
Retrieve a Global IP.
GET /global_ips/{id}
const globalIP = await client.globalIPs.retrieve('6a09cdc3-8948-47f0-aa62-74ac943d6c58');
console.log(globalIP.data);
Returns: created_at (string), description (string), id (uuid), ip_address (string), name (string), ports (object), record_type (string), updated_at (string)
Delete a Global IP
Delete a Global IP.
DELETE /global_ips/{id}
const globalIP = await client.globalIPs.delete('6a09cdc3-8948-47f0-aa62-74ac943d6c58');
console.log(globalIP.data);
Returns: created_at (string), description (string), id (uuid), ip_address (string), name (string), ports (object), record_type (string), updated_at (string)
List all Networks
List all Networks.
GET /networks
// Automatically fetches more pages as needed.
for await (const networkListResponse of client.networks.list()) {
console.log(networkListResponse);
}
Returns: created_at (string), id (uuid), name (string), record_type (string), updated_at (string)
Create a Network
Create a new Network.
POST /networks — Required: name
Optional: created_at (string), id (uuid), record_type (string), updated_at (string)
const network = await client.networks.create({ name: 'test network' });
console.log(network.data);
Returns: created_at (string), id (uuid), name (string), record_type (string), updated_at (string)
Retrieve a Network
Retrieve a Network.
GET /networks/{id}
const network = await client.networks.retrieve('6a09cdc3-8948-47f0-aa62-74ac943d6c58');
console.log(network.data);
Returns: created_at (string), id (uuid), name (string), record_type (string), updated_at (string)
Update a Network
Update a Network.
PATCH /networks/{id} — Required: name
Optional: created_at (string), id (uuid), record_type (string), updated_at (string)
const network = await client.networks.update('6a09cdc3-8948-47f0-aa62-74ac943d6c58', {
name: 'test network',
});
console.log(network.data);
Returns: created_at (string), id (uuid), name (string), record_type (string), updated_at (string)
Delete a Network
Delete a Network.
DELETE /networks/{id}
const network = await client.networks.delete('6a09cdc3-8948-47f0-aa62-74ac943d6c58');
console.log(network.data);
Returns: created_at (string), id (uuid), name (string), record_type (string), updated_at (string)
Get Default Gateway status.
GET /networks/{id}/default_gateway
const defaultGateway = await client.networks.defaultGateway.retrieve(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);
console.log(defaultGateway.data);
Returns: created_at (string), id (uuid), network_id (uuid), record_type (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string), wireguard_peer_id (uuid)
Create Default Gateway.
POST /networks/{id}/default_gateway
Optional: created_at (string), id (uuid), network_id (uuid), record_type (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string), wireguard_peer_id (uuid)
const defaultGateway = await client.networks.defaultGateway.create(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);
console.log(defaultGateway.data);
Returns: created_at (string), id (uuid), network_id (uuid), record_type (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string), wireguard_peer_id (uuid)
Delete Default Gateway.
DELETE /networks/{id}/default_gateway
const defaultGateway = await client.networks.defaultGateway.delete(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);
console.log(defaultGateway.data);
Returns: created_at (string), id (uuid), network_id (uuid), record_type (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string), wireguard_peer_id (uuid)
List all Interfaces for a Network.
GET /networks/{id}/network_interfaces
// Automatically fetches more pages as needed.
for await (const networkListInterfacesResponse of client.networks.listInterfaces(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
)) {
console.log(networkListInterfacesResponse);
}
Returns: created_at (string), id (uuid), name (string), network_id (uuid), record_type (string), region (object), region_code (string), status (enum: created, provisioning, provisioned, deleting), type (string), updated_at (string)
Get all Private Wireless Gateways
Get all Private Wireless Gateways belonging to the user.
GET /private_wireless_gateways
// Automatically fetches more pages as needed.
for await (const privateWirelessGateway of client.privateWirelessGateways.list()) {
console.log(privateWirelessGateway.id);
}
Returns: assigned_resources (array[object]), created_at (string), id (uuid), ip_range (string), name (string), network_id (uuid), record_type (string), region_code (string), status (object), updated_at (string)
Create a Private Wireless Gateway
Asynchronously create a Private Wireless Gateway for SIM cards for a previously created network. This operation may take several minutes so you can check the Private Wireless Gateway status at the section Get a Private Wireless Gateway.
POST /private_wireless_gateways — Required: network_id, name
Optional: region_code (string)
const privateWirelessGateway = await client.privateWirelessGateways.create({
name: 'My private wireless gateway',
network_id: '6a09cdc3-8948-47f0-aa62-74ac943d6c58',
});
console.log(privateWirelessGateway.data);
Returns: assigned_resources (array[object]), created_at (string), id (uuid), ip_range (string), name (string), network_id (uuid), record_type (string), region_code (string), status (object), updated_at (string)
Get a Private Wireless Gateway
Retrieve information about a Private Wireless Gateway.
GET /private_wireless_gateways/{id}
const privateWirelessGateway = await client.privateWirelessGateways.retrieve(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);
console.log(privateWirelessGateway.data);
Returns: assigned_resources (array[object]), created_at (string), id (uuid), ip_range (string), name (string), network_id (uuid), record_type (string), region_code (string), status (object), updated_at (string)
Delete a Private Wireless Gateway
Deletes the Private Wireless Gateway.
DELETE /private_wireless_gateways/{id}
const privateWirelessGateway = await client.privateWirelessGateways.delete(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);
console.log(privateWirelessGateway.data);
Returns: assigned_resources (array[object]), created_at (string), id (uuid), ip_range (string), name (string), network_id (uuid), record_type (string), region_code (string), status (object), updated_at (string)
List all Public Internet Gateways
List all Public Internet Gateways.
GET /public_internet_gateways
// Automatically fetches more pages as needed.
for await (const publicInternetGatewayListResponse of client.publicInternetGateways.list()) {
console.log(publicInternetGatewayListResponse);
}
Returns: created_at (string), id (uuid), name (string), network_id (uuid), public_ip (string), record_type (string), region_code (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string)
Create a Public Internet Gateway
Create a new Public Internet Gateway.
POST /public_internet_gateways
Optional: created_at (string), id (uuid), name (string), network_id (uuid), public_ip (string), record_type (string), region_code (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string)
const publicInternetGateway = await client.publicInternetGateways.create();
console.log(publicInternetGateway.data);
Returns: created_at (string), id (uuid), name (string), network_id (uuid), public_ip (string), record_type (string), region_code (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string)
Retrieve a Public Internet Gateway
Retrieve a Public Internet Gateway.
GET /public_internet_gateways/{id}
const publicInternetGateway = await client.publicInternetGateways.retrieve(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);
console.log(publicInternetGateway.data);
Returns: created_at (string), id (uuid), name (string), network_id (uuid), public_ip (string), record_type (string), region_code (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string)
Delete a Public Internet Gateway
Delete a Public Internet Gateway.
DELETE /public_internet_gateways/{id}
const publicInternetGateway = await client.publicInternetGateways.delete(
'6a09cdc3-8948-47f0-aa62-74ac943d6c58',
);
console.log(publicInternetGateway.data);
Returns: created_at (string), id (uuid), name (string), network_id (uuid), public_ip (string), record_type (string), region_code (string), status (enum: created, provisioning, provisioned, deleting), updated_at (string)
List all Regions
List all regions and the interfaces that region supports
GET /regions
const regions = await client.regions.list();
console.log(regions.data);
Returns: code (string), created_at (string), name (string), record_type (string), supported_interfaces (array[string]), updated_at (string)
List all Virtual Cross Connects
List all Virtual Cross Connects.
GET /virtual_cross_connects
// Automatically fetches more pages as needed.
for await (const virtualCrossConnectListResponse of client.virtualCrossConnects.list()) {
console.log(virtualCrossConnectListResponse);
}
Shortened here. Read the whole file on GitHub.
Signals
- GitHub stars
- 214
- Forks
- 21
- Last commit
- Sep 2026
ahel review
K1binfo
installs-packages
Automated review, not a security audit. Ruleset v1+k2.
Advanced
- Catalog kind
- skill
- Gateway key
telnyx-networking-javascript- Source
- github.com/team-telnyx/ai