Numbers API
The Numbers API enables you to manage your existing numbers and buy new virtual numbers for use with the Vonage APIs. Further information is here: https://developer.nexmo.com/en/numbers/overview
Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Base64 encoded API key and secret joined by a colon. | Headers | Basic <base64> |
Query Parameters
22GBThe Application that you want to return the numbers for.
Set this optional field to true to restrict your results to numbers associated with an Application (any Application). Set to false to find all numbers not associated with any Application. Omit the field to avoid filtering on whether or not the number is assigned to an Application.
The number pattern you want to search for. Use in conjunction with search_pattern.
The strategy you want to use for matching:
0- Search for numbers that start withpattern(Note: all numbers are in E.164 format, so the starting pattern includes the country code, such as 1 for USA)1- Search for numbers that containpattern2- Search for numbers that end withpattern
01210010Page size
1Page index
1The total amount of numbers owned by the account
A paginated array of numbers and their details
22GBThe two character country code in ISO 3166-1 alpha-2 format
447700900000An available inbound virtual number.
https://example.com/webhooks/inbound-smsThe URL of the webhook endpoint that handles inbound messages
mobile-lvnThe type of number: landline, landline-toll-free or mobile-lvn
The capabilities of the number: SMS or VOICE or SMS,VOICE or SMS,MMS or VOICE,MMS or SMS,MMS,VOICE
SMSMMSSMSVOICEOUTBOUNDINBOUNDOUTBOUNDINTERNATIONALDOMESTICINTERNATIONALappThe messages webhook type: always app
aaaaaaaa-bbbb-cccc-dddd-0123456789abAn Application ID
appThe voice webhook type: sip, tel, or app
aaaaaaaa-bbbb-cccc-dddd-0123456789abA SIP URI, telephone number or Application ID
1ded6eee-e2ec-4d61-8c71-e2b2ece17d1bThe application ID linked to that number
Example Response
{ "count": 1, "numbers": [ { "country": "GB", "msisdn": "447700900000", "moHttpUrl": "https://example.com/webhooks/inbound-sms", "type": "mobile-lvn", "features": [ "VOICE", "SMS", "MMS" ], "limitations": [ { "feature": "SMS", "type": "OUTBOUND", "reach": "INTERNATIONAL" }, { "feature": "VOICE", "type": "OUTBOUND", "reach": "DOMESTIC" } ], "messagesCallbackType": "app", "messagesCallbackValue": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab", "voiceCallbackType": "app", "voiceCallbackValue": "aaaaaaaa-bbbb-cccc-dddd-0123456789ab", "app_id": "1ded6eee-e2ec-4d61-8c71-e2b2ece17d1b" } ] }Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Base64 encoded API key and secret joined by a colon. | Headers | Basic <base64> |
Query Parameters
22GBThe two character country code to filter on (in ISO 3166-1 alpha-2 format)
Set this parameter to filter the type of number, such as mobile or landline
landlinemobile-lvnlandline-toll-freeThe number pattern you want to search for. Use in conjunction with search_pattern.
The strategy you want to use for matching:
0- Search for numbers that start withpattern(Note: all numbers are in E.164 format, so the starting pattern includes the country code, such as 1 for USA)1- Search for numbers that containpattern2- Search for numbers that end withpattern
012Available features are SMS, VOICE and MMS. To look for numbers that support multiple features, use a comma-separated value: SMS,MMS,VOICE.
SMSVOICESMS,VOICEMMSSMS,MMSVOICE,MMSSMS,MMS,VOICE10010Page size
1Page index
1234The total amount of numbers available in the pool.
A paginated array of available numbers and their details.
22GBThe two character country code in ISO 3166-1 alpha-2 format
447700900000An available inbound virtual number.
mobile-lvnThe type of number: landline, landline-toll-free or mobile-lvn
1.25The initial setup fee for this number, in Euros
1.25The monthly rental cost for this number, in Euros
The capabilities of the number: SMS or VOICE or SMS,VOICE or SMS,MMS or VOICE,MMS or SMS,MMS,VOICE
SMSMMSSMSVOICEOUTBOUNDINBOUNDOUTBOUNDINTERNATIONALDOMESTICINTERNATIONALExample Response
{ "count": 1234, "numbers": [ { "country": "GB", "msisdn": "447700900000", "type": "mobile-lvn", "initialPrice": "1.25", "cost": "1.25", "features": [ "VOICE", "SMS", "MMS" ], "limitations": [ { "feature": "SMS", "type": "OUTBOUND", "reach": "INTERNATIONAL" }, { "feature": "VOICE", "type": "OUTBOUND", "reach": "DOMESTIC" } ] } ] }Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Base64 encoded API key and secret joined by a colon. | Headers | Basic <base64> |
22GBThe two character country code in ISO 3166-1 alpha-2 format
447700900000An available inbound virtual number.
1a2345b7If you’d like to perform an action on a subaccount, provide the api_key of that account here. If you’d like to perform an action on your own account, you do not need to provide this field.
Example Request
POST /number/buy HTTP/1.1 Host: rest.nexmo.com Content-Type: application/x-www-form-urlencoded Content-Length: 54 country=GB&msisdn=447700900000&target_api_key=1a2345b7POST /number/buy HTTP/1.1 Host: rest.nexmo.com Content-Type: application/x-www-form-urlencoded Content-Length: 54 country=GB&msisdn=447700900000&target_api_key=1a2345b7Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Base64 encoded API key and secret joined by a colon. | Headers | Basic <base64> |
22GBThe two character country code in ISO 3166-1 alpha-2 format
447700900000An available inbound virtual number.
1a2345b7If you’d like to perform an action on a subaccount, provide the api_key of that account here. If you’d like to perform an action on your own account, you do not need to provide this field.
Example Request
POST /number/cancel HTTP/1.1 Host: rest.nexmo.com Content-Type: application/x-www-form-urlencoded Content-Length: 54 country=GB&msisdn=447700900000&target_api_key=1a2345b7POST /number/cancel HTTP/1.1 Host: rest.nexmo.com Content-Type: application/x-www-form-urlencoded Content-Length: 54 country=GB&msisdn=447700900000&target_api_key=1a2345b7Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Base64 encoded API key and secret joined by a colon. | Headers | Basic <base64> |
22GBThe two character country code in ISO 3166-1 alpha-2 format
447700900000An available inbound virtual number.
aaaaaaaa-bbbb-cccc-dddd-0123456789abcThe Application that will handle inbound traffic to this number.
https://example.com/webhooks/inbound-smsAn URL-encoded URI to the webhook endpoint that handles inbound messages. Your webhook endpoint must be active before you make this request. Vonage makes a GET request to the endpoint and checks that it returns a 200 OK response. Set this parameter's value to an empty string to remove the webhook.
inboundThe associated system type for your SMPP client
telSpecify whether inbound voice calls on your number are forwarded to a SIP or a telephone number. This must be used with the voiceCallbackValue parameter. If set, sip or tel are prioritized over the Voice capability in your Application.
Note: The app value is deprecated and will be removed in future.
siptelapp447700900000A SIP URI or telephone number. Must be used with the voiceCallbackType parameter.
https://example.com/webhooks/statusA webhook URI for Vonage to send a request to when a call ends
appDEPRECATED - We recommend that you use app_id instead.
Specifies the Messages webhook type (always app) associated with this number and must be used with the messagesCallbackValue parameter.
appaaaaaaaa-bbbb-cccc-dddd-0123456789abDEPRECATED - We recommend that you use app_id instead.
Specifies the Application ID of your Messages application. It must be used with the messagesCallbackType parameter.
Example Request
POST /number/update HTTP/1.1 Host: rest.nexmo.com Content-Type: application/x-www-form-urlencoded Content-Length: 342 country=GB&msisdn=447700900000&app_id=aaaaaaaa-bbbb-cccc-dddd-0123456789abc&moHttpUrl=https://example.com/webhooks/inbound-sms&moSmppSysType=inbound&voiceCallbackType=tel&voiceCallbackValue=447700900000&voiceStatusCallback=https://example.com/webhooks/status&messagesCallbackType=app&messagesCallbackValue=aaaaaaaa-bbbb-cccc-dddd-0123456789abPOST /number/update HTTP/1.1 Host: rest.nexmo.com Content-Type: application/x-www-form-urlencoded Content-Length: 342 country=GB&msisdn=447700900000&app_id=aaaaaaaa-bbbb-cccc-dddd-0123456789abc&moHttpUrl=https://example.com/webhooks/inbound-sms&moSmppSysType=inbound&voiceCallbackType=tel&voiceCallbackValue=447700900000&voiceStatusCallback=https://example.com/webhooks/status&messagesCallbackType=app&messagesCallbackValue=aaaaaaaa-bbbb-cccc-dddd-0123456789ab