メニュー

Rate this page:

Thanks for rating this page!

We are always striving to improve our documentation quality, and your feedback is valuable to us. How could this documentation serve you better?

REST API: 着信電話番号

An IncomingPhoneNumber instance resource represents a Twilio phone number purchased from Twilio, ported or hosted to Twilio.

IncomingPhoneNumber リスト リソースは、アカウントの Twilio 電話番号を表現します。 新しい Twilio 番号をプロビジョニングするには、このリスト リソースに POST します。 プロビジョニングする新しい番号を検索するには、 AvailablePhoneNumber リソースのサブリソースを使用します。

サブアカウントを使用している場合は、2 つの Twilio アカウントの間で電話番号を移動することができます。 詳細は、 サブアカウント間で番号を交換するを参照してください。

電話番号のプロビジョニングには、2 つのステップがあります。 まず、 AvailablePhoneNumber リソースのサブリソースを使って、プロビジョニングを行う使用可能な番号を検索します。 次に、必ず IncomingPhoneNumbers リスト リソースに POSTします。 次のセクションで詳細を説明します。

IncomingPhoneNumber Properties

Each instance of an IncomingPhoneNumber resource has the following properties:

Names in Java format
accountSid
sid<AC> Not PII

The SID of the Account that created this IncomingPhoneNumber resource.

addressSid
sid<AD> Not PII

The SID of the Address resource associated with the phone number.

addressRequirements
enum:address_requirement Not PII

Whether the phone number requires an Address registered with Twilio. Can be: none, any, local, or foreign.

apiVersion
文字列 Not PII

The API version used to start a new TwiML session.

beta
boolean Not PII

Whether the phone number is new to the Twilio platform. Can be: true or false.

capabilities
phone_number_capabilities Not PII

The set of Boolean properties that indicate whether a phone number can receive calls or messages. Capabilities are Voice, SMS, and MMS and each capability can be: true or false.

dateCreated
date_time<rfc2822> Not PII

The date and time in GMT that the resource was created specified in RFC 2822 format.

dateUpdated
date_time<rfc2822> Not PII

The date and time in GMT that the resource was last updated specified in RFC 2822 format.

friendlyName
文字列 PII MTL: 30 DAYS

The string that you assigned to describe the resource.

identitySid
sid<RI> Not PII

The SID of the Identity resource that we associate with the phone number. Some regions require an Identity to meet local regulations.

phoneNumber
phone_number Not PII

The phone number in E.164 format, which consists of a + followed by the country code and subscriber number.

origin
文字列 Not PII

The phone number's origin. twilio identifies Twilio-owned phone numbers and hosted identifies hosted phone numbers.

sid
sid<PN> Not PII

The unique string that that we created to identify this IncomingPhoneNumber resource.

smsApplicationSid
sid<AP> Not PII

The SID of the application that handles SMS messages sent to the phone number. If an sms_application_sid is present, we ignore all sms_*_url values and use those of the application.

smsFallbackMethod
http_method Not PII

The HTTP method we use to call sms_fallback_url. Can be: GET or POST.

smsFallbackUrl
url Not PII

The URL that we call when an error occurs while retrieving or executing the TwiML from sms_url.

smsMethod
http_method Not PII

The HTTP method we use to call sms_url. Can be: GET or POST.

smsUrl
url Not PII

The URL we call when the phone number receives an incoming SMS message.

statusCallback
url Not PII

The URL we call using the status_callback_method to send status information to your application.

statusCallbackMethod
http_method Not PII

The HTTP method we use to call status_callback. Can be: GET or POST.

trunkSid
sid<TR> Not PII

The SID of the Trunk that handles calls to the phone number. If a trunk_sid is present, we ignore all of the voice urls and voice applications and use those set on the Trunk. Setting a trunk_sid will automatically delete your voice_application_sid and vice versa.

uri
uri Not PII

The URI of the resource, relative to https://api.twilio.com.

voiceApplicationSid
sid<AP> Not PII

The SID of the application that handles calls to the phone number. If a voice_application_sid is present, we ignore all of the voice urls and use those set on the application. Setting a voice_application_sid will automatically delete your trunk_sid and vice versa.

