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

Télécharger la spécification OpenAPI

List the numbers you own

Retrieve all the inbound numbers associated with your Vonage account.

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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Demande de renseignements Paramètres

country
string
Min2
Max2
exempleGB
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
Il doit s'agir de l'un d'entre eux :012
size
integer
Max100
Défaut10

Page size

index
integer
Défaut1

Page index

Réponses
Type de contenu

OK

count
integer
exemple1

The total amount of numbers owned by the account

numbers
array

A paginated array of numbers and their details

country
string
Min2
Max2
exempleGB

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

msisdn
string
exemple447700900000

An available inbound virtual number.

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

The URL of the webhook endpoint that handles inbound messages

type
string
exemplemobile-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
Exigée
exempleSMS
Il doit s'agir de l'un d'entre eux :MMSSMSVOICE
type
string
Exigée
exempleOUTBOUND
Il doit s'agir de l'un d'entre eux :INBOUNDOUTBOUND
reach
string
Exigée
exempleINTERNATIONAL
Il doit s'agir de l'un d'entre eux :DOMESTICINTERNATIONAL
messagesCallbackType
string
exempleapp

The messages webhook type: always app

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

An Application ID

voiceCallbackType
string
exempleapp

The voice webhook type: sip, tel, or app

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

A SIP URI, telephone number or Application ID

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

The application ID linked to that number

Exemple Réponse

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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Demande de renseignements Paramètres

country
string
Min2
Max2
exempleGB

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

Il doit s'agir de l'un d'entre eux :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
Il doit s'agir de l'un d'entre eux :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.

Il doit s'agir de l'un d'entre eux :SMSVOICESMS,VOICEMMSSMS,MMSVOICE,MMSSMS,MMS,VOICE
size
integer
Max100
Défaut10

Page size

index
integer
Défaut1

Page index

Réponses
Type de contenu

OK

count
integer
exemple1234

The total amount of numbers available in the pool.

numbers
array

A paginated array of available numbers and their details.

country
string
Min2
Max2
exempleGB

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

msisdn
string
exemple447700900000

An available inbound virtual number.

type
string
exemplemobile-lvn

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

initialPrice
string
exemple1.25

The initial setup fee for this number, in Euros

cost
string
exemple1.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
Exigée
exempleSMS
Il doit s'agir de l'un d'entre eux :MMSSMSVOICE
type
string
Exigée
exempleOUTBOUND
Il doit s'agir de l'un d'entre eux :INBOUNDOUTBOUND
reach
string
Exigée
exempleINTERNATIONAL
Il doit s'agir de l'un d'entre eux :DOMESTICINTERNATIONAL

Exemple Réponse

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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Corps de la demande
Type de contenu
application/x-www-form-urlencoded

country
string
Exigée
Min2
Max2
exempleGB

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

msisdn
string
Exigée
exemple447700900000

An available inbound virtual number.

target_api_key
string
exemple1a2345b7

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.

Exemple Demande

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

Réponses
Type de contenu

OK

error-code
string
exemple200

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

error-code-label
string
exemplesuccess

The status code description

Exemple Réponse

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

Cancel a number

Cancel your subscription for a specific inbound number.

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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Corps de la demande
Type de contenu
application/x-www-form-urlencoded

country
string
Exigée
Min2
Max2
exempleGB

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

msisdn
string
Exigée
exemple447700900000

An available inbound virtual number.

target_api_key
string
exemple1a2345b7

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.

Exemple Demande

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

Réponses
Type de contenu

OK

error-code
string
exemple200

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

error-code-label
string
exemplesuccess

The status code description

Exemple Réponse

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

Authentification

CléDescriptionExemple
Authorization

Clé et secret de l'API encodés en Base64 et reliés par deux points.
En savoir plus

Headers

Basic <base64>

Corps de la demande
Type de contenu
application/x-www-form-urlencoded

country
string
Exigée
Min2
Max2
exempleGB

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

msisdn
string
Exigée
exemple447700900000

An available inbound virtual number.

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

The Application that will handle inbound traffic to this number.

moHttpUrl
string
exemplehttps://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
exempleinbound

The associated system type for your SMPP client

voiceCallbackType
string
exempletel

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.

Il doit s'agir de l'un d'entre eux :siptelapp
voiceCallbackValue
string
exemple447700900000

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

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

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

messagesCallbackType
string
exempleapp

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.

Il doit s'agir de l'un d'entre eux :app
messagesCallbackValue
string
exempleaaaaaaaa-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.

Exemple Demande

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

Réponses
Type de contenu

OK

error-code
string
exemple200

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

error-code-label
string
exemplesuccess

The status code description

Exemple Réponse

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