Create code
A subscription is required to use this API. Please contact your account manager or our sales team.
Request
POST https://api.cm.com/otp/v2/otp
HTTP headers
Header | Description |
---|---|
X-CM-ProductToken | Your product token. Retrieve from Messaging Gateway app. |
Content-Type | application/json |
Request body
{
"from": "+31601234567",
"to": "+31602345678",
"channel": "sms"
}
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
channel | string | Yes | The channel to send the code. Supported values: sms , rcs , push , whatsapp , viber , voice , email . |
digits | integer | No | The length of the code (min 4, max 10). default: 5. |
expiry | integer | No | The expiry in seconds (min 10, max 3600). default: 60 seconds. |
Parameters for channel sms
, rcs
, viber
, or push
sms
, rcs
, viber
, or push
Parameter | Type | Required | Description |
---|---|---|---|
from | string | Yes | The number or name of the sender. This must be a valid phone number in E.164 format or an alphanumeric string between 3 and 11 characters. Please note that alphanumeric senders are not supported in all countries. |
to | string | Yes | The receiver of the code. This must be a valid phone number in E.164 format. |
message | string | No | Set a custom message. You can use the placeholder {code} , this will be replaced by the actual code.Example: Your code is: {code} . |
pushAppKey | string | When channel is push | The app key. |
Parameters for channel whatsapp
whatsapp
Parameter | Type | Required | Description |
---|---|---|---|
from | string | Yes | The number or name of the sender. This must be a valid phone number in E.164 format or an alphanumeric string between 3 and 11 characters. Please note that alphanumeric senders are not supported in all countries. |
to | string | Yes | The receiver of the code. This must be a valid phone number in E.164 format. |
message | string | No | Set a custom message. You can use the placeholder {code} , this will be replaced by the actual code.Example: Your code is: {code} . This is only used as a fallback in case the message could not be delivered via WhatsApp. |
locale | string | No | The locale of the message. This must match with configured locales for the template. |
Parameters for channel voice
voice
Parameter | Type | Required | Description |
---|---|---|---|
from | string | Yes | The number of the sender. This must be a valid phone number in E.164 format. |
to | string | Yes | The number of the receiver. This must be a valid phone number in E.164 format. |
locale | string | No | Set the spoken language in the voice call. Supported values: de-DE , en-AU , en-GB , en-IN , en-US , es-ES , fr-CA , fr-FR , it-IT , ja-JP , nl-NL Default: en-GB |
anonymous | boolean | No | Set whether the number of the caller (from) is hidden in the voice call. Default: false |
message | string | No | Set a custom message to be used in the voice call. Do not include the {code} placeholder. |
Parameters for channel email
email
Parameter | Type | Required | Description |
---|---|---|---|
to | string | Yes | The email address of the receiver. |
locale | string | No | The locale for the email template. |
message | string | No | Set a custom message to be used in the email message. Do not include the {code} placeholder. |
Response
{
"id": "1e12cb10-d14a-4cd6-8d86-e5263cf122ee",
"channel": "sms",
"verified": false,
"createdAt": "2022-01-01T13:00:00+0000",
"expiresAt": "2022-01-01T13:01:00+0000"
}
Parameters
Parameter | Description |
---|---|
id | The identifier of the OTP. Use this, together with the code received via the requested channel, to verify the code. |
channel | The channel used to send the code. |
verified | Indicates if the OTP was verified. |
createdAt | The date the OTP was created. |
expiresAt | The date the OTP will expire. |
It's also possible to use your own Mobile Marketing Cloud (MMC) account to send email OTPs. This allows you to manage the email templates yourself. For example, you can change the sender, subject, and content of the email. Please contact your account manager if you would like to use your MMC account for email OTP.
Updated 2 days ago