post
https://connect.routee.net/viber/otp
After authentication, you can make a request to the Viber OTP endpoint to send an OTP.
Authentication
Send a valid Bearer token in the request headers (e.g. from OAuth).
| Header | Required | Value |
|---|---|---|
Authorization | Yes | Bearer {access_token} |
Content-Type | Yes | application/json |
Request body
All fields are sent in a single JSON object. Required fields must be present; others are optional.
Top-level parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
senderInfoTrackingId | string | Yes | Unique identifier of the Viber sender (from your sender configuration). Used for routing and tracking. |
to | string | Yes | Recipient phone number in E.164 format (e.g. +306912345678). Must include + and country code. |
ttl | integer | No | Time-to-live in seconds for the OTP delivery attempt. |
seq | integer | No | Your own sequence or correlation ID for this request (e.g. for linking request and response or callbacks). |
label | string | No | Message label. Allowed values: transactional, promotional. |
type | string | No | OTP message type. Allowed values: PRIMARY_ONLY, ALL_DEVICE. |
templateId | string | No | ID of the OTP template to use. See Templates inventory. |
templateParams | object | No | Key-value map of template variables. Keys in camelCase (e.g. pin, businessPlatformName, codeValidityTime). See Template variables validation. |
templateLang | string | No | Language of the template (ISO 639-1, e.g. en, el). See Localization. |
templateParams object
templateParams objectInclude only the parameters required by the chosen template. Use camelCase keys.
| Key | Type | Description |
|---|---|---|
pin | string | The OTP code shown to the user (e.g. "847291"). |
businessPlatformName | string | Your app or platform name (e.g. "MyApp"). |
pinType | string | Type of code (e.g. "verification", "login"). |
codeValidityTime | integer | Validity duration in minutes (e.g. 5, 10, 15). |
businessPlatformActionName | string | Action or context (e.g. "logging in"). |
codeReason | string | Reason the user received the code (e.g. "you requested a password reset"). |
Response (200 OK)
On success, the API returns the tracking record for the OTP request.
| Field | Type | Description |
|---|---|---|
trackingId | string | Unique tracking ID for this OTP request. Use for status checks and callbacks. |
to | string | Recipient number (E.164), confirming who the OTP was sent to. |
from | string | Sender name or identifier. |
country | string | Country code or name of the recipient’s country. |
status | object | Current status of the OTP. |
status.status | string | Status value (e.g. QUEUED — waiting to be sent). |
status.date | string | Timestamp when the status was updated (ISO 8601). |
status.reason | object | Optional; extra reason or error details. |
applicationName | string | Name of the application sending the OTP. |
direction | string | Message direction (e.g. Outbound). |
ttl | integer | Time-to-live in seconds (echo of request). |
seq | integer | Sequence/correlation ID (echo of request). |
label | string | Label (e.g. transactional). |
type | string | OTP type (e.g. PRIMARY_ONLY). |
templateId | string | Template ID used. |
templateParams | object | Template parameters used (e.g. pin). |
templateLang | string | Template language (e.g. en). |
Error responses
| HTTP status | Description |
|---|---|
| 400 | Bad request — invalid or missing parameters (e.g. invalid to, missing required template params). |
| 401 | Invalid or expired access token. |
| 403 | Access to the resource is denied. |
| 404 | The sender information for the given senderInfoTrackingId was not found. |
See also
- Viber OTP templates inventory — template IDs and required parameters
- Template variables validation — rules for text and number variables
- Viber OTP localization — supported
templateLangvalues
