$npx -y skills add team-telnyx/ai --skill telnyx-numbers-config-curlConfigure phone number settings including caller ID, call forwarding, messaging enablement, and connection assignments. This skill provides REST API (curl) examples.
| 1 | <!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. --> |
| 2 | |
| 3 | # Telnyx Numbers Config - curl |
| 4 | |
| 5 | ## Installation |
| 6 | |
| 7 | ```text |
| 8 | # curl is pre-installed on macOS, Linux, and Windows 10+ |
| 9 | ``` |
| 10 | |
| 11 | ## Setup |
| 12 | |
| 13 | ```bash |
| 14 | export TELNYX_API_KEY="YOUR_API_KEY_HERE" |
| 15 | ``` |
| 16 | |
| 17 | All examples below use `$TELNYX_API_KEY` for authentication. |
| 18 | |
| 19 | ## Error Handling |
| 20 | |
| 21 | All API calls can fail with network errors, rate limits (429), validation errors (422), |
| 22 | or authentication errors (401). Always handle errors in production code: |
| 23 | |
| 24 | ```bash |
| 25 | # Check HTTP status code in response |
| 26 | response=$(curl -s -w "\n%{http_code}" \ |
| 27 | -X POST "https://api.telnyx.com/v2/messages" \ |
| 28 | -H "Authorization: Bearer $TELNYX_API_KEY" \ |
| 29 | -H "Content-Type: application/json" \ |
| 30 | -d '{"to": "+13125550001", "from": "+13125550002", "text": "Hello"}') |
| 31 | |
| 32 | http_code=$(echo "$response" | tail -1) |
| 33 | body=$(echo "$response" | sed '$d') |
| 34 | |
| 35 | case $http_code in |
| 36 | 2*) echo "Success: $body" ;; |
| 37 | 422) echo "Validation error — check required fields and formats" ;; |
| 38 | 429) echo "Rate limited — retry after delay"; sleep 1 ;; |
| 39 | 401) echo "Authentication failed — check TELNYX_API_KEY" ;; |
| 40 | *) echo "Error $http_code: $body" ;; |
| 41 | esac |
| 42 | ``` |
| 43 | |
| 44 | Common error codes: `401` invalid API key, `403` insufficient permissions, |
| 45 | `404` resource not found, `422` validation error (check field formats), |
| 46 | `429` rate limited (retry with exponential backoff). |
| 47 | |
| 48 | ## Important Notes |
| 49 | |
| 50 | - **Phone numbers** must be in E.164 format (e.g., `+13125550001`). Include the `+` prefix and country code. No spaces, dashes, or parentheses. |
| 51 | - **Pagination:** List endpoints return paginated results. Use `page[number]` and `page[size]` query parameters to navigate pages. Check `meta.total_pages` in the response. |
| 52 | |
| 53 | ## Bulk update phone number profiles |
| 54 | |
| 55 | `POST /messaging_numbers_bulk_updates` — Required: `messaging_profile_id`, `numbers` |
| 56 | |
| 57 | Optional: `assign_only` (boolean) |
| 58 | |
| 59 | ```bash |
| 60 | curl \ |
| 61 | -X POST \ |
| 62 | -H "Authorization: Bearer $TELNYX_API_KEY" \ |
| 63 | -H "Content-Type: application/json" \ |
| 64 | -d '{ |
| 65 | "messaging_profile_id": "550e8400-e29b-41d4-a716-446655440000", |
| 66 | "numbers": [ |
| 67 | "+13125550001" |
| 68 | ] |
| 69 | }' \ |
| 70 | "https://api.telnyx.com/v2/messaging_numbers_bulk_updates" |
| 71 | ``` |
| 72 | |
| 73 | Returns: `failed` (array[string]), `order_id` (uuid), `pending` (array[string]), `record_type` (enum: messaging_numbers_bulk_update), `success` (array[string]) |
| 74 | |
| 75 | ## Retrieve bulk update status |
| 76 | |
| 77 | `GET /messaging_numbers_bulk_updates/{order_id}` |
| 78 | |
| 79 | ```bash |
| 80 | curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/messaging_numbers_bulk_updates/{order_id}" |
| 81 | ``` |
| 82 | |
| 83 | Returns: `failed` (array[string]), `order_id` (uuid), `pending` (array[string]), `record_type` (enum: messaging_numbers_bulk_update), `success` (array[string]) |
| 84 | |
| 85 | ## List mobile phone numbers with messaging settings |
| 86 | |
| 87 | `GET /mobile_phone_numbers/messaging` |
| 88 | |
| 89 | ```bash |
| 90 | curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/mobile_phone_numbers/messaging" |
| 91 | ``` |
| 92 | |
| 93 | Returns: `country_code` (string), `created_at` (date-time), `features` (object), `id` (string), `messaging_product` (string), `messaging_profile_id` (string | null), `organization_id` (string), `phone_number` (string), `record_type` (enum: messaging_phone_number, messaging_settings), `tags` (array[string]), `traffic_type` (string), `type` (enum: longcode), `updated_at` (date-time) |
| 94 | |
| 95 | ## Retrieve a mobile phone number with messaging settings |
| 96 | |
| 97 | `GET /mobile_phone_numbers/{id}/messaging` |
| 98 | |
| 99 | ```bash |
| 100 | curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/mobile_phone_numbers/550e8400-e29b-41d4-a716-446655440000/messaging" |
| 101 | ``` |
| 102 | |
| 103 | Returns: `country_code` (string), `created_at` (date-time), `features` (object), `id` (string), `messaging_product` (string), `messaging_profile_id` (string | null), `organization_id` (string), `phone_number` (string), `record_type` (enum: messaging_phone_number, messaging_settings), `tags` (array[string]), `traffic_type` (string), `type` (enum: longcode), `updated_at` (date-time) |
| 104 | |
| 105 | ## List phone numbers |
| 106 | |
| 107 | `GET /phone_numbers` |
| 108 | |
| 109 | ```bash |
| 110 | curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/phone_numbers?sort=connection_name&handle_messaging_profile_error=false" |
| 111 | ``` |
| 112 | |
| 113 | Returns: `billing_group_id` (string | null), `call_forwarding_enabled` (boolean), `call_recording_enabled` (boolean), `caller_id_name_enabled` (boolean), `cnam_listing_enabled` (boolean), `connection_id` (string | null), `connection_name` (string | null), `country_iso_alpha2` (string), `created_at` (date-time), `customer_reference` (string | null), `deletion_lock_enabled` (boolean), `emergency_address_id` (string | null), `emergency_enabled` (boolean), `emergency_status` (enum: active, deprovisioning, disabled, prov |