Send a Viber Verification Message (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).

HeaderRequiredValue
AuthorizationYesBearer {access_token}
Content-TypeYesapplication/json

Request body

All fields are sent in a single JSON object. Required fields must be present; others are optional.

Top-level parameters

ParameterTypeRequiredDescription
senderInfoTrackingIdstringYesUnique identifier of the Viber sender (from your sender configuration). Used for routing and tracking.
tostringYesRecipient phone number in E.164 format (e.g. +306912345678). Must include + and country code.
ttlintegerNoTime-to-live in seconds for the OTP delivery attempt.
seqintegerNoYour own sequence or correlation ID for this request (e.g. for linking request and response or callbacks).
labelstringNoMessage label. Allowed values: transactional, promotional.
typestringNoOTP message type. Allowed values: PRIMARY_ONLY, ALL_DEVICE.
templateIdstringNoID of the OTP template to use. See Templates inventory.
templateParamsobjectNoKey-value map of template variables. Keys in camelCase (e.g. pin, businessPlatformName, codeValidityTime). See Template variables validation.
templateLangstringNoLanguage of the template (ISO 639-1, e.g. en, el). See Localization.

templateParams object

Include only the parameters required by the chosen template. Use camelCase keys.

KeyTypeDescription
pinstringThe OTP code shown to the user (e.g. "847291").
businessPlatformNamestringYour app or platform name (e.g. "MyApp").
pinTypestringType of code (e.g. "verification", "login").
codeValidityTimeintegerValidity duration in minutes (e.g. 5, 10, 15).
businessPlatformActionNamestringAction or context (e.g. "logging in").
codeReasonstringReason 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.

FieldTypeDescription
trackingIdstringUnique tracking ID for this OTP request. Use for status checks and callbacks.
tostringRecipient number (E.164), confirming who the OTP was sent to.
fromstringSender name or identifier.
countrystringCountry code or name of the recipient’s country.
statusobjectCurrent status of the OTP.
status.statusstringStatus value (e.g. QUEUED — waiting to be sent).
status.datestringTimestamp when the status was updated (ISO 8601).
status.reasonobjectOptional; extra reason or error details.
applicationNamestringName of the application sending the OTP.
directionstringMessage direction (e.g. Outbound).
ttlintegerTime-to-live in seconds (echo of request).
seqintegerSequence/correlation ID (echo of request).
labelstringLabel (e.g. transactional).
typestringOTP type (e.g. PRIMARY_ONLY).
templateIdstringTemplate ID used.
templateParamsobjectTemplate parameters used (e.g. pin).
templateLangstringTemplate language (e.g. en).

Error responses

HTTP statusDescription
400Bad request — invalid or missing parameters (e.g. invalid to, missing required template params).
401Invalid or expired access token.
403Access to the resource is denied.
404The sender information for the given senderInfoTrackingId was not found.

See also

Language