Get voicemail
Returns the voicemail settings for a phone number
GET
/
phone_numbers
/
{phone_number_id}
/
voicemail
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const voicemail = await client.phoneNumbers.voicemail.retrieve('123455678900');
console.log(voicemail.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
voicemail = client.phone_numbers.voicemail.retrieve(
"123455678900",
)
print(voicemail.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
voicemail, err := client.PhoneNumbers.Voicemail.Get(context.TODO(), "123455678900")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", voicemail.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.phonenumbers.voicemail.VoicemailRetrieveParams;
import com.telnyx.sdk.models.phonenumbers.voicemail.VoicemailRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
VoicemailRetrieveResponse voicemail = client.phoneNumbers().voicemail().retrieve("123455678900");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
voicemail = telnyx.phone_numbers.voicemail.retrieve("123455678900")
puts(voicemail)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$voicemail = $client->phoneNumbers->voicemail->retrieve('123455678900');
var_dump($voicemail);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx phone-numbers:voicemail retrieve \
--api-key 'My API Key' \
--phone-number-id 123455678900curl --request GET \
--url https://api.telnyx.com/v2/phone_numbers/{phone_number_id}/voicemail \
--header 'Authorization: Bearer <token>'{
"data": {
"enabled": true,
"pin": "1234"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
The ID of the phone number.
Response
Successful response
Show child attributes
Show child attributes
Example:
{ "enabled": true, "pin": "1234" }Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const voicemail = await client.phoneNumbers.voicemail.retrieve('123455678900');
console.log(voicemail.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
voicemail = client.phone_numbers.voicemail.retrieve(
"123455678900",
)
print(voicemail.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
voicemail, err := client.PhoneNumbers.Voicemail.Get(context.TODO(), "123455678900")
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", voicemail.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.phonenumbers.voicemail.VoicemailRetrieveParams;
import com.telnyx.sdk.models.phonenumbers.voicemail.VoicemailRetrieveResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
VoicemailRetrieveResponse voicemail = client.phoneNumbers().voicemail().retrieve("123455678900");
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
voicemail = telnyx.phone_numbers.voicemail.retrieve("123455678900")
puts(voicemail)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$voicemail = $client->phoneNumbers->voicemail->retrieve('123455678900');
var_dump($voicemail);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx phone-numbers:voicemail retrieve \
--api-key 'My API Key' \
--phone-number-id 123455678900curl --request GET \
--url https://api.telnyx.com/v2/phone_numbers/{phone_number_id}/voicemail \
--header 'Authorization: Bearer <token>'{
"data": {
"enabled": true,
"pin": "1234"
}
}