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

OpenAPI-Spezifikation herunterladen

List the numbers you own

Retrieve all the inbound numbers associated with your Vonage account.

gethttps://rest.nexmo.com/account/numbers

Authentifizierung

SchlüsselBeschreibungWoBeispiel
Authorization

Base64-kodierter API-Schlüssel und Geheimnis, verbunden durch einen Doppelpunkt.
Mehr lesen

Headers

Basic <base64>

Abfrage Parameter

country
string
Min2
Max2
BeispielGB
application_id
string

The Application that you want to return the numbers for.

has_application
boolean

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.

pattern
string

The number pattern you want to search for. Use in conjunction with search_pattern.

search_pattern
integer

The strategy you want to use for matching:

  • 0 - Search for numbers that start with pattern (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 contain pattern
  • 2 - Search for numbers that end with pattern
Muss eines der folgenden sein:012
size
integer
Max100
Standard10

Page size

index
integer
Standard1

Page index

Antworten
Inhalt Typ

OK

count
integer
Beispiel1

The total amount of numbers owned by the account

numbers
array

A paginated array of numbers and their details

country
string
Min2
Max2
BeispielGB

The two character country code in ISO 3166-1 alpha-2 format

msisdn
string
Beispiel447700900000

An available inbound virtual number.

moHttpUrl
string(url)
Beispielhttps://example.com/webhooks/inbound-sms

The URL of the webhook endpoint that handles inbound messages

type
string
Beispielmobile-lvn

The type of number: landline, landline-toll-free or mobile-lvn

features
array

The capabilities of the number: SMS or VOICE or SMS,VOICE or SMS,MMS or VOICE,MMS or SMS,MMS,VOICE

limitations
array
feature
string
Erforderlich
BeispielSMS
Muss eines der folgenden sein:MMSSMSVOICE
type
string
Erforderlich
BeispielOUTBOUND
Muss eines der folgenden sein:INBOUNDOUTBOUND
reach
string
Erforderlich
BeispielINTERNATIONAL
Muss eines der folgenden sein:DOMESTICINTERNATIONAL
messagesCallbackType
string
Beispielapp

The messages webhook type: always app

messagesCallbackValue
string
Beispielaaaaaaaa-bbbb-cccc-dddd-0123456789ab

An Application ID

voiceCallbackType
string
Beispielapp

The voice webhook type: sip, tel, or app

voiceCallbackValue
string
Beispielaaaaaaaa-bbbb-cccc-dddd-0123456789ab

A SIP URI, telephone number or Application ID

app_id
string
Beispiel1ded6eee-e2ec-4d61-8c71-e2b2ece17d1b

The application ID linked to that number

Beispiel Antwort

{
   "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"
      }
   ]
}

Search available numbers

Retrieve inbound numbers that are available for the specified country.

gethttps://rest.nexmo.com/number/search

Authentifizierung

SchlüsselBeschreibungWoBeispiel
Authorization

Base64-kodierter API-Schlüssel und Geheimnis, verbunden durch einen Doppelpunkt.
Mehr lesen

Headers

Basic <base64>

Abfrage Parameter

country
string
Min2
Max2
BeispielGB

The two character country code to filter on (in ISO 3166-1 alpha-2 format)

type
string

Set this parameter to filter the type of number, such as mobile or landline

Muss eines der folgenden sein:landlinemobile-lvnlandline-toll-free
pattern
string

The number pattern you want to search for. Use in conjunction with search_pattern.

search_pattern
integer

The strategy you want to use for matching:

  • 0 - Search for numbers that start with pattern (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 contain pattern
  • 2 - Search for numbers that end with pattern
Muss eines der folgenden sein:012
features
string

Available features are SMS, VOICE and MMS. To look for numbers that support multiple features, use a comma-separated value: SMS,MMS,VOICE.

Muss eines der folgenden sein:SMSVOICESMS,VOICEMMSSMS,MMSVOICE,MMSSMS,MMS,VOICE
size
integer
Max100
Standard10

Page size

index
integer
Standard1

Page index

Antworten
Inhalt Typ

OK

count
integer
Beispiel1234

The total amount of numbers available in the pool.

numbers
array

A paginated array of available numbers and their details.

country
string
Min2
Max2
BeispielGB

The two character country code in ISO 3166-1 alpha-2 format

msisdn
string
Beispiel447700900000

An available inbound virtual number.

type
string
Beispielmobile-lvn

The type of number: landline, landline-toll-free or mobile-lvn

initialPrice
string
Beispiel1.25

The initial setup fee for this number, in Euros

cost
string
Beispiel1.25

The monthly rental cost for this number, in Euros

features
array

The capabilities of the number: SMS or VOICE or SMS,VOICE or SMS,MMS or VOICE,MMS or SMS,MMS,VOICE

limitations
array
feature
string
Erforderlich
BeispielSMS
Muss eines der folgenden sein:MMSSMSVOICE
type
string
Erforderlich
BeispielOUTBOUND
Muss eines der folgenden sein:INBOUNDOUTBOUND
reach
string
Erforderlich
BeispielINTERNATIONAL
Muss eines der folgenden sein:DOMESTICINTERNATIONAL

Beispiel Antwort

{
   "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"
            }
         ]
      }
   ]
}

