---
title: "Create voicemail"
method: POST
path: "/phone_numbers/{phone_number_id}/voicemail"
tags: ["Voicemail"]
---

# Create voicemail

`POST /phone_numbers/{phone_number_id}/voicemail`

## Request

- Base URL: `https://api.telnyx.com/v2`
- URL: `https://api.telnyx.com/v2/phone_numbers/{phone_number_id}/voicemail`
- Auth: HTTP bearer

Create voicemail settings for a phone number. You can also configure a custom greeting by setting the `greeting` object: use `mode` `custom_greeting` together with a `media_name` that points to an audio file uploaded through the Media Storage API, or `mode` `default` to use the standard system greeting.

## Request body

- VoicemailRequest
  - `pin` string: The pin used for voicemail
  - `enabled` boolean: Whether voicemail is enabled.
  - `greeting` object: Controls the greeting a caller hears before leaving a voicemail. Set `mode` to `default` to play the standard system greeting, or to `custom_greeting` to play your own audio. When `mode` is `custom_greeting`, `media_name` is required and must reference an audio file already uploaded to your account through the Media Storage API.
    - `mode` 'default' | 'custom_greeting': The greeting mode. `default` plays the standard system greeting. `custom_greeting` plays the audio referenced by `media_name`.
    - `media_name` string, nullable: The name of the media file to play as the greeting. Required when `mode` is `custom_greeting`; ignored when `mode` is `default`. The value must match the `media_name` of a file you previously uploaded with the Media Storage API (`POST /v2/media`).

## Response `200`

Successful response

- object
  - `data` VoicemailPrefResponse
    - `enabled` boolean: Whether voicemail is enabled.
    - `pin` string: The pin used for the voicemail.
    - `greeting` object: Controls the greeting a caller hears before leaving a voicemail. Set `mode` to `default` to play the standard system greeting, or to `custom_greeting` to play your own audio. When `mode` is `custom_greeting`, `media_name` is required and must reference an audio file already uploaded to your account through the Media Storage API.
      - `mode` 'default' | 'custom_greeting': The greeting mode. `default` plays the standard system greeting. `custom_greeting` plays the audio referenced by `media_name`.
      - `media_name` string, nullable: The name of the media file to play as the greeting. Required when `mode` is `custom_greeting`; ignored when `mode` is `default`. The value must match the `media_name` of a file you previously uploaded with the Media Storage API (`POST /v2/media`).

## Other responses

- `401`: Unauthorized
- `404`: Resource not found
- `422`: Bad request

## Changes

- **2026-10-15** `a72569d69430`: 2 info
  - added the new optional request property `greeting`
  - added the optional property `data/greeting` to the response with the `200` status

[Operation history](https://skmtc.dev/team-telnyx/apis/telnyx-api/changes/phone_numbers/:phone_number_id/voicemail/post.md)

---

[API](https://skmtc.dev/team-telnyx/apis/telnyx-api.md) - [All operations](https://skmtc.dev/team-telnyx/apis/telnyx-api/llms.txt) - [OpenAPI document](https://skmtc.dev/team-telnyx/apis/telnyx-api/revisions/0f17b8167873?raw)