voiceCallerIdLookup
boolean Not PII

Whether we look up the caller's caller-ID name from the CNAM database ($0.01 per look up). Can be: true or false.

voiceFallbackMethod
http_method Not PII

The HTTP method we use to call voice_fallback_url. Can be: GET or POST.

voiceFallbackUrl
url Not PII

The URL that we call when an error occurs retrieving or executing the TwiML requested by url.

voiceMethod
http_method Not PII

The HTTP method we use to call voice_url. Can be: GET or POST.

voiceUrl
url Not PII

The URL we call when the phone number receives a call. The voice_url will not be used if a voice_application_sid or a trunk_sid is set.

emergencyStatus
enum:emergency_status Not PII

The configuration status parameter that determines whether the phone number is enabled for emergency calling.

emergencyAddressSid
sid<AD> Not PII

The SID of the emergency address configuration that we use for emergency calling from this phone number.

Address Requirements Values

下記は address_requirements プロパティ として取りうる値です。

Status 概要
none このアドレスは電話番号に必要ではありません。
any このアカウントは住所を必要としています。しかし、世界中のどこでもご利用いただけます。
local このアカウントは電話番号の国の住所が必要です。
foreign あなたのアカウントは電話番号の国ではない住所が必要です。
POST
https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers

自分のアカウントの新しい電話番号を購入します。 リクエストに一致する電話番号が見つかると、Twilio はこの番号をアカウントに追加し、初月の料金を課金します。 リクエストに一致する電話番号が見つからない場合、HTTP 400番台のエラーと Twilio エラー コード 21452 が返ります。

If the number you are trying to purchase has address requirements, the system will look for an address on your account that satisfies the requirement. If you have multiple addresses, you can specify which address to associate with the number by passing the optional AddressSid parameter.

購入しようとしている電話番号が提出された身分証明書を必要とし、アカウントに関連づけられた確認済の身分証明書がない場合、Twilioエラーコード21650を伴ったHTTP 400を受信することになります。 詳細については、このサポート記事をご参照ください。

POST する番号を検索するには、 AvailablePhoneNumbers リスト リソースのサブリソースを使用します。

Please note: You cannot request numbers via the API while you are using a Free Trial account. You must upgrade your account to purchase a Twilio phone number programmatically.

パラメーター

リクエストには、次のパラメーターを含めることができます。

Names in Java format
pathAccountSid
必須
post sid<AC> Not PII

The SID of the Account that will create the resource.

phoneNumber
Required if areaCode is not passed
post phone_number Not PII

The phone number to purchase specified in E.164 format. E.164 phone numbers consist of a + followed by the country code and subscriber number without punctuation characters. For example, +14155551234.

areaCode
Required if phoneNumber is not passed
post 文字列 Not PII

The desired area code for your new incoming phone number. Can be any three-digit, US or Canada area code. We will provision an available phone number within this area code for you. You must provide an area_code or a phone_number. (US and Canada only).

apiVersion
オプション
post 文字列 Not PII

The API version to use for incoming calls made to the new phone number. The default is 2010-04-01.

friendlyName
オプション
post 文字列 PII MTL: 30 DAYS

A descriptive string that you created to describe the new phone number. It can be up to 64 characters long. By default, this is a formatted version of the new phone number.

smsApplicationSid
オプション
post sid<AP> Not PII

The SID of the application that should handle SMS messages sent to the new phone number. If an sms_application_sid is present, we ignore all of the sms_*_url urls and use those set on the application.

smsFallbackMethod
オプション
post http_method Not PII

The HTTP method that we should use to call sms_fallback_url. Can be: GET or POST and defaults to POST.

smsFallbackUrl
オプション
post url Not PII

The URL that we should call when an error occurs while requesting or executing the TwiML defined by sms_url.

smsMethod
オプション
post http_method Not PII

The HTTP method that we should use to call sms_url. Can be: GET or POST and defaults to POST.

smsUrl
オプション
post url Not PII

The URL we should call when the new phone number receives an incoming SMS message.

statusCallback
オプション
post url Not PII

