import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const response = await client.phoneNumbers.jobs.updateBatch({
phone_numbers: ['1583466971586889004', '+13127367254'],
});
console.log(response.data);{
"data": {
"id": "42587e44-3a3e-46de-9255-0c9a7a1d1ec7",
"record_type": "phone_numbers_job",
"status": "pending",
"type": "update_emergency_settings",
"etc": "2020-10-30T18:10:00.000Z",
"created_at": "2020-10-23T18:10:00.000Z",
"updated_at": "2020-10-23T18:10:01.000Z",
"phone_numbers": [
{
"id": "2637816387126861836"
},
{
"phone_number": "+19715555098"
},
{
"phone_number": "+19705555099"
},
{
"id": "3388768018273"
}
],
"successful_operations": [
{
"id": "2637816387126861836",
"phone_number": "+19705555098"
},
{
"id": "33081887126861836",
"phone_number": "+19715555098"
}
],
"pending_operations": [
{
"id": "2637816387126861837",
"phone_number": "+19705555099"
}
],
"failed_operations": [
{
"id": "3388768018273",
"phone_number": "+19705551234",
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The field is invalid.",
"source": {
"pointer": "/emergency_address_id"
}
}
]
}
]
}
}Creates a new background job to update a batch of numbers. At most one thousand numbers can be updated per API call. At least one of the updateable fields must be submitted. IMPORTANT: You must either specify filters (using the filter parameters) or specific phone numbers (using the phone_numbers parameter in the request body). If you specify filters, ALL phone numbers that match the given filters (up to 1000 at a time) will be updated. If you want to update only specific numbers, you must use the phone_numbers parameter in the request body. When using the phone_numbers parameter, ensure you follow the correct format as shown in the example (either phone number IDs or phone numbers in E164 format).
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const response = await client.phoneNumbers.jobs.updateBatch({
phone_numbers: ['1583466971586889004', '+13127367254'],
});
console.log(response.data);{
"data": {
"id": "42587e44-3a3e-46de-9255-0c9a7a1d1ec7",
"record_type": "phone_numbers_job",
"status": "pending",
"type": "update_emergency_settings",
"etc": "2020-10-30T18:10:00.000Z",
"created_at": "2020-10-23T18:10:00.000Z",
"updated_at": "2020-10-23T18:10:01.000Z",
"phone_numbers": [
{
"id": "2637816387126861836"
},
{
"phone_number": "+19715555098"
},
{
"phone_number": "+19705555099"
},
{
"id": "3388768018273"
}
],
"successful_operations": [
{
"id": "2637816387126861836",
"phone_number": "+19705555098"
},
{
"id": "33081887126861836",
"phone_number": "+19715555098"
}
],
"pending_operations": [
{
"id": "2637816387126861837",
"phone_number": "+19705555099"
}
],
"failed_operations": [
{
"id": "3388768018273",
"phone_number": "+19705551234",
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The field is invalid.",
"source": {
"pointer": "/emergency_address_id"
}
}
]
}
]
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Consolidated filter parameter (deepObject style). Originally: filter[has_bundle], filter[tag], filter[connection_id], filter[phone_number], filter[status], filter[voice.connection_name], filter[voice.usage_payment_method], filter[billing_group_id], filter[emergency_address_id], filter[customer_reference]
Show child attributes
Filter by phone number that have bundles.
Filter by phone number tags.
Filter by connection_id.
"1521916448077776306"
Filter by phone number. Requires at least three digits. Non-numerical characters will result in no values being returned.
Filter by phone number status.
purchase-pending, purchase-failed, port-pending, active, deleted, port-failed, emergency-only, ported-out, port-out-pending "active"
Filter by voice connection name pattern matching.
Show child attributes
Filter contains connection name. Requires at least three characters.
"test"
Filter starts with connection name. Requires at least three characters.
"test"
Filter ends with connection name. Requires at least three characters.
"test"
Filter by connection name.
"test"
Filter by usage_payment_method.
pay-per-minute, channel "channel"
Filter by the billing_group_id associated with phone numbers. To filter to only phone numbers that have no billing group associated them, set the value of this filter to the string 'null'.
"62e4bf2e-c278-4282-b524-488d9c9c43b2"
Filter by the emergency_address_id associated with phone numbers. To filter only phone numbers that have no emergency address associated with them, set the value of this filter to the string 'null'.
"9102160989215728032"
Filter numbers via the customer_reference set.
Array of phone number ids and/or phone numbers in E164 format to update. This parameter is required if no filter parameters are provided. If you want to update specific numbers rather than all numbers matching a filter, you must use this parameter. Each item must be either a valid phone number ID or a phone number in E164 format (e.g., '+13127367254').
A list of user-assigned tags to help organize phone numbers.
If someone attempts to port your phone number away from Telnyx and your phone number has an external PIN set, we will attempt to verify that you provided the correct external PIN to the winning carrier. Note that not all carriers cooperate with this security mechanism.
A customer reference string for customer look ups.
"MY REF 001"
Identifies the connection associated with the phone number.
Identifies the billing group associated with the phone number.
Indicates whether to enable or disable HD Voice on each phone number. HD Voice is a paid feature and may not be available for all phone numbers, more details about it can be found in the Telnyx support documentation.
Indicates whether to enable or disable the deletion lock on each phone number. When enabled, this prevents the phone number from being deleted via the API or Telnyx portal.
Show child attributes
Controls whether a tech prefix is enabled for this phone number.
This field allows you to rewrite the destination number of an inbound call before the call is routed to you. The value of this field may be any alphanumeric value, and the value will replace the number originally dialed.
Controls whether the caller ID name is enabled for this phone number.
The call forwarding settings for a phone number.
Show child attributes
Indicates if call forwarding will be enabled for this number if forwards_to and forwarding_type are filled in. Defaults to true for backwards compatibility with APIV1 use of numbers endpoints.
true
The phone number to which inbound calls to this number are forwarded. Inbound calls will not be forwarded if this field is left blank. If set, must be a +E.164-formatted phone number.
Call forwarding type. 'forwards_to' must be set for this to have an effect.
always, on-failure "always"
{
"call_forwarding_enabled": true,
"forwards_to": "+13035559123",
"forwarding_type": "always"
}The CNAM listing settings for a phone number.
Show child attributes
Enables CNAM listings for this number. Requires cnam_listing_details to also be set.
The CNAM listing details for this number. Must be alphanumeric characters or spaces with a maximum length of 15. Requires cnam_listing_enabled to also be set to true.
{
"cnam_listing_enabled": true,
"cnam_listing_details": "example"
}Controls whether a number is billed per minute or uses your concurrent channels.
pay-per-minute, channel The media features settings for a phone number.
Show child attributes
When RTP Auto-Adjust is enabled, the destination RTP address port will be automatically changed to match the source of the incoming RTP packets.
When enabled, Telnyx will accept RTP packets from any customer-side IP address and port, not just those to which Telnyx is sending RTP.
Controls whether Telnyx will accept a T.38 re-INVITE for this phone number. Note that Telnyx will not send a T.38 re-INVITE; this option only controls whether one will be accepted.
{
"rtp_auto_adjust_enabled": true,
"accept_any_rtp_packets_enabled": true,
"t38_fax_gateway_enabled": true
}The call recording settings for a phone number.
Show child attributes
When enabled, any inbound call to this number will be recorded.
The audio file format for calls being recorded.
wav, mp3 When using 'dual' channels, final audio file will be stereo recorded with the first leg on channel A, and the rest on channel B.
single, dual {
"inbound_call_recording_enabled": true,
"inbound_call_recording_format": "wav",
"inbound_call_recording_channels": "single"
}The inbound_call_screening setting is a phone number configuration option variable that allows users to configure their settings to block or flag fraudulent calls. It can be set to disabled, reject_calls, or flag_calls. This feature has an additional per-number monthly cost associated with it.
disabled, reject_calls, flag_calls {
"tech_prefix_enabled": true,
"translated_number": "+13035559999",
"caller_id_name_enabled": true,
"call_forwarding": {
"call_forwarding_enabled": true,
"forwards_to": "+13035559123",
"forwarding_type": "always"
},
"cnam_listing": {
"cnam_listing_enabled": true,
"cnam_listing_details": "example"
},
"usage_payment_method": "pay-per-minute",
"media_features": {
"rtp_auto_adjust_enabled": true,
"accept_any_rtp_packets_enabled": true,
"t38_fax_gateway_enabled": true
},
"call_recording": {
"inbound_call_recording_enabled": true,
"inbound_call_recording_format": "wav",
"inbound_call_recording_channels": "single"
},
"inbound_call_screening": "disabled"
}Phone numbers job update phone numbers requested.
Show child attributes
Identifies the resource.
"42587e44-3a3e-46de-9255-0c9a7a1d1ec7"
Identifies the type of the resource.
"phone_numbers_job"
Indicates the completion status of the background update.
pending, in_progress, completed, failed, expired "pending"
Identifies the type of the background job.
update_emergency_settings, delete_phone_numbers, update_phone_numbers "update_emergency_settings"
ISO 8601 formatted date indicating when the estimated time of completion of the background job.
ISO 8601 formatted date indicating when the resource was created.
ISO 8601 formatted date indicating when the resource was updated.
Show child attributes
The phone number in e164 format.
The phone number's ID
Show child attributes
"10007"
"Unexpected error"
"An unexpected error occured."
{
"id": "42587e44-3a3e-46de-9255-0c9a7a1d1ec7",
"record_type": "phone_numbers_job",
"status": "pending",
"type": "update_emergency_settings",
"etc": "2020-10-30T18:10:00.000Z",
"created_at": "2020-10-23T18:10:00.000Z",
"updated_at": "2020-10-23T18:10:01.000Z",
"phone_numbers": [
{ "id": "2637816387126861836" },
{ "phone_number": "+19715555098" },
{ "phone_number": "+19705555099" },
{ "id": "3388768018273" }
],
"successful_operations": [
{
"id": "2637816387126861836",
"phone_number": "+19705555098"
},
{
"id": "33081887126861836",
"phone_number": "+19715555098"
}
],
"pending_operations": [
{
"id": "2637816387126861837",
"phone_number": "+19705555099"
}
],
"failed_operations": [
{
"id": "3388768018273",
"phone_number": "+19705551234",
"errors": [
{
"code": "10015",
"title": "Bad Request",
"detail": "The field is invalid.",
"source": { "pointer": "/emergency_address_id" }
}
]
}
]
}Was this page helpful?