api/javascript/telnyx-porting-in-javascript/SKILL.md
Port phone numbers into Telnyx. Check portability, create port orders, upload LOA documents, and track porting status. This skill provides JavaScript SDK examples.
npx skillsauth add team-telnyx/telnyx-toolkit telnyx-porting-in-javascriptInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
npm install telnyx
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.
Returns a list of all porting events.
GET /porting/events
// Automatically fetches more pages as needed.
for await (const eventListResponse of client.porting.events.list()) {
console.log(eventListResponse);
}
Show a specific porting event.
GET /porting/events/{id}
const event = await client.porting.events.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(event.data);
Republish a specific porting event.
POST /porting/events/{id}/republish
await client.porting.events.republish('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
Preview the LOA template that would be generated without need to create LOA configuration.
POST /porting/loa_configuration_preview
const response = await client.porting.loaConfigurations.preview0({
address: {
city: 'Austin',
country_code: 'US',
state: 'TX',
street_address: '600 Congress Avenue',
zip_code: '78701',
},
company_name: 'Telnyx',
contact: { email: '[email protected]', phone_number: '+12003270001' },
logo: { document_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
name: 'My LOA Configuration',
});
console.log(response);
const content = await response.blob();
console.log(content);
List the LOA configurations.
GET /porting/loa_configurations
// Automatically fetches more pages as needed.
for await (const portingLoaConfiguration of client.porting.loaConfigurations.list()) {
console.log(portingLoaConfiguration.id);
}
Create a LOA configuration.
POST /porting/loa_configurations
const loaConfiguration = await client.porting.loaConfigurations.create({
address: {
city: 'Austin',
country_code: 'US',
state: 'TX',
street_address: '600 Congress Avenue',
zip_code: '78701',
},
company_name: 'Telnyx',
contact: { email: '[email protected]', phone_number: '+12003270001' },
logo: { document_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
name: 'My LOA Configuration',
});
console.log(loaConfiguration.data);
Retrieve a specific LOA configuration.
GET /porting/loa_configurations/{id}
const loaConfiguration = await client.porting.loaConfigurations.retrieve(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);
console.log(loaConfiguration.data);
Update a specific LOA configuration.
PATCH /porting/loa_configurations/{id}
const loaConfiguration = await client.porting.loaConfigurations.update(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{
address: {
city: 'Austin',
country_code: 'US',
state: 'TX',
street_address: '600 Congress Avenue',
zip_code: '78701',
},
company_name: 'Telnyx',
contact: { email: '[email protected]', phone_number: '+12003270001' },
logo: { document_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
name: 'My LOA Configuration',
},
);
console.log(loaConfiguration.data);
Delete a specific LOA configuration.
DELETE /porting/loa_configurations/{id}
await client.porting.loaConfigurations.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
Preview a specific LOA configuration.
GET /porting/loa_configurations/{id}/preview
const response = await client.porting.loaConfigurations.preview1(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);
console.log(response);
const content = await response.blob();
console.log(content);
Returns a list of your porting order.
GET /porting_orders
// Automatically fetches more pages as needed.
for await (const portingOrder of client.portingOrders.list()) {
console.log(portingOrder.id);
}
Creates a new porting order object.
POST /porting_orders — Required: phone_numbers
const portingOrder = await client.portingOrders.create({
phone_numbers: ['+13035550000', '+13035550001', '+13035550002'],
});
console.log(portingOrder.data);
Retrieves the details of an existing porting order.
GET /porting_orders/{id}
const portingOrder = await client.portingOrders.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(portingOrder.data);
Edits the details of an existing porting order.
PATCH /porting_orders/{id}
const portingOrder = await client.portingOrders.update('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(portingOrder.data);
Deletes an existing porting order.
DELETE /porting_orders/{id}
await client.portingOrders.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
Activate each number in a porting order asynchronously.
POST /porting_orders/{id}/actions/activate
const response = await client.portingOrders.actions.activate(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);
console.log(response.data);
POST /porting_orders/{id}/actions/cancel
const response = await client.portingOrders.actions.cancel('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(response.data);
Confirm and submit your porting order.
POST /porting_orders/{id}/actions/confirm
const response = await client.portingOrders.actions.confirm('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(response.data);
Creates a sharing token for a porting order.
POST /porting_orders/{id}/actions/share
const response = await client.portingOrders.actions.share('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(response.data);
Returns a list of your porting activation jobs.
GET /porting_orders/{id}/activation_jobs
// Automatically fetches more pages as needed.
for await (const portingOrdersActivationJob of client.portingOrders.activationJobs.list(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
)) {
console.log(portingOrdersActivationJob.id);
}
Returns a porting activation job.
GET /porting_orders/{id}/activation_jobs/{activationJobId}
const activationJob = await client.portingOrders.activationJobs.retrieve(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
);
console.log(activationJob.data);
Updates the activation time of a porting activation job.
PATCH /porting_orders/{id}/activation_jobs/{activationJobId}
const activationJob = await client.portingOrders.activationJobs.update(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
);
console.log(activationJob.data);
Returns a list of additional documents for a porting order.
GET /porting_orders/{id}/additional_documents
// Automatically fetches more pages as needed.
for await (const additionalDocumentListResponse of client.portingOrders.additionalDocuments.list(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
)) {
console.log(additionalDocumentListResponse.id);
}
Creates a list of additional documents for a porting order.
POST /porting_orders/{id}/additional_documents
const additionalDocument = await client.portingOrders.additionalDocuments.create(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);
console.log(additionalDocument.data);
Deletes an additional document for a porting order.
DELETE /porting_orders/{id}/additional_documents/{additional_document_id}
await client.portingOrders.additionalDocuments.delete('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
});
Returns a list of allowed FOC dates for a porting order.
GET /porting_orders/{id}/allowed_foc_windows
const response = await client.portingOrders.retrieveAllowedFocWindows(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);
console.log(response.data);
Returns a list of all comments of a porting order.
GET /porting_orders/{id}/comments
// Automatically fetches more pages as needed.
for await (const commentListResponse of client.portingOrders.comments.list(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
)) {
console.log(commentListResponse.id);
}
Creates a new comment for a porting order.
POST /porting_orders/{id}/comments
const comment = await client.portingOrders.comments.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(comment.data);
GET /porting_orders/{id}/loa_template
const response = await client.portingOrders.retrieveLoaTemplate(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);
console.log(response);
const content = await response.blob();
console.log(content);
Returns a list of all requirements based on country/number type for this porting order.
GET /porting_orders/{id}/requirements
// Automatically fetches more pages as needed.
for await (const portingOrderRetrieveRequirementsResponse of client.portingOrders.retrieveRequirements(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
)) {
console.log(portingOrderRetrieveRequirementsResponse.field_type);
}
GET /porting_orders/{id}/sub_request
const response = await client.portingOrders.retrieveSubRequest(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);
console.log(response.data);
Returns a list of verification codes for a porting order.
GET /porting_orders/{id}/verification_codes
// Automatically fetches more pages as needed.
for await (const verificationCodeListResponse of client.portingOrders.verificationCodes.list(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
)) {
console.log(verificationCodeListResponse.id);
}
Send the verification code for all porting phone numbers.
POST /porting_orders/{id}/verification_codes/send
await client.portingOrders.verificationCodes.send('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
Verifies the verification code for a list of phone numbers.
POST /porting_orders/{id}/verification_codes/verify
const response = await client.portingOrders.verificationCodes.verify(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
);
console.log(response.data);
Returns a list of action requirements for a specific porting order.
GET /porting_orders/{porting_order_id}/action_requirements
// Automatically fetches more pages as needed.
for await (const actionRequirementListResponse of client.portingOrders.actionRequirements.list(
'porting_order_id',
)) {
console.log(actionRequirementListResponse.id);
}
Initiates a specific action requirement for a porting order.
POST /porting_orders/{porting_order_id}/action_requirements/{id}/initiate
const response = await client.portingOrders.actionRequirements.initiate('id', {
porting_order_id: 'porting_order_id',
params: { first_name: 'John', last_name: 'Doe' },
});
console.log(response.data);
Returns a list of all associated phone numbers for a porting order.
GET /porting_orders/{porting_order_id}/associated_phone_numbers
// Automatically fetches more pages as needed.
for await (const portingAssociatedPhoneNumber of client.portingOrders.associatedPhoneNumbers.list(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
)) {
console.log(portingAssociatedPhoneNumber.id);
}
Creates a new associated phone number for a porting order.
POST /porting_orders/{porting_order_id}/associated_phone_numbers
const associatedPhoneNumber = await client.portingOrders.associatedPhoneNumbers.create(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{
action: 'keep',
phone_number_range: {},
},
);
console.log(associatedPhoneNumber.data);
Deletes an associated phone number from a porting order.
DELETE /porting_orders/{porting_order_id}/associated_phone_numbers/{id}
const associatedPhoneNumber = await client.portingOrders.associatedPhoneNumbers.delete(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ porting_order_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
);
console.log(associatedPhoneNumber.data);
Returns a list of all phone number blocks of a porting order.
GET /porting_orders/{porting_order_id}/phone_number_blocks
// Automatically fetches more pages as needed.
for await (const portingPhoneNumberBlock of client.portingOrders.phoneNumberBlocks.list(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
)) {
console.log(portingPhoneNumberBlock.id);
}
Creates a new phone number block.
POST /porting_orders/{porting_order_id}/phone_number_blocks
const phoneNumberBlock = await client.portingOrders.phoneNumberBlocks.create(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{
activation_ranges: [{ end_at: '+4930244999910', start_at: '+4930244999901' }],
phone_number_range: { end_at: '+4930244999910', start_at: '+4930244999901' },
},
);
console.log(phoneNumberBlock.data);
Deletes a phone number block.
DELETE /porting_orders/{porting_order_id}/phone_number_blocks/{id}
const phoneNumberBlock = await client.portingOrders.phoneNumberBlocks.delete(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ porting_order_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
);
console.log(phoneNumberBlock.data);
Returns a list of all phone number extensions of a porting order.
GET /porting_orders/{porting_order_id}/phone_number_extensions
// Automatically fetches more pages as needed.
for await (const portingPhoneNumberExtension of client.portingOrders.phoneNumberExtensions.list(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
)) {
console.log(portingPhoneNumberExtension.id);
}
Creates a new phone number extension.
POST /porting_orders/{porting_order_id}/phone_number_extensions
const phoneNumberExtension = await client.portingOrders.phoneNumberExtensions.create(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{
activation_ranges: [{ end_at: 10, start_at: 1 }],
extension_range: { end_at: 10, start_at: 1 },
porting_phone_number_id: 'f24151b6-3389-41d3-8747-7dd8c681e5e2',
},
);
console.log(phoneNumberExtension.data);
Deletes a phone number extension.
DELETE /porting_orders/{porting_order_id}/phone_number_extensions/{id}
const phoneNumberExtension = await client.portingOrders.phoneNumberExtensions.delete(
'182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
{ porting_order_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
);
console.log(phoneNumberExtension.data);
Returns a list of all possible exception types for a porting order.
GET /porting_orders/exception_types
const response = await client.portingOrders.retrieveExceptionTypes();
console.log(response.data);
Returns a list of phone number configurations paginated.
GET /porting_orders/phone_number_configurations
// Automatically fetches more pages as needed.
for await (const phoneNumberConfigurationListResponse of client.portingOrders.phoneNumberConfigurations.list()) {
console.log(phoneNumberConfigurationListResponse.id);
}
Creates a list of phone number configurations.
POST /porting_orders/phone_number_configurations
const phoneNumberConfiguration = await client.portingOrders.phoneNumberConfigurations.create();
console.log(phoneNumberConfiguration.data);
Returns a list of your porting phone numbers.
GET /porting/phone_numbers
// Automatically fetches more pages as needed.
for await (const portingPhoneNumberListResponse of client.portingPhoneNumbers.list()) {
console.log(portingPhoneNumberListResponse.porting_order_id);
}
List the reports generated about porting operations.
GET /porting/reports
// Automatically fetches more pages as needed.
for await (const portingReport of client.porting.reports.list()) {
console.log(portingReport.id);
}
Generate reports about porting operations.
POST /porting/reports
const report = await client.porting.reports.create({
params: { filters: {} },
report_type: 'export_porting_orders_csv',
});
console.log(report.data);
Retrieve a specific report generated.
GET /porting/reports/{id}
const report = await client.porting.reports.retrieve('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');
console.log(report.data);
List available carriers in the UK.
GET /porting/uk_carriers
const response = await client.porting.listUkCarriers();
console.log(response.data);
Runs a portability check, returning the results immediately.
POST /portability_checks
const response = await client.portabilityChecks.run();
console.log(response.data);
tools
Build cross-platform VoIP calling apps with React Native using Telnyx Voice SDK. High-level reactive API with automatic lifecycle management, CallKit/ConnectionService integration, and push notifications. Use for mobile VoIP apps with minimal setup.
tools
Build browser-based VoIP calling apps using Telnyx WebRTC JavaScript SDK. Covers authentication, voice calls, events, debugging, call quality metrics, and AI Agent integration. Use for web-based real-time communication.
tools
Build VoIP calling apps on iOS using Telnyx WebRTC SDK. Covers authentication, making/receiving calls, CallKit integration, PushKit/APNS push notifications, call quality metrics, and AI Agent integration. Use when implementing real-time voice communication on iOS.
tools
Build cross-platform VoIP calling apps with Flutter using Telnyx WebRTC SDK. Covers authentication, making/receiving calls, push notifications (FCM + APNS), call quality metrics, and AI Agent integration. Works on Android, iOS, and Web.