# 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](/products/whatsapp/enterprise-documentation/developer-documentation/authentication).

For the full technical reference, see the [OpenAPI specification](/products/whatsapp/openapi/services/sendwhatsappotp).

#### Endpoint


```
POST /api/services/send-otp
```

#### Headers

| Name | Required | Description |
|  --- | --- | --- |
| `Authorization` | Yes | Basic Auth credentials. See [Authentication](/products/whatsapp/enterprise-documentation/developer-documentation/authentication). |
| `X-Api-Key` | Yes | API key for the account. See [Authentication](/products/whatsapp/enterprise-documentation/developer-documentation/authentication). |
| `Content-Type` | Yes | Must 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](/products/whatsapp/enterprise-documentation/developer-documentation/integration-guide/authentication-templates) for details on components and button behavior.

#### Body parameters

| Parameter | Type | Required | Description |
|  --- | --- | --- | --- |
| `to` | string | Yes | Destination phone number in E.164 format (e.g. `+390000000000`) |
| `language` | string | Yes | Template language code (e.g. `it`, `en`). See [supported languages](https://developers.facebook.com/docs/whatsapp/api/messages/message-templates#supported-languages). Falls back to the template's default language if not found. |
| `templateId` | integer | Yes | The authentication template ID to use |
| `otp` | string | Yes | The OTP code to send (max 15 characters, e.g. `"123456"`) |
| `reference` | object | No | Tracking information: `service` (optional), `action` (optional), `key` (optional) |
| `lra` | string | No | Local Registration Authority (LRA) identifier |
| `businessRelationId` | string | No | One Platform Business Relation ID. If specified, consumption is attributed to this BRI. |


#### Request example


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

#### Response examples

**200 — Message sent**


```json
{
  "messageId": "3425151601"
}
```

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

#### Error codes

| HTTP Status | Error code | Error type | Solution |
|  --- | --- | --- | --- |
| `400` | 3 | `ConstraintViolationException` | Check the request parameters against the API documentation |
| `400` | 7 | `InvalidTemplateException` | The specified `templateId` does not exist or is not available for your account |
| `400` | 8 | `WrongNumberException` | Verify the `to` number is in valid E.164 format |


For authentication errors (code 1, 6, 9), see [Authentication](/products/whatsapp/enterprise-documentation/developer-documentation/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.