The URL we should call using the status_callback_method to send status information to your application.

statusCallbackMethod
オプション
post http_method Not PII

The HTTP method we should use to call status_callback. Can be: GET or POST and defaults to POST.

voiceApplicationSid
オプション
post sid<AP> Not PII

The SID of the application we should use to handle calls to the new 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.

voiceCallerIdLookup
オプション
post boolean Not PII

Whether 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.

voiceFallbackMethod
オプション
post http_method Not PII

The HTTP method that we should use to call voice_fallback_url. Can be: GET or POST and defaults to POST.

voiceFallbackUrl
オプション
post url Not PII

The URL that we should call when an error occurs retrieving or executing the TwiML requested by url.

voiceMethod
オプション
post http_method Not PII

The HTTP method that we should use to call voice_url. Can be: GET or POST and defaults to POST.

voiceUrl
オプション
post url Not PII

The URL that we should call to answer a call to the new phone number. The voice_url will not be called if a voice_application_sid or a trunk_sid is set.

emergencyStatus
オプション
post enum:emergency_status Not PII

The configuration status parameter that determines whether the new phone number is enabled for emergency calling.

emergencyAddressSid
オプション
post sid<AD> Not PII

The SID of the emergency address configuration to use for emergency calling from the new phone number.

trunkSid
オプション
post sid<TR> Not PII

The SID of the Trunk we should use to handle calls to the new 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.

identitySid
オプション
post sid<RI> Not PII

The SID of the Identity resource that we should associate with the new phone number. Some regions require an identity to meet local regulations.

addressSid
オプション
post sid<AD> Not PII

The SID of the Address resource we should associate with the new phone number. Some regions require addresses to meet local regulations.

voiceReceiveMode
オプション
post ienum:voice_receive_mode Not PII

The configuration parameter for the new phone number to receive incoming voice calls or faxes. Can be: fax or voice and defaults to voice.

