$npx -y skills add team-telnyx/ai --skill telnyx-numbers-compliance-curlManage regulatory requirements, number bundles, supporting documents, and verified numbers for compliance. This skill provides REST API (curl) examples.
| 1 | <!-- Auto-generated from Telnyx OpenAPI specs. Do not edit. --> |
| 2 | |
| 3 | # Telnyx Numbers Compliance - 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 | ## Retrieve Bundles |
| 54 | |
| 55 | Get all allowed bundles. |
| 56 | |
| 57 | `GET /bundle_pricing/billing_bundles` |
| 58 | |
| 59 | ```bash |
| 60 | curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/billing_bundles" |
| 61 | ``` |
| 62 | |
| 63 | Returns: `cost_code` (string), `created_at` (date), `currency` (string), `id` (uuid), `is_public` (boolean), `mrc_price` (float), `name` (string), `slug` (string), `specs` (array[string]) |
| 64 | |
| 65 | ## Get Bundle By Id |
| 66 | |
| 67 | Get a single bundle by ID. |
| 68 | |
| 69 | `GET /bundle_pricing/billing_bundles/{bundle_id}` |
| 70 | |
| 71 | ```bash |
| 72 | curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/billing_bundles/8661948c-a386-4385-837f-af00f40f111a" |
| 73 | ``` |
| 74 | |
| 75 | Returns: `active` (boolean), `bundle_limits` (array[object]), `cost_code` (string), `created_at` (date), `id` (uuid), `is_public` (boolean), `name` (string), `slug` (string) |
| 76 | |
| 77 | ## Get User Bundles |
| 78 | |
| 79 | Get a paginated list of user bundles. |
| 80 | |
| 81 | `GET /bundle_pricing/user_bundles` |
| 82 | |
| 83 | ```bash |
| 84 | curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/user_bundles" |
| 85 | ``` |
| 86 | |
| 87 | Returns: `active` (boolean), `billing_bundle` (object), `created_at` (date), `id` (uuid), `resources` (array[object]), `updated_at` (date), `user_id` (uuid) |
| 88 | |
| 89 | ## Create User Bundles |
| 90 | |
| 91 | Creates multiple user bundles for the user. |
| 92 | |
| 93 | `POST /bundle_pricing/user_bundles/bulk` |
| 94 | |
| 95 | Optional: `idempotency_key` (uuid), `items` (array[object]) |
| 96 | |
| 97 | ```bash |
| 98 | curl \ |
| 99 | -X POST \ |
| 100 | -H "Authorization: Bearer $TELNYX_API_KEY" \ |
| 101 | -H "Content-Type: application/json" \ |
| 102 | "https://api.telnyx.com/v2/bundle_pricing/user_bundles/bulk" |
| 103 | ``` |
| 104 | |
| 105 | Returns: `active` (boolean), `billing_bundle` (object), `created_at` (date), `id` (uuid), `resources` (array[object]), `updated_at` (date), `user_id` (uuid) |
| 106 | |
| 107 | ## Get Unused User Bundles |
| 108 | |
| 109 | Returns all user bundles that aren't in use. |
| 110 | |
| 111 | `GET /bundle_pricing/user_bundles/unused` |
| 112 | |
| 113 | ```bash |
| 114 | curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/user_bundles/unused" |
| 115 | ``` |
| 116 | |
| 117 | Returns: `billing_bundle` (object), `user_bundle_ids` (array[string]) |
| 118 | |
| 119 | ## Get User Bundle by Id |
| 120 | |
| 121 | Retrieves a user bundle by its ID. |
| 122 | |
| 123 | `GET /bundle_pricing/user_bundles/{user_bundle_id}` |
| 124 | |
| 125 | ```bash |
| 126 | curl -H "Authorization: Bearer $TELNYX_API_KEY" "https://api.telnyx.com/v2/bundle_pricing/user_bundles/ca1d2263-d1f1-43ac-ba53-248e7a4bb26a" |
| 127 | ``` |
| 128 | |
| 129 | Returns: `active` (boolean), `billing_bundle` (object), `created_at` (date), `id` (uuid), `resources` (array[object]), `updated_at` (date), `user_id` (uuid) |
| 130 | |
| 131 | ## Deactivate User Bundle |
| 132 | |
| 133 | Deactivates a user bundle by its ID. |
| 134 | |
| 135 | `DELETE /bundle_pricing/user_bundles/{user_bundle_id}` |
| 136 | |
| 137 | ```bash |
| 138 | curl \ |
| 139 | -X DELETE \ |
| 140 | -H "Authorization: Bearer $TELNYX_API_KEY" \ |
| 141 | "https://api.telnyx.com/v2/bundle_pricing/user_bundles/ca1d2263-d1f1-43ac-ba53-248e7a4bb26a" |
| 142 | ``` |
| 143 | |
| 144 | Returns: `active` (boolean), `billing_bundle` (object), `created_at` (date), `id` (uuid), `resources` (array[object]), `updated_at` (date), `user_id` (uuid) |
| 145 | |
| 146 | ## Get User Bundle Resources |
| 147 | |
| 148 | Retrieves the resources of a u |