telnyx-numbers-javascript
Search, order, and manage phone numbers by location, features, and coverage.
Best use case
telnyx-numbers-javascript is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Search, order, and manage phone numbers by location, features, and coverage.
Teams using telnyx-numbers-javascript should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/telnyx-numbers-javascript/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How telnyx-numbers-javascript Compares
| Feature / Agent | telnyx-numbers-javascript | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Search, order, and manage phone numbers by location, features, and coverage.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
<!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. -->
# Telnyx Numbers - JavaScript
## Installation
```bash
npm install telnyx
```
## Setup
```javascript
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:
```javascript
try {
const availablePhoneNumbers = await client.availablePhoneNumbers.list();
} catch (err) {
if (err instanceof Telnyx.APIConnectionError) {
console.error('Network error — check connectivity and retry');
} else if (err instanceof Telnyx.RateLimitError) {
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
- **Phone numbers** must be in E.164 format (e.g., `+13125550001`). Include the `+` prefix and country code. No spaces, dashes, or parentheses.
- **Pagination:** List methods return an auto-paginating iterator. Use `for await (const item of result) { ... }` to iterate through all pages automatically.
## Reference Use Rules
Do not invent Telnyx parameters, enums, response fields, or webhook fields.
- If the parameter, enum, or response field you need is not shown inline in this skill, read [references/api-details.md](references/api-details.md) before writing code.
- Before using any operation in `## Additional Operations`, read [the optional-parameters section](references/api-details.md#optional-parameters) and [the response-schemas section](references/api-details.md#response-schemas).
## Core Tasks
### Search available phone numbers
Number search is the entrypoint for provisioning. Agents need the search method, key query filters, and the fields returned for candidate numbers.
`client.availablePhoneNumbers.list()` — `GET /available_phone_numbers`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `filter` | object | No | Consolidated filter parameter (deepObject style). |
```javascript
const availablePhoneNumbers = await client.availablePhoneNumbers.list();
console.log(availablePhoneNumbers.data);
```
Response wrapper:
- items: `availablePhoneNumbers.data`
- pagination: `availablePhoneNumbers.meta`
Primary item fields:
- `phoneNumber`
- `recordType`
- `quickship`
- `reservable`
- `bestEffort`
- `costInformation`
### Create a number order
Number ordering is the production provisioning step after number selection.
`client.numberOrders.create()` — `POST /number_orders`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `phoneNumbers` | array[object] | Yes | |
| `connectionId` | string (UUID) | No | Identifies the connection associated with this phone number. |
| `messagingProfileId` | string (UUID) | No | Identifies the messaging profile associated with the phone n... |
| `billingGroupId` | string (UUID) | No | Identifies the billing group associated with the phone numbe... |
| ... | | | +1 optional params in [references/api-details.md](references/api-details.md) |
```javascript
const numberOrder = await client.numberOrders.create({
phoneNumbers: [{"phone_number": "+18005550101"}],
});
console.log(numberOrder.data);
```
Primary response fields:
- `numberOrder.data.id`
- `numberOrder.data.status`
- `numberOrder.data.phoneNumbersCount`
- `numberOrder.data.requirementsMet`
- `numberOrder.data.messagingProfileId`
- `numberOrder.data.connectionId`
### Check number order status
Order status determines whether provisioning completed or additional requirements are still blocking fulfillment.
`client.numberOrders.retrieve()` — `GET /number_orders/{number_order_id}`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `numberOrderId` | string (UUID) | Yes | The number order ID. |
```javascript
const numberOrder = await client.numberOrders.retrieve('550e8400-e29b-41d4-a716-446655440000');
console.log(numberOrder.data);
```
Primary response fields:
- `numberOrder.data.id`
- `numberOrder.data.status`
- `numberOrder.data.requirementsMet`
- `numberOrder.data.phoneNumbersCount`
- `numberOrder.data.phoneNumbers`
- `numberOrder.data.connectionId`
---
## Important Supporting Operations
Use these when the core tasks above are close to your flow, but you need a common variation or follow-up step.
### Create a number reservation
Create or provision an additional resource when the core tasks do not cover this flow.
`client.numberReservations.create()` — `POST /number_reservations`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `phoneNumbers` | array[object] | Yes | |
| `status` | enum (pending, success, failure) | No | The status of the entire reservation. |
| `id` | string (UUID) | No | |
| `recordType` | string | No | |
| ... | | | +3 optional params in [references/api-details.md](references/api-details.md) |
```javascript
const numberReservation = await client.numberReservations.create({
phoneNumbers: [{"phone_number": "+18005550101"}],
});
console.log(numberReservation.data);
```
Primary response fields:
- `numberReservation.data.id`
- `numberReservation.data.status`
- `numberReservation.data.createdAt`
- `numberReservation.data.updatedAt`
- `numberReservation.data.customerReference`
- `numberReservation.data.errors`
### Retrieve a number reservation
Fetch the current state before updating, deleting, or making control-flow decisions.
`client.numberReservations.retrieve()` — `GET /number_reservations/{number_reservation_id}`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `numberReservationId` | string (UUID) | Yes | The number reservation ID. |
```javascript
const numberReservation = await client.numberReservations.retrieve('550e8400-e29b-41d4-a716-446655440000');
console.log(numberReservation.data);
```
Primary response fields:
- `numberReservation.data.id`
- `numberReservation.data.status`
- `numberReservation.data.createdAt`
- `numberReservation.data.updatedAt`
- `numberReservation.data.customerReference`
- `numberReservation.data.errors`
### List Advanced Orders
Inspect available resources or choose an existing resource before mutating it.
`client.advancedOrders.list()` — `GET /advanced_orders`
```javascript
const advancedOrders = await client.advancedOrders.list();
console.log(advancedOrders.data);
```
Response wrapper:
- items: `advancedOrders.data`
Primary item fields:
- `id`
- `status`
- `areaCode`
- `comments`
- `countryCode`
- `customerReference`
### Create Advanced Order
Create or provision an additional resource when the core tasks do not cover this flow.
`client.advancedOrders.create()` — `POST /advanced_orders`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `phoneNumberType` | enum (local, mobile, toll_free, shared_cost, national, ...) | No | |
| `requirementGroupId` | string (UUID) | No | The ID of the requirement group to associate with this advan... |
| `countryCode` | string (ISO 3166-1 alpha-2) | No | |
| ... | | | +5 optional params in [references/api-details.md](references/api-details.md) |
```javascript
const advancedOrder = await client.advancedOrders.create();
console.log(advancedOrder.id);
```
Primary response fields:
- `advancedOrder.id`
- `advancedOrder.status`
- `advancedOrder.areaCode`
- `advancedOrder.comments`
- `advancedOrder.countryCode`
- `advancedOrder.customerReference`
### Update Advanced Order
Modify an existing resource without recreating it.
`client.advancedOrders.updateRequirementGroup()` — `PATCH /advanced_orders/{advanced-order-id}/requirement_group`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `advanced-order-id` | string (UUID) | Yes | |
| `phoneNumberType` | enum (local, mobile, toll_free, shared_cost, national, ...) | No | |
| `requirementGroupId` | string (UUID) | No | The ID of the requirement group to associate with this advan... |
| `countryCode` | string (ISO 3166-1 alpha-2) | No | |
| ... | | | +5 optional params in [references/api-details.md](references/api-details.md) |
```javascript
const response = await client.advancedOrders.updateRequirementGroup(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);
console.log(response.id);
```
Primary response fields:
- `response.id`
- `response.status`
- `response.areaCode`
- `response.comments`
- `response.countryCode`
- `response.customerReference`
### Get Advanced Order
Fetch the current state before updating, deleting, or making control-flow decisions.
`client.advancedOrders.retrieve()` — `GET /advanced_orders/{order_id}`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `orderId` | string (UUID) | Yes | |
```javascript
const advancedOrder = await client.advancedOrders.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(advancedOrder.id);
```
Primary response fields:
- `advancedOrder.id`
- `advancedOrder.status`
- `advancedOrder.areaCode`
- `advancedOrder.comments`
- `advancedOrder.countryCode`
- `advancedOrder.customerReference`
### List available phone number blocks
Inspect available resources or choose an existing resource before mutating it.
`client.availablePhoneNumberBlocks.list()` — `GET /available_phone_number_blocks`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `filter` | object | No | Consolidated filter parameter (deepObject style). |
```javascript
const availablePhoneNumberBlocks = await client.availablePhoneNumberBlocks.list();
console.log(availablePhoneNumberBlocks.data);
```
Response wrapper:
- items: `availablePhoneNumberBlocks.data`
- pagination: `availablePhoneNumberBlocks.meta`
Primary item fields:
- `phoneNumber`
- `costInformation`
- `features`
- `range`
- `recordType`
- `regionInformation`
### Retrieve all comments
Inspect available resources or choose an existing resource before mutating it.
`client.comments.list()` — `GET /comments`
| Parameter | Type | Required | Description |
|-----------|------|----------|-------------|
| `filter` | object | No | Consolidated filter parameter (deepObject style). |
```javascript
const comments = await client.comments.list();
console.log(comments.data);
```
Response wrapper:
- items: `comments.data`
- pagination: `comments.meta`
Primary item fields:
- `id`
- `body`
- `createdAt`
- `updatedAt`
- `commentRecordId`
- `commentRecordType`
---
## Additional Operations
Use the core tasks above first. The operations below are indexed here with exact SDK methods and required params; use [references/api-details.md](references/api-details.md) for full optional params, response schemas, and lower-frequency webhook payloads.
Before using any operation below, read [the optional-parameters section](references/api-details.md#optional-parameters) and [the response-schemas section](references/api-details.md#response-schemas) so you do not guess missing fields.
| Operation | SDK method | Endpoint | Use when | Required params |
|-----------|------------|----------|----------|-----------------|
| Create a comment | `client.comments.create()` | `POST /comments` | Create or provision an additional resource when the core tasks do not cover this flow. | None |
| Retrieve a comment | `client.comments.retrieve()` | `GET /comments/{id}` | Fetch the current state before updating, deleting, or making control-flow decisions. | `id` |
| Mark a comment as read | `client.comments.markAsRead()` | `PATCH /comments/{id}/read` | Modify an existing resource without recreating it. | `id` |
| Get country coverage | `client.countryCoverage.retrieve()` | `GET /country_coverage` | Inspect available resources or choose an existing resource before mutating it. | None |
| Get coverage for a specific country | `client.countryCoverage.retrieveCountry()` | `GET /country_coverage/countries/{country_code}` | Fetch the current state before updating, deleting, or making control-flow decisions. | `countryCode` |
| List customer service records | `client.customerServiceRecords.list()` | `GET /customer_service_records` | Inspect available resources or choose an existing resource before mutating it. | None |
| Create a customer service record | `client.customerServiceRecords.create()` | `POST /customer_service_records` | Create or provision an additional resource when the core tasks do not cover this flow. | None |
| Verify CSR phone number coverage | `client.customerServiceRecords.verifyPhoneNumberCoverage()` | `POST /customer_service_records/phone_number_coverages` | Create or provision an additional resource when the core tasks do not cover this flow. | None |
| Get a customer service record | `client.customerServiceRecords.retrieve()` | `GET /customer_service_records/{customer_service_record_id}` | Fetch the current state before updating, deleting, or making control-flow decisions. | `customerServiceRecordId` |
| List inexplicit number orders | `client.inexplicitNumberOrders.list()` | `GET /inexplicit_number_orders` | Inspect available resources or choose an existing resource before mutating it. | None |
| Create an inexplicit number order | `client.inexplicitNumberOrders.create()` | `POST /inexplicit_number_orders` | Create or provision an additional resource when the core tasks do not cover this flow. | `orderingGroups` |
| Retrieve an inexplicit number order | `client.inexplicitNumberOrders.retrieve()` | `GET /inexplicit_number_orders/{id}` | Fetch the current state before updating, deleting, or making control-flow decisions. | `id` |
| Create an inventory coverage request | `client.inventoryCoverage.list()` | `GET /inventory_coverage` | Inspect available resources or choose an existing resource before mutating it. | None |
| List mobile network operators | `client.mobileNetworkOperators.list()` | `GET /mobile_network_operators` | Inspect available resources or choose an existing resource before mutating it. | None |
| List network coverage locations | `client.networkCoverage.list()` | `GET /network_coverage` | Inspect available resources or choose an existing resource before mutating it. | None |
| List number block orders | `client.numberBlockOrders.list()` | `GET /number_block_orders` | Inspect available resources or choose an existing resource before mutating it. | None |
| Create a number block order | `client.numberBlockOrders.create()` | `POST /number_block_orders` | Create or provision an additional resource when the core tasks do not cover this flow. | `startingNumber`, `range` |
| Retrieve a number block order | `client.numberBlockOrders.retrieve()` | `GET /number_block_orders/{number_block_order_id}` | Fetch the current state before updating, deleting, or making control-flow decisions. | `numberBlockOrderId` |
| Retrieve a list of phone numbers associated to orders | `client.numberOrderPhoneNumbers.list()` | `GET /number_order_phone_numbers` | Inspect available resources or choose an existing resource before mutating it. | None |
| Retrieve a single phone number within a number order. | `client.numberOrderPhoneNumbers.retrieve()` | `GET /number_order_phone_numbers/{number_order_phone_number_id}` | Fetch the current state before updating, deleting, or making control-flow decisions. | `numberOrderPhoneNumberId` |
| Update requirements for a single phone number within a number order. | `client.numberOrderPhoneNumbers.updateRequirements()` | `PATCH /number_order_phone_numbers/{number_order_phone_number_id}` | Modify an existing resource without recreating it. | `numberOrderPhoneNumberId` |
| List number orders | `client.numberOrders.list()` | `GET /number_orders` | Create or inspect provisioning orders for number purchases. | None |
| Update a number order | `client.numberOrders.update()` | `PATCH /number_orders/{number_order_id}` | Modify an existing resource without recreating it. | `numberOrderId` |
| List number reservations | `client.numberReservations.list()` | `GET /number_reservations` | Inspect available resources or choose an existing resource before mutating it. | None |
| Extend a number reservation | `client.numberReservations.actions.extend()` | `POST /number_reservations/{number_reservation_id}/actions/extend` | Trigger a follow-up action in an existing workflow rather than creating a new top-level resource. | `numberReservationId` |
| Retrieve the features for a list of numbers | `client.numbersFeatures.create()` | `POST /numbers_features` | Create or provision an additional resource when the core tasks do not cover this flow. | `phoneNumbers` |
| Lists the phone number blocks jobs | `client.phoneNumberBlocks.jobs.list()` | `GET /phone_number_blocks/jobs` | Inspect available resources or choose an existing resource before mutating it. | None |
| Deletes all numbers associated with a phone number block | `client.phoneNumberBlocks.jobs.deletePhoneNumberBlock()` | `POST /phone_number_blocks/jobs/delete_phone_number_block` | Create or provision an additional resource when the core tasks do not cover this flow. | `phoneNumberBlockId` |
| Retrieves a phone number blocks job | `client.phoneNumberBlocks.jobs.retrieve()` | `GET /phone_number_blocks/jobs/{id}` | Fetch the current state before updating, deleting, or making control-flow decisions. | `id` |
| List sub number orders | `client.subNumberOrders.list()` | `GET /sub_number_orders` | Inspect available resources or choose an existing resource before mutating it. | None |
| Retrieve a sub number order | `client.subNumberOrders.retrieve()` | `GET /sub_number_orders/{sub_number_order_id}` | Fetch the current state before updating, deleting, or making control-flow decisions. | `subNumberOrderId` |
| Update a sub number order's requirements | `client.subNumberOrders.update()` | `PATCH /sub_number_orders/{sub_number_order_id}` | Modify an existing resource without recreating it. | `subNumberOrderId` |
| Cancel a sub number order | `client.subNumberOrders.cancel()` | `PATCH /sub_number_orders/{sub_number_order_id}/cancel` | Modify an existing resource without recreating it. | `subNumberOrderId` |
| Create a sub number orders report | `client.subNumberOrdersReport.create()` | `POST /sub_number_orders_report` | Create or provision an additional resource when the core tasks do not cover this flow. | None |
| Retrieve a sub number orders report | `client.subNumberOrdersReport.retrieve()` | `GET /sub_number_orders_report/{report_id}` | Fetch the current state before updating, deleting, or making control-flow decisions. | `reportId` |
| Download a sub number orders report | `client.subNumberOrdersReport.download()` | `GET /sub_number_orders_report/{report_id}/download` | Fetch the current state before updating, deleting, or making control-flow decisions. | `reportId` |
### Other Webhook Events
| Event | `data.event_type` | Description |
|-------|-------------------|-------------|
| `numberOrderStatusUpdate` | `number.order.status.update` | Number Order Status Update |
---
For exhaustive optional parameters, full response schemas, and complete webhook payloads, see [references/api-details.md](references/api-details.md).Related Skills
telnyx-whatsapp-ruby
Send WhatsApp messages, manage templates, WABAs, and phone numbers via the Telnyx WhatsApp Business API.
telnyx-whatsapp-python
Send WhatsApp messages, manage templates, WABAs, and phone numbers via the Telnyx WhatsApp Business API.
telnyx-whatsapp-javascript
Send WhatsApp messages, manage templates, WABAs, and phone numbers via the Telnyx WhatsApp Business API.
telnyx-whatsapp-java
Send WhatsApp messages, manage templates, WABAs, and phone numbers via the Telnyx WhatsApp Business API.
telnyx-whatsapp-go
Send WhatsApp messages, manage templates, WABAs, and phone numbers via the Telnyx WhatsApp Business API.
telnyx-whatsapp-curl
Send WhatsApp messages, manage templates, WABAs, and phone numbers via the Telnyx WhatsApp Business API.
telnyx-webrtc-ruby
Manage WebRTC credentials and mobile push notification settings. Use when building browser-based or mobile softphone applications. This skill provides Ruby SDK examples.
telnyx-webrtc-python
Manage WebRTC credentials and mobile push notification settings. Use when building browser-based or mobile softphone applications. This skill provides Python SDK examples.
telnyx-webrtc-javascript
Manage WebRTC credentials and mobile push notification settings. Use when building browser-based or mobile softphone applications. This skill provides JavaScript SDK examples.
telnyx-webrtc-java
Manage WebRTC credentials and mobile push notification settings. Use when building browser-based or mobile softphone applications. This skill provides Java SDK examples.
telnyx-webrtc-go
Manage WebRTC credentials and mobile push notification settings. Use when building browser-based or mobile softphone applications. This skill provides Go SDK examples.
telnyx-webrtc-curl
Manage WebRTC credentials and mobile push notification settings. Use when building browser-based or mobile softphone applications. This skill provides REST API (curl) examples.