Buy a number

Request to purchase a specific inbound number.

posthttps://rest.nexmo.com/number/buy

Authentifizierung

SchlüsselBeschreibungWoBeispiel
Authorization

Base64-kodierter API-Schlüssel und Geheimnis, verbunden durch einen Doppelpunkt.
Mehr lesen

Headers

Basic <base64>

Anfrage Körper
Inhalt Typ
application/x-www-form-urlencoded

country
string
Erforderlich
Min2
Max2
BeispielGB

The two character country code in ISO 3166-1 alpha-2 format

msisdn
string
Erforderlich
Beispiel447700900000

An available inbound virtual number.

target_api_key
string
Beispiel1a2345b7

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

Beispiel Anfrage

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=1a2345b7

Antworten
Inhalt Typ

OK

error-code
string
Beispiel200

The status code of the response. 200 indicates a successful request.

error-code-label
string
Beispielsuccess

The status code description

Beispiel Antwort

{
   "error-code": "200",
   "error-code-label": "success"
}

Cancel a number

Cancel your subscription for a specific inbound number.

posthttps://rest.nexmo.com/number/cancel

Authentifizierung

SchlüsselBeschreibungWoBeispiel
Authorization

Base64-kodierter API-Schlüssel und Geheimnis, verbunden durch einen Doppelpunkt.
Mehr lesen

Headers

Basic <base64>

Anfrage Körper
Inhalt Typ
application/x-www-form-urlencoded

country
string
Erforderlich
Min2
Max2
BeispielGB

The two character country code in ISO 3166-1 alpha-2 format

msisdn
string
Erforderlich
Beispiel447700900000

An available inbound virtual number.

target_api_key
string
Beispiel1a2345b7

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

Beispiel Anfrage

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=1a2345b7

Antworten
Inhalt Typ

OK

error-code
string
Beispiel200

The status code of the response. 200 indicates a successful request.

error-code-label
string
Beispielsuccess

The status code description

Beispiel Antwort

{
   "error-code": "200",
   "error-code-label": "success"
}

Update a number

Change the behaviour of a number that you own.

posthttps://rest.nexmo.com/number/update

Authentifizierung

SchlüsselBeschreibungWoBeispiel
Authorization

Base64-kodierter API-Schlüssel und Geheimnis, verbunden durch einen Doppelpunkt.
Mehr lesen

Headers

Basic <base64>

Anfrage Körper
Inhalt Typ
application/x-www-form-urlencoded

country
string
Erforderlich
Min2
Max2
BeispielGB

The two character country code in ISO 3166-1 alpha-2 format

msisdn
string
Erforderlich
Beispiel447700900000

An available inbound virtual number.

app_id
string
Beispielaaaaaaaa-bbbb-cccc-dddd-0123456789abc

The Application that will handle inbound traffic to this number.

moHttpUrl
string
Beispielhttps://example.com/webhooks/inbound-sms

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

moSmppSysType
string
Beispielinbound

The associated system type for your SMPP client

voiceCallbackType
string
Beispieltel

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

Muss eines der folgenden sein:siptelapp
voiceCallbackValue
string
Beispiel447700900000

A SIP URI or telephone number. Must be used with the voiceCallbackType parameter.

voiceStatusCallback
string
Beispielhttps://example.com/webhooks/status

A webhook URI for Vonage to send a request to when a call ends

messagesCallbackType
string
Beispielapp

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

Muss eines der folgenden sein:app
messagesCallbackValue
string
Beispielaaaaaaaa-bbbb-cccc-dddd-0123456789ab

DEPRECATED - We recommend that you use app_id instead.

Specifies the Application ID of your Messages application. It must be used with the messagesCallbackType parameter.

Beispiel Anfrage

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-0123456789ab

Antworten
Inhalt Typ

OK

error-code
string
Beispiel200

The status code of the response. 200 indicates a successful request.

error-code-label
string
Beispielsuccess

The status code description

Beispiel Antwort

{
   "error-code": "200",
   "error-code-label": "success"
}