The following APIs allow actions on a single phone number within a port in request. You can find the SID of a port in phone number from the GET
Port In Request API.
The unique identifier for the port in request that this phone number is associated with.
^KW[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The unique identifier for this phone number associated with this port in request.
^PU[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
Account Sid or subaccount where the phone number(s) will be Ported.
^AC[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The number type of the phone number. This can be: toll-free, local, mobile or unknown. This field may be null if the number is not portable or if the portability for a number has not yet been evaluated.
The timestamp for when this port in phone number was created.
The ISO country code that this number is associated with. This field may be null if the number is not portable or if the portability for a number has not yet been evaluated.
Indicates if the phone number is missing required fields such as a PIN or account number. This field may be null if the number is not portable or if the portability for a number has not yet been evaluated.
Timestamp indicating when the Port In Phone Number resource was last modified.
Phone number to be ported. This will be in the E164 Format.
If the number is portable by Twilio or not. This field may be null if the number portability has not yet been evaluated. If a number is not portable reference the not_portability_reason_code
and not_portability_reason
fields for more details
The not portability reason code description. This field may be null if the number is portable or if the portability for a number has not yet been evaluated.
The not portability reason code. This field may be null if the number is portable or if the portability for a number has not yet been evaluated.
The description of the rejection reason provided by the losing carrier. This field may be null if the number has not been rejected by the losing carrier.
The code for the rejection reason provided by the losing carrier. This field may be null if the number has not been rejected by the losing carrier.
The timestamp the phone number will be ported. This will only be set once a port date has been confirmed. Not all carriers can guarantee a specific time on the port date. Twilio will try its best to get the port completed by this time on the port date. Please subscribe to webhooks for confirmation on when a port has actually been completed.
GET https://numbers.twilio.com/v1/Porting/PortIn/{PortInRequestSid}/PhoneNumber/{PhoneNumberSid}
The SID of the Port In request. This is a unique identifier of the port in request.
^KW[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Phone number. This is a unique identifier of the phone number.
^PU[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchPortingPortInPhoneNumber() {11const portingPortInPhoneNumber = await client.numbers.v112.portingPortInPhoneNumber(13"KWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"PUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"15)16.fetch();1718console.log(portingPortInPhoneNumber.portInRequestSid);19}2021fetchPortingPortInPhoneNumber();
1{2"port_in_request_sid": "KWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",4"phone_number_type": "LOCAL",5"date_created": "2024-04-10T06:52:21Z",6"country": "US",7"missing_required_fields": false,8"last_updated": "2024-03-12T06:52:21Z",9"phone_number": "+15024953384",10"portable": true,11"not_portability_reason": "ALREADY_IN_TWILIO_DIFFERENT_OWNER",12"not_portability_reason_code": 22132,13"port_in_phone_number_status": "in_review",14"phone_number_sid": "PUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",15"port_out_pin": 1234,16"rejection_reason": null,17"rejection_reason_code": null,18"port_date": "2024-05-17T00:00:00Z",19"url": "https://numbers.twilio.com/v1/Porting/PortIn/KWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/PhoneNumber/PUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"20}
DELETE https://numbers.twilio.com/v1/Porting/PortIn/{PortInRequestSid}/PhoneNumber/{PhoneNumberSid}
Make a DELETE
request to this API endpoint to cancel a single phone number Port In requesr.
There are some restrictions on when you can cancel the port of a phone number. Twilio is only able to accept cancellations that occur more than 72 hours before the port in date.
The SID of the Port In request. This is a unique identifier of the port in request.
^KW[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
The SID of the Port In request phone number. This is a unique identifier of the phone number.
^PU[0-9a-fA-F]{32}$
Min length: 34
Max length: 34
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function deletePortingPortInPhoneNumber() {11await client.numbers.v112.portingPortInPhoneNumber(13"KWaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",14"PUaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"15)16.remove();17}1819deletePortingPortInPhoneNumber();
An HTTP 201 response status code indicates an accepted cancellation request. Unsuccessful requests have the following error codes:
HTTP Status Code | Next Steps |
---|---|
404 | The requested port in phone number does not exist on your account. Check that you have the correct port in request SID. Note all Port In Request SIDs should begin with KW . |
500 | There was an error within Twilio while trying to cancel the port in request. Please try again and contact support if the issue persists. |