Skip to content

Twilio: Update an incoming-phone-number instance

Twilio incomingPhoneNumber.updateIncomingPhoneNumber: arguments, response, policy and SDK examples.

← Incoming phone number operations · Get started

Operation twilio.updateincomingphonenumber

Provider route: POST /2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{Sid}.json. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/twilio with npm, or alter-sdk-twilio with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { TwilioIntegration } from "@alter-ai/twilio";
async function execute(input: Parameters<TwilioIntegration["incomingPhoneNumber"]["updateIncomingPhoneNumber"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new TwilioIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.incomingPhoneNumber.updateIncomingPhoneNumber(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_twilio import TwilioIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = TwilioIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.incoming_phone_number.update_incoming_phone_number(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.AccountSidstringRequired within parentMaximum length: 34
Minimum length: 34
Pattern: ^AC[0-9a-fA-F]{32}$
path.SidstringRequired within parentMaximum length: 34
Minimum length: 34
Pattern: ^PN[0-9a-fA-F]{32}$
bodyobjectOptional
body.AccountSidstringOptionalThe SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the IncomingPhoneNumber resource to update. For more information, see [Exchanging Numbers Between Subaccounts](https://www.twilio.com/docs/iam/api/subaccounts#exchanging-numbers).
Maximum length: 34
Minimum length: 34
Pattern: ^AC[0-9a-fA-F]{32}$
body.AddressSidstringOptionalThe SID of the Address resource we should associate with the phone number. Some regions require addresses to meet local regulations.
Maximum length: 34
Minimum length: 34
Pattern: ^AD[0-9a-fA-F]{32}$
body.ApiVersionstringOptionalThe API version to use for incoming calls made to the phone number. The default is `2010-04-01`.
body.BundleSidstringOptionalThe SID of the Bundle resource that you associate with the phone number. Some regions require a Bundle to meet local Regulations.
Maximum length: 34
Minimum length: 34
Pattern: ^BU[0-9a-fA-F]{32}$
body.EmergencyAddressSidstringOptionalThe SID of the emergency address configuration to use for emergency calling from this phone number.
Maximum length: 34
Minimum length: 34
Pattern: ^AD[0-9a-fA-F]{32}$
body.EmergencyStatusstringOptionalThe parameter displays if emergency calling is enabled for this number. Active numbers may place emergency calls by dialing valid emergency numbers for the country.
One of: Active, Inactive
body.FriendlyNamestringOptionalA descriptive string that you created to describe this phone number. It can be up to 64 characters long. By default, this is a formatted version of the phone number.
body.IdentitySidstringOptionalThe SID of the Identity resource that we should associate with the phone number. Some regions require an identity to meet local regulations.
Maximum length: 34
Minimum length: 34
Pattern: ^RI[0-9a-fA-F]{32}$
body.SmsApplicationSidstringOptionalThe SID of the application that should handle SMS messages sent to the number. If an `sms_application_sid` is present, we ignore all of the `sms_*_url` urls and use those set on the application.
Maximum length: 34
Minimum length: 34
Pattern: ^AP[0-9a-fA-F]{32}$
body.SmsFallbackMethodstringOptionalThe HTTP method that we should use to call `sms_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`.
One of: GET, POST
Format: http-method
body.SmsFallbackUrlstringOptionalThe URL that we should call when an error occurs while requesting or executing the TwiML defined by `sms_url`.
Format: uri
body.SmsMethodstringOptionalThe HTTP method that we should use to call `sms_url`. Can be: `GET` or `POST` and defaults to `POST`.
One of: GET, POST
Format: http-method
body.SmsUrlstringOptionalThe URL we should call when the phone number receives an incoming SMS message.
Format: uri
body.StatusCallbackstringOptionalThe URL we should call using the `status_callback_method` to send status information to your application.
Format: uri
body.StatusCallbackMethodstringOptionalThe HTTP method we should use to call `status_callback`. Can be: `GET` or `POST` and defaults to `POST`.
One of: GET, POST
Format: http-method
body.TrunkSidstringOptionalThe SID of the Trunk we should use to handle phone calls to the phone number. If a `trunk_sid` is present, we ignore all of the voice urls and voice applications and use only those set on the Trunk. Setting a `trunk_sid` will automatically delete your `voice_application_sid` and vice versa.
Maximum length: 34
Minimum length: 34
Pattern: ^TK[0-9a-fA-F]{32}$
body.VoiceApplicationSidstringOptionalThe SID of the application we should use to handle phone calls to the phone number. If a `voice_application_sid` is present, we ignore all of the voice urls and use only those set on the application. Setting a `voice_application_sid` will automatically delete your `trunk_sid` and vice versa.
Maximum length: 34
Minimum length: 34
Pattern: ^AP[0-9a-fA-F]{32}$
body.VoiceCallerIdLookupbooleanOptionalWhether to lookup the caller’s name from the CNAM database and post it to your app. Can be: `true` or `false` and defaults to `false`.
body.VoiceFallbackMethodstringOptionalThe HTTP method that we should use to call `voice_fallback_url`. Can be: `GET` or `POST` and defaults to `POST`.
One of: GET, POST
Format: http-method
body.VoiceFallbackUrlstringOptionalThe URL that we should call when an error occurs retrieving or executing the TwiML requested by `url`.
Format: uri
body.VoiceMethodstringOptionalThe HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`.
One of: GET, POST
Format: http-method
body.VoiceReceiveModestringOptionalOne of: voice, fax
body.VoiceUrlstringOptionalThe URL that we should call to answer a call to the phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set.
Format: uri

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Purchase a phone-number for the account — response body

Referenced models: Purchase a phone-number for the account — response body

1 more schema is linked from the tables above, on the schema pages.

SDK function policy ID: twilio.updateincomingphonenumber. Catalog operation: UpdateIncomingPhoneNumber. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand how our website, product, and documentation are used.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

Advertising

Shares visits and sign-ups with Meta, Reddit, and X so we can measure which of our ads work.

You can change these choices at any time from Cookie settings.