Check out our upcoming events and meetups! View events →
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const phoneNumberDetailed of client.phoneNumbers.list()) {
console.log(phoneNumberDetailed.id);
}{
"data": [
{
"id": "1293384261075731499",
"record_type": "phone_number",
"phone_number": "+19705555098",
"country_iso_alpha2": "US",
"status": "active",
"tags": [
"tag_1",
"tag_2"
],
"external_pin": "1234",
"connection_id": "1293384261075731499",
"connection_name": "connection-name",
"customer_reference": "customer-reference",
"messaging_profile_id": "abc85f64-5717-4562-b3fc-2c9600000000",
"messaging_profile_name": "regional-customers",
"billing_group_id": "86f58db9-0fe3-4adc-9d1f-46e66e6e9323",
"emergency_enabled": true,
"emergency_address_id": "1315261609962112019",
"emergency_status": "active",
"call_forwarding_enabled": true,
"cnam_listing_enabled": true,
"caller_id_name_enabled": true,
"call_recording_enabled": true,
"t38_fax_gateway_enabled": true,
"phone_number_type": "local",
"inbound_call_screening": "disabled",
"purchased_at": "2019-10-23T18:10:00.000Z",
"created_at": "2019-10-23T18:10:00.000Z",
"updated_at": "2019-10-24T18:10:00.000Z",
"hd_voice_enabled": true,
"source_type": "number_order",
"deletion_lock_enabled": false
}
],
"meta": {
"total_pages": 3,
"total_results": 55,
"page_number": 2,
"page_size": 25
},
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}Documentation Index
Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
Use this file to discover all available pages before exploring further.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Consolidated page parameter (deepObject style). Originally: page[size], page[number]
Show child attributes
Specifies the sort order for results. If not given, results are sorted by created_at in descending order.
purchased_at, phone_number, connection_name, usage_payment_method "connection_name"
Consolidated filter parameter (deepObject style). Originally: filter[tag], filter[phone_number], filter[status], filter[country_iso_alpha2], filter[connection_id], filter[voice.connection_name], filter[voice.usage_payment_method], filter[billing_group_id], filter[emergency_address_id], filter[customer_reference], filter[number_type], filter[source]
Show child attributes
Although it is an infrequent occurrence, due to the highly distributed nature of the Telnyx platform, it is possible that there will be an issue when loading in Messaging Profile information. As such, when this parameter is set to true and an error in fetching this information occurs, messaging profile related fields will be omitted in the response and an error message will be included instead of returning a 503 error.
true, false "false"
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
// Automatically fetches more pages as needed.
for await (const phoneNumberDetailed of client.phoneNumbers.list()) {
console.log(phoneNumberDetailed.id);
}{
"data": [
{
"id": "1293384261075731499",
"record_type": "phone_number",
"phone_number": "+19705555098",
"country_iso_alpha2": "US",
"status": "active",
"tags": [
"tag_1",
"tag_2"
],
"external_pin": "1234",
"connection_id": "1293384261075731499",
"connection_name": "connection-name",
"customer_reference": "customer-reference",
"messaging_profile_id": "abc85f64-5717-4562-b3fc-2c9600000000",
"messaging_profile_name": "regional-customers",
"billing_group_id": "86f58db9-0fe3-4adc-9d1f-46e66e6e9323",
"emergency_enabled": true,
"emergency_address_id": "1315261609962112019",
"emergency_status": "active",
"call_forwarding_enabled": true,
"cnam_listing_enabled": true,
"caller_id_name_enabled": true,
"call_recording_enabled": true,
"t38_fax_gateway_enabled": true,
"phone_number_type": "local",
"inbound_call_screening": "disabled",
"purchased_at": "2019-10-23T18:10:00.000Z",
"created_at": "2019-10-23T18:10:00.000Z",
"updated_at": "2019-10-24T18:10:00.000Z",
"hd_voice_enabled": true,
"source_type": "number_order",
"deletion_lock_enabled": false
}
],
"meta": {
"total_pages": 3,
"total_results": 55,
"page_number": 2,
"page_size": 25
},
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}