リクエストが成功すると、Twilio はアカウントに割り当てられた新しい電話番号の表現を返します。

        
        
        
        
        GET
        https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{IncomingPhoneNumberSid}
              
              
              
              
              GET
              https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers

              IncomingPhoneNumber リソース表現のリストを返します。各項目は、アカウントに割り当てられた電話番号を表現します。 このリストは ページ情報を含みます。

              リストフィルター

              次のクエリ パラメーターを使って、返却されるリストに制限を加えます。 パラメーターの大文字と小文字は区別されます。

              Names in Java format
              pathAccountSid
              必須
              GET sid<AC> Not PII

              The SID of the Account that created the IncomingPhoneNumber resources to read.

              beta
              オプション
              GET boolean Not PII

              Whether to include phone numbers new to the Twilio platform. Can be: true or false and the default is true.

              friendlyName
              オプション
              GET 文字列 PII MTL: 30 DAYS

              A string that identifies the IncomingPhoneNumber resources to read.

              phoneNumber
              オプション
              GET phone_number Not PII

              The phone numbers of the IncomingPhoneNumber resources to read. You can specify partial numbers and use '*' as a wildcard for any digit.

              origin
              オプション
              GET 文字列 Not PII

              Whether to include phone numbers based on their origin. Can be: twilio or hosted. By default, phone numbers of all origin are included.

                    
                    
                    
                    
                    例 2

                    (415) 867-5309 に完全に一致する電話番号のセットを返します。

                          
                          
                          
                          
                          例 3

                          数字 867 を含むすべてのショート コードのセットを返します。

                                
                                
                                
                                
                                POST
                                https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{IncomingPhoneNumberSid}

                                着信電話番号のプロパティを更新します。更新に成功すると、更新されたリソース表現を返します。 返却されるレスポンスは、GET リクエストを送信した場合と同じです。

                                パラメーター

                                次のパラメーターの 1 つまたは複数を指定して、この電話番号のプロパティを更新できます。

                                Names in Java format
                                pathAccountSid
                                必須
                                post sid<AC> Not PII

                                The SID of the Account that created the IncomingPhoneNumber resource to update. For more information, see Exchanging Numbers Between Subaccounts.

                                pathSid
                                必須
                                post sid<PN> Not PII

                                The Twilio-provided string that uniquely identifies the IncomingPhoneNumber resource to update.

                                apiVersion
                                オプション
                                post 文字列 Not PII

                                The API version to use for incoming calls made to the phone number. The default is 2010-04-01.

                                friendlyName
                                オプション
                                post 文字列 PII MTL: 30 DAYS

                                A 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.

                                smsApplicationSid
                                オプション
                                post sid<AP> Not PII

                                The 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.

                                smsFallbackMethod
                                オプション
                                post http_method Not PII

                                The HTTP method that we should use to call sms_fallback_url. Can be: GET or POST and defaults to POST.

                                smsFallbackUrl
                                オプション
                                post url Not PII

                                The URL that we should call when an error occurs while requesting or executing the TwiML defined by sms_url.

                                smsMethod
                                オプション
                                post http_method Not PII

                                The HTTP method that we should use to call sms_url. Can be: GET or POST and defaults to POST.

                                smsUrl
                                オプション
                                post url Not PII

                                The URL we should call when the phone number receives an incoming SMS message.

                                statusCallback
                                オプション
                                post url Not PII

                                The URL we should call using the status_callback_method to send status information to your application.

                                statusCallbackMethod
                                オプション
                                post http_method Not PII

                                The HTTP method we should use to call status_callback. Can be: GET or POST and defaults to POST.

                                voiceApplicationSid
                                オプション
                                post sid<AP> Not PII

                                The 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.

                                voiceCallerIdLookup
                                オプション
                                post boolean Not PII

                                Whether 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.

                                voiceFallbackMethod
                                オプション
                                post http_method Not PII

                                The HTTP method that we should use to call voice_fallback_url. Can be: GET or POST and defaults to POST.

                                voiceFallbackUrl
                                オプション
                                post url Not PII

                                The URL that we should call when an error occurs retrieving or executing the TwiML requested by url.

                                voiceMethod
                                オプション
                                post http_method Not PII

                                The HTTP method that we should use to call voice_url. Can be: GET or POST and defaults to POST.

                                voiceUrl
                                オプション
                                post url Not PII

                                The 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.

                                emergencyStatus
                                オプション
                                post enum:emergency_status Not PII

                                The configuration status parameter that determines whether the phone number is enabled for emergency calling.

                                emergencyAddressSid
                                オプション
                                post sid<AD> Not PII

                                The SID of the emergency address configuration to use for emergency calling from this phone number.

                                trunkSid
                                オプション
                                post sid<TR> Not PII

                                The 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.

                                voiceReceiveMode
                                オプション
                                post enum:voice_receive_mode Not PII

                                The configuration parameter for the phone number to receive incoming voice calls or faxes. Can be: fax or voice and defaults to voice.

                                identitySid
                                オプション
                                post sid<RI> Not PII

                                The SID of the Identity resource that we should associate with the phone number. Some regions require an identity to meet local regulations.

                                addressSid
                                オプション
                                post sid<AD> Not PII

                                The SID of the Address resource we should associate with the phone number. Some regions require addresses to meet local regulations.

                                例 1

                                VoiceUrlとSmsUrlを電話場号に割り当てます

                                      
                                      
                                      
                                      
                                      削除
                                      https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/IncomingPhoneNumbers/{IncomingPhoneNumberSid}

                                      この電話番号をアカウントから開放します。 Twilio は今後、この電話番号への通話に応答しません。毎月の電話番号使用料の課金は停止されます。電話番号は再利用されます。将来他のユーザーに付与される可能性がありますので、注意してください。 誤って開放してしまった場合は、Twilio へお問い合わせください。 番号を復元できる場合があります。

                                      開放に成功すると、ボディーのない HTTP 204 レスポンスを返します。

                                      例 1

                                      Release a phone number from your account.

                                            
                                            
                                            
                                            
                                            Rate this page:

                                            ヘルプが必要ですか?

                                            We all do sometimes; code is hard. Get help now from our support team, or lean on the wisdom of the crowd browsing the Twilio tag on Stack Overflow.