Create OTP

Denna slutpunkt låter er implementera tvåfaktorsautentisering, på det enkla viset, genom att skicka ett sms med OTP.

API-slutpunkt

POST `https://api.nomado.eu/2fa/create`

Autentisering

Du kan välja en av autentiseringsmetoderna härifrån.

Body object

Det JSON object som representerar det OTP som ska skickas. Skall inkluderas i request body.

alternativ beskrivning nödvändig default value
to string E164 formatted mobile number Ja
template string MUST contain {{CODE}} literal in it, which will be replaced by the generated OTP Nej {{CODE}}
type string Type of OTP required. Possible values: ALPHA, NUMERIC and ALPHANUMERIC Nej ALPHANUMERIC
length Integer length of the OTP required. Max 20 Nej 4
expiry Integer time in seconds after which the OTP will expire automatically. Nej 7200

Response

status code description
200 success Request sent successfully
400 bad request Incorrect or missing parameters
401 unauthorized Invalid credentials or incorrect authentication method

Request example

Headers

Content-type: application/json
Authorization: BASIC base64encodedCredentials

Body

{
  "to": "32412345678",
  "template": "Your verification code is `{{CODE}}`",
  "type": "NUMERIC",
  "length": 4,
  "expiry": 7200
}

Response example

{
    "code": 200,
    "message": "OK",
    "data": {
        "32412345678": {
            "code": 200,
            "status": "SENT"
        },
        "text": "Your verification code is 1234",
        "token": "1234",
        "expiry": 7200,
        "total_messages": 1
    }
}