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

Descargar la especificación OpenAPI

List the numbers you own

Retrieve all the inbound numbers associated with your Vonage account.

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

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Consulta Parámetros

country
string
Min2
Max2
ejemploGB
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
Debe ser uno de:012
size
integer
Max100
Por defecto10

Page size

index
integer
Por defecto1

Page index

Respuestas
Tipo de contenido

OK

count
integer
ejemplo1

The total amount of numbers owned by the account

numbers
array

A paginated array of numbers and their details

country
string
Min2
Max2
ejemploGB

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

msisdn
string
ejemplo447700900000

An available inbound virtual number.

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

The URL of the webhook endpoint that handles inbound messages

type
string
ejemplomobile-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
Requerido
ejemploSMS
Debe ser uno de:MMSSMSVOICE
type
string
Requerido
ejemploOUTBOUND
Debe ser uno de:INBOUNDOUTBOUND
reach
string
Requerido
ejemploINTERNATIONAL
Debe ser uno de:DOMESTICINTERNATIONAL
messagesCallbackType
string
ejemploapp

The messages webhook type: always app

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

An Application ID

voiceCallbackType
string
ejemploapp

The voice webhook type: sip, tel, or app

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

A SIP URI, telephone number or Application ID

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

The application ID linked to that number

Ejemplo Respuesta

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

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Consulta Parámetros

country
string
Min2
Max2
ejemploGB

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

Debe ser uno de: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
Debe ser uno de: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.

Debe ser uno de:SMSVOICESMS,VOICEMMSSMS,MMSVOICE,MMSSMS,MMS,VOICE
size
integer
Max100
Por defecto10

Page size

index
integer
Por defecto1

Page index

Respuestas
Tipo de contenido

OK

count
integer
ejemplo1234

The total amount of numbers available in the pool.

numbers
array

A paginated array of available numbers and their details.

country
string
Min2
Max2
ejemploGB

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

msisdn
string
ejemplo447700900000

An available inbound virtual number.

type
string
ejemplomobile-lvn

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

initialPrice
string
ejemplo1.25

The initial setup fee for this number, in Euros

cost
string
ejemplo1.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
Requerido
ejemploSMS
Debe ser uno de:MMSSMSVOICE
type
string
Requerido
ejemploOUTBOUND
Debe ser uno de:INBOUNDOUTBOUND
reach
string
Requerido
ejemploINTERNATIONAL
Debe ser uno de:DOMESTICINTERNATIONAL

Ejemplo Respuesta

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

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Cuerpo de la solicitud
Tipo de contenido
application/x-www-form-urlencoded

country
string
Requerido
Min2
Max2
ejemploGB

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

msisdn
string
Requerido
ejemplo447700900000

An available inbound virtual number.

target_api_key
string
ejemplo1a2345b7

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.

Ejemplo Solicitar

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

Respuestas
Tipo de contenido

OK

error-code
string
ejemplo200

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

error-code-label
string
ejemplosuccess

The status code description

Ejemplo Respuesta

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

Cancel a number

Cancel your subscription for a specific inbound number.

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

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Cuerpo de la solicitud
Tipo de contenido
application/x-www-form-urlencoded

country
string
Requerido
Min2
Max2
ejemploGB

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

msisdn
string
Requerido
ejemplo447700900000

An available inbound virtual number.

target_api_key
string
ejemplo1a2345b7

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.

Ejemplo Solicitar

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

Respuestas
Tipo de contenido

OK

error-code
string
ejemplo200

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

error-code-label
string
ejemplosuccess

The status code description

Ejemplo Respuesta

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

Autenticación

ClaveDescripciónDóndeEjemplo
Authorization

Clave API codificada en Base64 y secreto unidos por dos puntos.
Seguir leyendo

Headers

Basic <base64>

Cuerpo de la solicitud
Tipo de contenido
application/x-www-form-urlencoded

country
string
Requerido
Min2
Max2
ejemploGB

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

msisdn
string
Requerido
ejemplo447700900000

An available inbound virtual number.

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

The Application that will handle inbound traffic to this number.

moHttpUrl
string
ejemplohttps://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
ejemploinbound

The associated system type for your SMPP client

voiceCallbackType
string
ejemplotel

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.

Debe ser uno de:siptelapp
voiceCallbackValue
string
ejemplo447700900000

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

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

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

messagesCallbackType
string
ejemploapp

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.

Debe ser uno de:app
messagesCallbackValue
string
ejemploaaaaaaaa-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.

Ejemplo Solicitar

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

Respuestas
Tipo de contenido

OK

error-code
string
ejemplo200

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

error-code-label
string
ejemplosuccess

The status code description

Ejemplo Respuesta

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