---
title: "Create 2FA SMS or Voice message template"
method: POST
path: "/2fa/2/applications/{appId}/messages"
tags: ["platform", "2fa", "2fa-configuration", "manage-message-templates"]
---

# Create 2FA SMS or Voice message template

`POST /2fa/2/applications/{appId}/messages`

## Request

- Base URL: `https://api.infobip.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.infobip.com/2fa/2/applications/{appId}/messages`
- Auth: one of:
  - HTTP basic
  - API key in header `Authorization`
  - API key in header `Authorization`
  - OAuth 2
    - Client credentials
    - Token URL: `https://api.infobip.com/auth/1/oauth2/token`

Once you have your [2FA application](#channels/sms/2fa/2fa-configuration/create-2fa-application), create one or more [message templates](#channels/sms/2fa/2fa-configuration/create-2fa-message-template) where your PIN will be dynamically included when you send the PIN message over SMS or Voice.

## Path parameters

- `appId` string, required

## Request body

- C3b21d2ffef2552e10577daa67c904ac80618665b001ef386a4faefc515e78f3CreateSmsOrVoiceMessageRequest
  - `language` string: Language code which message is written in. This is used when sending text-to-speech messages. More about Text-to-speech functionality and supported TTS languages can be found [here](https://www.infobip.com/docs/voice-and-video/outbound-calls#text-to-speech-voice-over-broadcast). If not set, default language is `English [en]`. If voice is not set, then default voice for that specific language is used. In the case of English language, the voice is `[Joanna]`.
  - `messageText` string, required: Content of the message being sent which contains at minimum one placeholder for a PIN code (`{{pin}}`). Placeholder format is `{{placeholderName}}`.
  - `pinLength` integer: PIN code length.
  - `pinType` 'NUMERIC' | 'ALPHA' | 'HEX' | 'ALPHANUMERIC', required
  - `regional` C3b21d2ffef2552e10577daa67c904ac80618665b001ef386a4faefc515e78f3RegionalOptions
    - `indiaDlt` C3b21d2ffef2552e10577daa67c904ac80618665b001ef386a4faefc515e78f3IndiaDltOptions
      - `contentTemplateId` string: Registered DLT content template ID which matches message you are sending.
      - `principalEntityId` string: Your assigned DLT principal entity ID.
      - `teleMarketerId` string: Your assigned Telemarketer ID (required for Aggregators).
  - `repeatDTMF` string: If the PIN is sent as a voice message, the DTMF code allows the recipient to replay the message.
  - `senderId` string: The name that will appear as the sender of the 2FA message (Example: CompanyName).
  - `speechRate` number, double: The speed of narration for messages sent as voice. Supported range is from `0.5` to `2`.
  - `voiceName` string: Defines the voice that will be used for the chosen language (example: Joanna). For each supported language, we may offer different voices (learn more [here](https://www.infobip.com/docs/voice-and-video/reference#text-to-speech-languages)). You can use this [method](https://www.infobip.com/docs/api/channels/voice/voice-message/get-voices) to retrieve all voices for the given language. If not defined, it will default to the standard voice for the selected language (if available). If the standard voice is not available, the request will fail. To avoid that, you can choose one of the neural voices (charges will apply).

## Response `200`

successful response

- C3b21d2ffef2552e10577daa67c904ac80618665b001ef386a4faefc515e78f3SmsOrVoiceMessage
  - `applicationId` string: The ID of the application that represents your service (e.g. 2FA for login, 2FA for changing the password, etc.) for which the requested message has been created.
  - `language` string: Language code which message is written in. This is used when sending text-to-speech messages. More about Text-to-speech functionality and supported TTS languages can be found [here](https://www.infobip.com/docs/voice-and-video/outbound-calls#text-to-speech-voice-over-broadcast). If not set, default language is `English [en]`. If voice is not set, then default voice for that specific language is used. In the case of English language, the voice is `[Joanna]`.
  - `messageId` string: The ID of the message template (message body with the PIN placeholder) that is sent to the recipient.
  - `messageText` string: Text of a message that will be sent. Message text must contain `pinPlaceholder`.
  - `pinLength` integer: PIN code length.
  - `pinPlaceholder` string: The PIN code placeholder that will be replaced with a generated PIN code.
  - `pinType` 'NUMERIC' | 'ALPHA' | 'HEX' | 'ALPHANUMERIC'
  - `regional` C3b21d2ffef2552e10577daa67c904ac80618665b001ef386a4faefc515e78f3RegionalOptions
    - `indiaDlt` C3b21d2ffef2552e10577daa67c904ac80618665b001ef386a4faefc515e78f3IndiaDltOptions
      - `contentTemplateId` string: Registered DLT content template ID which matches message you are sending.
      - `principalEntityId` string: Your assigned DLT principal entity ID.
      - `teleMarketerId` string: Your assigned Telemarketer ID (required for Aggregators).
  - `repeatDTMF` string: In case PIN message is sent by Voice, DTMF code will enable replaying the message.
  - `senderId` string: The name that will appear as the sender of the 2FA message (Example: CompanyName).
  - `speechRate` number, double: In case PIN message is sent by Voice, the speed of speech can be set for the message. Supported range is from `0.5` to `2`.
  - `voiceName` string: Defines the voice that will be used for the chosen language (example: Joanna). For each supported language, we may offer different voices (learn more [here](https://www.infobip.com/docs/voice-and-video/reference#text-to-speech-languages)). You can use this [method](https://www.infobip.com/docs/api/channels/voice/voice-message/get-voices) to retrieve all voices for the given language. If not defined, it will default to the standard voice for the selected language (if available). If the standard voice is not available, the request will fail. To avoid that, you can choose one of the neural voices (charges will apply).

## Other responses

- `400`: Bad Request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not Found
- `500`: Internal Server Error
- `4XX`: Error responses
- `5XX`: Error responses

---

[API](https://skmtc.dev/infobip/apis/infobip-openapi-specification.md) - [All operations](https://skmtc.dev/infobip/apis/infobip-openapi-specification/llms.txt) - [OpenAPI document](https://skmtc.dev/infobip/apis/infobip-openapi-specification/revisions/9dcbbaf902de?raw)
