---
title: VoicemailApi
---
## PureCloud::VoicemailApi
All URIs are relative to *https://api.mypurecloud.com*
Method | HTTP request | Description
------------- | ------------- | -------------
|[**delete_messages**](VoicemailApi.html#delete_messages) | **DELETE** /api/v2/voicemail/messages | Delete all voicemail messages|
|[**delete_messages_message_id**](VoicemailApi.html#delete_messages_message_id) | **DELETE** /api/v2/voicemail/messages/{messageId} | Delete a message.|
|[**get_mailbox**](VoicemailApi.html#get_mailbox) | **GET** /api/v2/voicemail/mailbox | Get mailbox information|
|[**get_messages**](VoicemailApi.html#get_messages) | **GET** /api/v2/voicemail/messages | List voicemail messages|
|[**get_messages_message_id**](VoicemailApi.html#get_messages_message_id) | **GET** /api/v2/voicemail/messages/{messageId} | Get message.|
|[**get_messages_message_id_media**](VoicemailApi.html#get_messages_message_id_media) | **GET** /api/v2/voicemail/messages/{messageId}/media | Get media playback URI for this message|
|[**get_policy**](VoicemailApi.html#get_policy) | **GET** /api/v2/voicemail/policy | Get a policy|
|[**get_userpolicies_user_id**](VoicemailApi.html#get_userpolicies_user_id) | **GET** /api/v2/voicemail/userpolicies/{userId} | Get a user's voicemail policy|
|[**patch_userpolicies_user_id**](VoicemailApi.html#patch_userpolicies_user_id) | **PATCH** /api/v2/voicemail/userpolicies/{userId} | Update a user's voicemail policy|
|[**put_messages_message_id**](VoicemailApi.html#put_messages_message_id) | **PUT** /api/v2/voicemail/messages/{messageId} | Update a message.|
|[**put_policy**](VoicemailApi.html#put_policy) | **PUT** /api/v2/voicemail/policy | Update a policy|
{: class="table table-striped"}
## -String** delete_messages
Delete all voicemail messages
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::VoicemailApi.new
begin
#Delete all voicemail messages
result = api_instance.delete_messages
p result
rescue PureCloud::ApiError => e
puts "Exception when calling VoicemailApi->delete_messages: #{e}"
end
~~~
### Parameters
This endpoint does not need any parameter.
{: class="table table-striped"}
### Return type
**String**
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -String** delete_messages_message_id(message_id)
Delete a message.
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::VoicemailApi.new
message_id = "message_id_example" # String | Message ID
begin
#Delete a message.
result = api_instance.delete_messages_message_id(message_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling VoicemailApi->delete_messages_message_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**message_id** | **String**| Message ID |
{: class="table table-striped"}
### Return type
**String**
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**VoicemailMailboxInfo**](VoicemailMailboxInfo.html) get_mailbox
Get mailbox information
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::VoicemailApi.new
begin
#Get mailbox information
result = api_instance.get_mailbox
p result
rescue PureCloud::ApiError => e
puts "Exception when calling VoicemailApi->get_mailbox: #{e}"
end
~~~
### Parameters
This endpoint does not need any parameter.
{: class="table table-striped"}
### Return type
[**VoicemailMailboxInfo**](VoicemailMailboxInfo.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**VoicemailMessageEntityListing**](VoicemailMessageEntityListing.html) get_messages
List voicemail messages
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::VoicemailApi.new
begin
#List voicemail messages
result = api_instance.get_messages
p result
rescue PureCloud::ApiError => e
puts "Exception when calling VoicemailApi->get_messages: #{e}"
end
~~~
### Parameters
This endpoint does not need any parameter.
{: class="table table-striped"}
### Return type
[**VoicemailMessageEntityListing**](VoicemailMessageEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**VoicemailMessage**](VoicemailMessage.html) get_messages_message_id(message_id)
Get message.
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::VoicemailApi.new
message_id = "message_id_example" # String | Message ID
begin
#Get message.
result = api_instance.get_messages_message_id(message_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling VoicemailApi->get_messages_message_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**message_id** | **String**| Message ID |
{: class="table table-striped"}
### Return type
[**VoicemailMessage**](VoicemailMessage.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**VoicemailMediaInfo**](VoicemailMediaInfo.html) get_messages_message_id_media(message_id, opts)
Get media playback URI for this message
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::VoicemailApi.new
message_id = "message_id_example" # String | Message ID
opts = {
format_id: "WEBM" # String | The desired media format.
}
begin
#Get media playback URI for this message
result = api_instance.get_messages_message_id_media(message_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling VoicemailApi->get_messages_message_id_media: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**message_id** | **String**| Message ID |
**format_id** | **String**| The desired media format. | [optional] [default to WEBM]
{: class="table table-striped"}
### Return type
[**VoicemailMediaInfo**](VoicemailMediaInfo.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**VoicemailOrganizationPolicy**](VoicemailOrganizationPolicy.html) get_policy
Get a policy
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::VoicemailApi.new
begin
#Get a policy
result = api_instance.get_policy
p result
rescue PureCloud::ApiError => e
puts "Exception when calling VoicemailApi->get_policy: #{e}"
end
~~~
### Parameters
This endpoint does not need any parameter.
{: class="table table-striped"}
### Return type
[**VoicemailOrganizationPolicy**](VoicemailOrganizationPolicy.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**VoicemailUserPolicy**](VoicemailUserPolicy.html) get_userpolicies_user_id(user_id)
Get a user's voicemail policy
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::VoicemailApi.new
user_id = "user_id_example" # String | User ID
begin
#Get a user's voicemail policy
result = api_instance.get_userpolicies_user_id(user_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling VoicemailApi->get_userpolicies_user_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user_id** | **String**| User ID |
{: class="table table-striped"}
### Return type
[**VoicemailUserPolicy**](VoicemailUserPolicy.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**VoicemailUserPolicy**](VoicemailUserPolicy.html) patch_userpolicies_user_id(user_id, body)
Update a user's voicemail policy
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::VoicemailApi.new
user_id = "user_id_example" # String | User ID
body = PureCloud::VoicemailUserPolicy.new # VoicemailUserPolicy | The user's voicemail policy
begin
#Update a user's voicemail policy
result = api_instance.patch_userpolicies_user_id(user_id, body)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling VoicemailApi->patch_userpolicies_user_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user_id** | **String**| User ID |
**body** | [**VoicemailUserPolicy**](VoicemailUserPolicy.html)| The user's voicemail policy |
{: class="table table-striped"}
### Return type
[**VoicemailUserPolicy**](VoicemailUserPolicy.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**VoicemailMessage**](VoicemailMessage.html) put_messages_message_id(message_id, opts)
Update a message.
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::VoicemailApi.new
message_id = "message_id_example" # String | Message ID
opts = {
body: PureCloud::VoicemailMessage.new # VoicemailMessage | VoicemailMessage
}
begin
#Update a message.
result = api_instance.put_messages_message_id(message_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling VoicemailApi->put_messages_message_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**message_id** | **String**| Message ID |
**body** | [**VoicemailMessage**](VoicemailMessage.html)| VoicemailMessage | [optional]
{: class="table table-striped"}
### Return type
[**VoicemailMessage**](VoicemailMessage.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**VoicemailOrganizationPolicy**](VoicemailOrganizationPolicy.html) put_policy(opts)
Update a policy
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::VoicemailApi.new
opts = {
body: PureCloud::VoicemailOrganizationPolicy.new # VoicemailOrganizationPolicy | Policy
}
begin
#Update a policy
result = api_instance.put_policy(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling VoicemailApi->put_policy: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**VoicemailOrganizationPolicy**](VoicemailOrganizationPolicy.html)| Policy | [optional]
{: class="table table-striped"}
### Return type
[**VoicemailOrganizationPolicy**](VoicemailOrganizationPolicy.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json