Create 2FA SMS or Voice message template

Once you have your 2FA application, create one or more message templates where your PIN will be dynamically included when you send the PIN message over SMS or Voice.

Please log in to see full path URL. Learn why.
post
/2fa/2/applications/{appId}/messages
Scopes:
path Parameters
appId
required
string
Example: 0933F3BC087D2A617AC6DCB2EF5B8A61

ID of application for which requested message was created.

Request Body schema:
collapse all -
language
string
Enum: "en" "es" "ca" "da" "nl" "fr" "de" "it" "ja" "ko" "no" "pl" "ru" "sv" "fi" "hr" "sl" "ro" "pt_pt" "pt_br" "zh_cn" "zh_tw"

The language code which message is written in used when sending text-to-speech messages. If not defined, it will default to English (en).

messageText
required
string

Content of the message being sent which contains at minimum one placeholder for a PIN code ({{pin}}). Placeholder format is {{placeholderName}}.

pinLength
integer <int32>

PIN code length.

pinType
required
string
Enum: "NUMERIC" "ALPHA" "HEX" "ALPHANUMERIC"

Type of PIN code that will be generated and sent as part of 2FA message.

regional
object

Region-specific parameters, often imposed by local laws. Use this, if country or region that you are sending a message to requires additional information.

indiaDlt
object

Distributed Ledger Technology (DLT) specific parameters required for sending SMS to phone numbers registered in India.

contentTemplateId
string [ 0 .. 30 ] characters

Registered DLT content template ID which matches message you are sending.

principalEntityId
required
string [ 0 .. 30 ] characters

Your assigned DLT principal entity ID.

teleMarketerId
string [ 0 .. 255 ] characters

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). You can use this method 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).

Responses

default

successful response

400

Bad Request

401

Unauthorized

403

Forbidden

404

Not Found

4XX

Error responses

500

Internal Server Error

5XX

Error responses

Request samples

Content type
Example
Copy
Collapse all
{
  • "pinType": "NUMERIC",
  • "messageText": "Your pin is {{pin}}",
  • "pinLength": 4,
  • "language": "en",
  • "voiceName": "Joanna",
  • "senderId": "Infobip 2FA",
  • "repeatDTMF": "1#",
  • "speechRate": 1
}

Response samples

Content type
Copy
Collapse all
{
  • "messageId": "B628A31410306DDB2BFB0D9CF1F3A3FF",
  • "applicationId": "19F2491982980DBC2C40E1597FD175AB",
  • "pinPlaceholder": "{{pin}}",
  • "messageText": "Your pin is {{pin}}",
  • "pinLength": 4,
  • "pinType": "ALPHANUMERIC",
  • "language": "en",
  • "voiceName": "Joanna",
  • "senderId": "Infobip 2FA",
  • "repeatDTMF": "1#",
  • "speechRate": 1
}

Encountering issues

Contact our support

What's new? Check out

Release Notes

Unsure about a term? See

Glossary

Research panel

Help shape the future of our products
Learn more
Service status

Copyright @ 2006-2025 Infobip ltd.