1. Send OTP to a number

To deliver an OTP to a destination number, make a POST request to the requests resource:

Basic Example for sending an OTP (JSON)

curl \
-X POST \
-H "apikey: yourApiKey" \
https://api.tyntec.com/2fa/v1/otp?number=4412312313

Response to Basic Example for sending an OTP (JSON)

HTTP/1.1 200 OK

{ accountId: 'your account id', 
  "applicationId": "2a9a2a1f-ad49-39e4-9a0e-8f2b648ebf83",
  "otpId": "b3eaee2c-c3c4-4f40-87e5-c21d07905b27",
  "number": "+4412312313",
  "attemptCount": 0,
  "otpStatus": "ACTIVE",
  "expire": 1499862186616,
  "created": 1499860686616,
  "timestampCreated": "2017-07-12T11:58:06.616Z",
  "timestampExpire": "2017-07-12T12:23:06.616Z"
 } 

* 2a9a2a1f-ad49-39e4-9a0e-8f2b648ebf83 is the uuid of the default application for this example.

* b3eaee2c-c3c4-4f40-87e5-c21d07905b27 is the uuid of the generated OTP request for this example.

 

All possible parameters for this operation

https://api.tyntec.com/2fa/v1/otp?number=&applicationId=&via=&country=&language=&text=&otpCode=

Parameter

Optional/ Mandatory

Possible Values

Description

number

mandatory

The destination telephone number

The destination telephone number can be in E164 format (with + sign or 00 prefix or without).

In case the country code is not present then the API will check the “country” provided and format the number accordingly.

applicationId

optional

The applicationId of the application you would like to use

If you have provisioned a specific setup for an application, you can include the UUID in this parameter and the settings and language templates for this application will be used.

If not specified the “default” application will be used.

Via

Optional

Possible values

  • AUTO
  • SMS
  • VOICE

You can force a delivery channel by using this parameter.

The default is “AUTO” which will use SMS in case of mobile number and VOICE in case of landline.

language

optional

String

The local language should be in ISO 639-1 format https://en.wikipedia.org/wiki/ISO_639-1

 

In case you want a specific language template to be used instead of the automatic detection, you can specify it using this parameter.

By default the API will check the national code of the destination number and will check if a language template exists for this country. If not it will default to the English template (“en” locale).

country

optional

The ISO 3166-1 alpha-2 code of the destination number.

This parameter can be used in case the country code is omitted in the destination number or because you want to be sure that the destination MSISDN number range belongs to the specific country. If it is not you will get a bad request response.

text

optional

The text template to be used for the specific OTP delivery.

In case you want to override the application template, you can specify the text to be delivered.

Placeholder {{OTP}} must exist for auto generation of OTP, otherwise otpCode should be specified as parameter

otpCode

Optional

The OTP code to be delivered instead of auto generated one.

In case you don’t want the API to auto generate the OTP for you, you can specify it in this parameter.

sender

Optional

Sender name for OTP delivery via SMS

In case you want to override the sender set in the application's configuration, you can specify a sender name for this OTP delivery

caller

Optional

Caller id for OTP delivery via Voice

In case you want to override the caller set in the application's configuration, you can specify a caller id for this OTP delivery

pinLength

Optional

Length of the auto generated PIN

In case you want to override the pin length set in the application's configuration, you can specify a length of the generated PIN for this OTP delivery