Skip to content
Last updated

Send an OTP message

Use this endpoint to send a one-time password (OTP) via WhatsApp using a pre-approved authentication template.
Before making requests, ensure you have configured authentication.

For the full technical reference, see the OpenAPI specification.

Endpoint

POST /api/services/send-otp

Headers

NameRequiredDescription
AuthorizationYesBasic Auth credentials. See Authentication.
X-Api-KeyYesAPI key for the account. See Authentication.
Content-TypeYesMust be application/json.
Authentication templates

Authentication templates use WhatsApp's preset message text: <VERIFICATION_CODE> is your verification code.
The OTP code you provide replaces <VERIFICATION_CODE>. Parameters are limited to 15 characters.
See Authentication templates for details on components and button behavior.

Body parameters

ParameterTypeRequiredDescription
tostringYesDestination phone number in E.164 format (e.g. +390000000000)
languagestringYesTemplate language code (e.g. it, en). See supported languages. Falls back to the template's default language if not found.
templateIdintegerYesThe authentication template ID to use
otpstringYesThe OTP code to send (max 15 characters, e.g. "123456")
referenceobjectNoTracking information: service (optional), action (optional), key (optional)
lrastringNoLocal Registration Authority (LRA) identifier
businessRelationIdstringNoOne Platform Business Relation ID. If specified, consumption is attributed to this BRI.

Request example

{
  "to": "+390000000000",
  "language": "it",
  "templateId": 1,
  "otp": "123456",
  "reference": {
    "service": "DIGITALSIGN",
    "action": "2FA",
    "key": "ext-key-002"
  }
}

Response examples

200 — Message sent

{
  "messageId": "3425151601"
}

The messageId uniquely identifies the sent message and can be used to track its delivery status.

Error codes

HTTP StatusError codeError typeSolution
4003ConstraintViolationExceptionCheck the request parameters against the API documentation
4007InvalidTemplateExceptionThe specified templateId does not exist or is not available for your account
4008WrongNumberExceptionVerify the to number is in valid E.164 format

For authentication errors (code 1, 6, 9), see Authentication.

FAQ

What happens if the language does not exist for a templateId?

Each template has a default language defined in its configuration. If the language specified in the request does not exist for the given templateId, the API automatically falls back to the template's default language.