Account API
Enables users to manage their Vonage API Account by programmable means. More information is available here: https://developer.vonage.com/.
Available Operations
Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Base64 encoded API key and secret joined by a colon. | Headers | Basic <base64> |
10.28The balance of the account, in EUR
Whether the account has auto-reloading enabled
truefalseExample Response
{
"value": 10.28,
"autoReload": false
}Top Up Account Balance
You can top up your account using this API when you have enabled auto-reload in the dashboard. The amount added by the top-up operation will be the same amount as was added in the payment when auto-reload was enabled. Your account balance is checked every 5-10 minutes and if it falls below the threshold and auto-reload is enabled, then it will be topped up automatically. Use this endpoint if you need to top up at times when your credit may be exhausted more quickly than the auto-reload may occur.
Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Base64 encoded API key and secret joined by a colon. | Headers | Basic <base64> |
8ef2447e69604f642ae59363aa5f781bThe transaction reference of the transaction when balance was added and auto-reload was enabled on your account.
Example Request
POST /account/top-up HTTP/1.1
Host: rest.nexmo.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 36
trx=8ef2447e69604f642ae59363aa5f781bPOST /account/top-up HTTP/1.1
Host: rest.nexmo.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 36
trx=8ef2447e69604f642ae59363aa5f781b200successExample Response
{
"error-code": "200",
"error-code-label": "success"
}Available Operations
Change Account Settings
Update the default webhook URLs associated with your account:
- Callback URL for incoming SMS messages
- Callback URL for delivery receipts
Note that the URLs you provide must be valid and active. Vonage will check that they return a 200 OK response before the setting is saved.
Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Base64 encoded API key and secret joined by a colon. | Headers | Basic <base64> |
https://example.com/webhooks/inbound-smsThe default webhook URL for inbound SMS. If an SMS is received at a Vonage number that does not have its own inbound SMS webhook configured, Vonage makes a request here. Send an empty string to unset this value.
https://example.com/webhooks/delivery-receiptThe webhook URL that Vonage makes a request to when a delivery receipt is available for an SMS sent by one of your Vonage numbers. Send an empty string to unset this value.
POST_QUERY_PARAMSThe HTTP method to use when making requests to the callback URLs.
GET_QUERY_PARAMSPOST_QUERY_PARAMSPOST_JSONExample Request
POST /account/settings HTTP/1.1
Host: rest.nexmo.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 150
moCallBackUrl=https://example.com/webhooks/inbound-sms&drCallBackUrl=https://example.com/webhooks/delivery-receipt&httpForwardMethod=POST_QUERY_PARAMSPOST /account/settings HTTP/1.1
Host: rest.nexmo.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 150
moCallBackUrl=https://example.com/webhooks/inbound-sms&drCallBackUrl=https://example.com/webhooks/delivery-receipt&httpForwardMethod=POST_QUERY_PARAMShttps://example.com/webhooks/inbound-smsThe current or updated inbound message webhook URI
https://example.com/webhooks/delivery-receiptThe current or updated delivery receipt webhook URI
30The maximum number of outbound messages per second.
30The maximum number of inbound messages per second.
30The maximum number of API calls per second.
Example Response
{
"mo-callback-url": "https://example.com/webhooks/inbound-sms",
"dr-callback-url": "https://example.com/webhooks/delivery-receipt",
"max-outbound-request": 30,
"max-inbound-request": 30,
"max-calls-per-second": 30
}Secret Management
Many of the Vonage APIs are accessed using an API key and secret. It is recommended that you change or "rotate" your secrets from time to time for security purposes. This section provides the API interface for achieving this. Note: to work on secrets for your secondary accounts, you may authenticate with your primary credentials and supply the secondary API keys as URL parameters to these API endpoints.
Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Base64 encoded API key and secret joined by a colon. | Headers | Basic <base64> |
HAL Links object
A single HAL link object
https://api.vonage.com/v1/resources/abc123The URL for the resource
Indicates if the href is a URI template
application/jsonMedia type hint for the target resource
resource-nameSecondary key for selecting link objects
Resource TitleHuman-readable title for the link
The single secrets key returns an array of API secrets
Array of API secrets
HAL Links object
A single HAL link object
https://api.vonage.com/v1/resources/abc123The URL for the resource
Indicates if the href is a URI template
application/jsonMedia type hint for the target resource
resource-nameSecondary key for selecting link objects
Resource TitleHuman-readable title for the link
ad6dc56f-07b5-46e1-a527-85530e625800Secret ID
2017-03-02T16:34:49ZCreation date/time for this secret
Example Response
{
"_links": {
"self": {
"href": "https://api.vonage.com/v1/resources/abc123",
"templated": false,
"type": "application/json",
"name": "resource-name",
"title": "Resource Title"
}
},
"_embedded": {
"secrets": [
{
"_links": {
"self": {
"href": "https://api.vonage.com/v1/resources/abc123",
"templated": false,
"type": "application/json",
"name": "resource-name",
"title": "Resource Title"
}
},
"id": "ad6dc56f-07b5-46e1-a527-85530e625800",
"created_at": "2017-03-02T16:34:49Z"
}
]
}
}Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Base64 encoded API key and secret joined by a colon. | Headers | Basic <base64> |
example-4PI-secretThe new secret must follow these rules:
- minimum 8 characters
- maximum 25 characters
- minimum 1 lower case character
- minimum 1 upper case character
- minimum 1 digit
Example Request
{
"secret": "example-4PI-secret"
}{
"secret": "example-4PI-secret"
}HAL Links object
A single HAL link object
https://api.vonage.com/v1/resources/abc123The URL for the resource
Indicates if the href is a URI template
application/jsonMedia type hint for the target resource
resource-nameSecondary key for selecting link objects
Resource TitleHuman-readable title for the link
ad6dc56f-07b5-46e1-a527-85530e625800Secret ID
2017-03-02T16:34:49ZCreation date/time for this secret
Example Response
{
"_links": {
"self": {
"href": "https://api.vonage.com/v1/resources/abc123",
"templated": false,
"type": "application/json",
"name": "resource-name",
"title": "Resource Title"
}
},
"id": "ad6dc56f-07b5-46e1-a527-85530e625800",
"created_at": "2017-03-02T16:34:49Z"
}Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Base64 encoded API key and secret joined by a colon. | Headers | Basic <base64> |
HAL Links object
A single HAL link object
https://api.vonage.com/v1/resources/abc123The URL for the resource
Indicates if the href is a URI template
application/jsonMedia type hint for the target resource
resource-nameSecondary key for selecting link objects
Resource TitleHuman-readable title for the link
ad6dc56f-07b5-46e1-a527-85530e625800Secret ID
2017-03-02T16:34:49ZCreation date/time for this secret
Example Response
{
"_links": {
"self": {
"href": "https://api.vonage.com/v1/resources/abc123",
"templated": false,
"type": "application/json",
"name": "resource-name",
"title": "Resource Title"
}
},
"id": "ad6dc56f-07b5-46e1-a527-85530e625800",
"created_at": "2017-03-02T16:34:49Z"
}Authentication
| Key | Description | Where | Example |
|---|---|---|---|
| Authorization | Base64 encoded API key and secret joined by a colon. | Headers | Basic <base64> |
Errors
The following is a non-exhaustive list of error codes that may occur while using this API.
These codes are in addition to any of our generic error codes.
| Code | Information |
|---|---|
| validation | Description The provided payload is invalid Resolution Modify your request to provide a valid payload.
|
| delete-last-secret | Description You can not delete your only API secret Resolution Add another API secret before deleting this one |