Code copied successfuly

Introduction

Version: v4

Specification Release Notes Other versions

Introducing our OTP Management Endpoint, a dynamic gateway for users to seamlessly dispatch OTP (One-Time Password) messages to end users. This intuitive interface allows users to select a specific profile and priority, ensuring optimal delivery of time-sensitive codes. By leveraging this endpoint, users can efficiently trigger OTP messages, harmonizing profile personalization and priority-based distribution for an enhanced and secure user experience.

Base URLs

OTP Management API

Version: v4

Base URLs

OTP Management

The OTP Management Endpoint provides versatile functionality to efficiently manage the message dispatch, verification, and generation of One-Time Password (OTP) for end users. This endpoint enables users to send OTP messages with specific profiles and priorities, enhancing the user experience while maintaining flexibility. It ensures efficient and secure delivery of time-sensitive codes, verify provided OTP codes, and generate new OTP codes if not provided.

List OTP Codes

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/otp \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/otp HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/otp',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/otp',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/otp', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/otp', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/otp");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/otp", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/otp

Lists All OTP Codes

Parameters

Name In Type Required Description
to query string false Number of the OTP receiver to be searched for
otpStatus query string false Status of the OTP to be searched for
Enumerated values
Parameter Value
otpStatus VERIFIED
otpStatus TOO_MANY_ATTEMPTS

Example responses

200 Response

[
  {
    "allowedAttempts": 0,
    "attemptCount": 0,
    "otpCreated": "2019-08-24T14:15:22Z",
    "otpExpire": "2019-08-24T14:15:22Z",
    "otpId": "0034ac53-7e64-4537-955d-75054d8aaf44",
    "otpStatus": "ACTIVE",
    "to": "string"
  }
]

Responses

Status Meaning Description Schema
200 OK OK Inline
400 Bad Request Constraint violation ConstraintViolationResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema
Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [OTPGetResponse] false none none
» allowedAttempts integer(int32) false none none
» attemptCount integer(int32) false none none
» otpCreated string(date-time) false none none
» otpExpire string(date-time) false none none
» otpId string(uuid) false none none
» otpStatus string false none none
» to string false none none
Enumerated values
Property Value
otpStatus ACTIVE
otpStatus VERIFIED
otpStatus EXPIRED
otpStatus WRONG_CODE
otpStatus TOO_MANY_ATTEMPTS

Send OTP

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/2fa/v4/otp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

POST https://api.tyntec.com/2fa/v4/otp HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "caller": "Tyntec GmbH",
  "languageCode": "en_US",
  "otpCode": "1abc3r",
  "priorityName": "tyntec_priority_sms-viber",
  "profileName": "tyntec_profile_register",
  "sender": "Tyntec GmbH",
  "senderViber": "12345",
  "senderWA": "000000000000",
  "to": "+0000000000000"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/otp',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/2fa/v4/otp',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/2fa/v4/otp', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/2fa/v4/otp', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/otp");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/2fa/v4/otp", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /2fa/v4/otp

Sends OTP to Number

Body parameter

{
  "caller": "Tyntec GmbH",
  "languageCode": "en_US",
  "otpCode": "1abc3r",
  "priorityName": "tyntec_priority_sms-viber",
  "profileName": "tyntec_profile_register",
  "sender": "Tyntec GmbH",
  "senderViber": "12345",
  "senderWA": "000000000000",
  "to": "+0000000000000"
}

Parameters

Name In Type Required Description
body body NewOTPRequest true OTP Request to be sent

Example responses

202 Response

{
  "id": "c3dec0cd-6305-4d74-8d0d-629f9a43de85"
}

Responses

Status Meaning Description Schema
202 Accepted Accepted CreatedOTPResponse
400 Bad Request Constraint violation ConstraintViolationSchema
500 Internal Server Error Internal Server Error InternalServerErrorSchema

Delete OTP Status

Code samples

# You can also use wget
curl -X DELETE https://api.tyntec.com/2fa/v4/otp/{otp-id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

DELETE https://api.tyntec.com/2fa/v4/otp/{otp-id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/otp/{otp-id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.delete 'https://api.tyntec.com/2fa/v4/otp/{otp-id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.delete('https://api.tyntec.com/2fa/v4/otp/{otp-id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.tyntec.com/2fa/v4/otp/{otp-id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/otp/{otp-id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://api.tyntec.com/2fa/v4/otp/{otp-id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /2fa/v4/otp/{otp-id}

Deletes the OTP Status by specified ID

Parameters

Name In Type Required Description
otp-id path string true Id of OTP in UUID format

Example responses

500 Response

{
  "detail": "Unexpected error occurred on server",
  "status": 500,
  "title": "Internal Server Error"
}

Responses

Status Meaning Description Schema
200 OK OK None
500 Internal Server Error Internal Server Error InternalServerErrorSchema

Read OTP Status

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/otp/{otp-id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/otp/{otp-id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/otp/{otp-id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/otp/{otp-id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/otp/{otp-id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/otp/{otp-id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/otp/{otp-id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/otp/{otp-id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/otp/{otp-id}

Returns details of a OTP Status by specified ID.

Parameters

Name In Type Required Description
otp-id path string true Id of OTP in UUID format

Example responses

200 Response

{
  "allowedAttempts": 0,
  "attemptCount": 0,
  "otpCreated": "2019-08-24T14:15:22Z",
  "otpExpire": "2019-08-24T14:15:22Z",
  "otpId": "0034ac53-7e64-4537-955d-75054d8aaf44",
  "otpStatus": "ACTIVE",
  "to": "string"
}

Responses

Status Meaning Description Schema
200 OK OK OTPGetResponse
404 Not Found Not Found NotFoundSchema
500 Internal Server Error Internal Server Error InternalServerErrorSchema

Validate OTP Code

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/2fa/v4/otp/{otp-id}/validate \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

POST https://api.tyntec.com/2fa/v4/otp/{otp-id}/validate HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "otpCode": "1frtq45"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/otp/{otp-id}/validate',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/2fa/v4/otp/{otp-id}/validate',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/2fa/v4/otp/{otp-id}/validate', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/2fa/v4/otp/{otp-id}/validate', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/otp/{otp-id}/validate");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/2fa/v4/otp/{otp-id}/validate", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /2fa/v4/otp/{otp-id}/validate

Validates OTP Code.

Body parameter

{
  "otpCode": "1frtq45"
}

Parameters

Name In Type Required Description
otp-id path string true Id of OTP in UUID format
body body ValidateOTPRequest true none

Example responses

200 Response

{
  "otpStatus": "VERIFIED"
}

Responses

Status Meaning Description Schema
200 OK OK ValidateOTPResponse
400 Bad Request Constraint violation ConstraintViolationSchema
500 Internal Server Error Internal Server Error InternalServerErrorSchema

Schemas

ConstraintViolationResponseSchema

{
  "status": 400,
  "title": "Constraint Violation",
  "violations": [
    {
      "field": "field_name",
      "message": "must not be blank"
    }
  ]
}

Constraint Violation

Properties

Name Type Required Restrictions Description
status integer(int64) false none Http Status code
title string false none Invalid request body parameters
violations [ViolationResponseSchema] false none List of violations

ConstraintViolationSchema

{
  "status": 400,
  "title": "Constraint Violation",
  "violations": [
    {
      "field": "field_name",
      "message": "must not be blank"
    }
  ]
}

Constraint Violation

Properties

Name Type Required Restrictions Description
status integer(int64) false none Http Status code
title string false none Invalid request body parameters
violations [ViolationResponseSchema] false none List of violations

CreatedOTPResponse

{
  "id": "c3dec0cd-6305-4d74-8d0d-629f9a43de85"
}

OTP Response

Properties

Name Type Required Restrictions Description
id string(uuid) false none Id of OTP

ErrorResponseSchema

{
  "accountId": "8561cca6-682a-47e7-9b55-0c4be1d4033e",
  "detail": "Unexpected error occurred on server",
  "status": 500,
  "templateName": "otp_template_test",
  "title": "Internal Server Error"
}

Internal Server Error

Properties

Name Type Required Restrictions Description
accountId string false none Customers WhatsApp account id, if applicable
detail string false none Description of an error
status integer(int64) false none Http Status code
templateName string false none The template Name, if applicable
title string false none The server encountered an unexpected condition

InternalServerErrorSchema

{
  "detail": "Unexpected error occurred on server",
  "status": 500,
  "title": "Internal Server Error"
}

Internal Server Error

Properties

Name Type Required Restrictions Description
detail string false none Description of an error
status integer(int64) false none Http Status code
title string false none The server encountered an unexpected condition

NewOTPRequest

{
  "caller": "Tyntec GmbH",
  "languageCode": "en_US",
  "otpCode": "1abc3r",
  "priorityName": "tyntec_priority_sms-viber",
  "profileName": "tyntec_profile_register",
  "sender": "Tyntec GmbH",
  "senderViber": "12345",
  "senderWA": "000000000000",
  "to": "+0000000000000"
}

New OTP Request

Properties

Name Type Required Restrictions Description
caller string false none VOICE caller of this request.
languageCode string false none The Language Code to be used in this request
otpCode string false none The OTP code to be used in this request, it accepts only lowercase letters
priorityName string false none Name of the Priority
profileName string false none Name of the Profile
sender string false none SMS sender of this request.
senderViber string false none Viber service ID from which the request will be sent.
senderWA string false none Whatsapp phone number from which the request will be sent.
to string false none Number of the message receiver
Enumerated values
Property Value
languageCode ar
languageCode bg
languageCode ca
languageCode zh_CN
languageCode zh_HK
languageCode zh_TW
languageCode hr
languageCode cs
languageCode da
languageCode nl
languageCode en
languageCode en_GB
languageCode en_US
languageCode fi
languageCode fr
languageCode de
languageCode el
languageCode he
languageCode hu
languageCode id
languageCode it
languageCode ja
languageCode ko
languageCode ms
languageCode nb
languageCode pl
languageCode pt_BR
languageCode pt_PT
languageCode ro
languageCode ru
languageCode sk
languageCode sl
languageCode es
languageCode es_ES
languageCode es_MX
languageCode sv
languageCode ta
languageCode te
languageCode th
languageCode tr
languageCode vi

NotFoundSchema

{
  "detail": "Resource with ID 6f1f2438-f1bf-4ba0-892a-d6a3f5692a11 not found",
  "resourceId": "6f1f2438-f1bf-4ba0-892a-d6a3f5692a11",
  "status": 404,
  "title": "No Resource Found"
}

Not Found

Properties

Name Type Required Restrictions Description
detail string false none Explanation message
resourceId string false none ID of the Resource
status integer(int64) false none Not Found Http Status code
title string false none Resource not found on the server

OTPGetResponse

{
  "allowedAttempts": 0,
  "attemptCount": 0,
  "otpCreated": "2019-08-24T14:15:22Z",
  "otpExpire": "2019-08-24T14:15:22Z",
  "otpId": "0034ac53-7e64-4537-955d-75054d8aaf44",
  "otpStatus": "ACTIVE",
  "to": "string"
}

Properties

Name Type Required Restrictions Description
allowedAttempts integer(int32) false none none
attemptCount integer(int32) false none none
otpCreated string(date-time) false none none
otpExpire string(date-time) false none none
otpId string(uuid) false none none
otpStatus string false none none
to string false none none
Enumerated values
Property Value
otpStatus ACTIVE
otpStatus VERIFIED
otpStatus EXPIRED
otpStatus WRONG_CODE
otpStatus TOO_MANY_ATTEMPTS

ValidateOTPRequest

{
  "otpCode": "1frtq45"
}

Validate OTP

Properties

Name Type Required Restrictions Description
otpCode string false none OTP Code to be validated

ValidateOTPResponse

{
  "otpStatus": "VERIFIED"
}

Properties

Name Type Required Restrictions Description
otpStatus string false none OTP Status of the validation
Enumerated values
Property Value
otpStatus VERIFIED
otpStatus EXPIRED
otpStatus TOO_MANY_ATTEMPTS
otpStatus ALREADY_REPORTED
otpStatus WRONG_CODE

ViolationResponseSchema

{
  "field": "field_name",
  "message": "must not be blank"
}

Violations

Properties

Name Type Required Restrictions Description
field string false none The field which is violated
message string false none Indicates the constraint violation

Configuration Management API

Version: v4

Base URLs

Callback Configuration Management

The Callback Configuration API allows users to register callback configurations for receiving message delivery status updates. Users can specify a callback URL where delivery status notifications will be sent. Additionally, users can include custom headers in the callback request for authentication or other purposes.

List Callback Configurations

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/configurations/callbacks \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/configurations/callbacks HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/configurations/callbacks',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/configurations/callbacks',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/configurations/callbacks', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/configurations/callbacks', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/configurations/callbacks");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/configurations/callbacks", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/configurations/callbacks

Lists all Callback Configurations.

Example responses

200 Response

[
  {
    "headers": {
      "property1": "string",
      "property2": "string"
    },
    "id": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
    "profileId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
    "url": "https://example.com/callback"
  }
]

Responses

Status Meaning Description Schema
200 OK OK Inline
500 Internal Server Error Internal Server Error ErrorResponseSchema
Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [CallbackConfigurationDTO] false none none
» headers object false none Callback Request Headers
»» Headers string false none Callback Request Headers
» id string(uuid) false none ID of the Callback
» profileId string(uuid) false none Id of the profile for which the callbacks will be filtered
» url string false none Callback URL

Create Callback Configuration

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/2fa/v4/configurations/callbacks \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

POST https://api.tyntec.com/2fa/v4/configurations/callbacks HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "headers": {
    "property1": "string",
    "property2": "string"
  },
  "profileId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "url": "https://example.com/callback"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/configurations/callbacks',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/2fa/v4/configurations/callbacks',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/2fa/v4/configurations/callbacks', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/2fa/v4/configurations/callbacks', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/configurations/callbacks");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/2fa/v4/configurations/callbacks", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /2fa/v4/configurations/callbacks

Sends OTP events to the callback URL registered.

  • DISPATCHED
  • DELIVERED
  • UNDELIVERABLE
  • TIMED_OUT

For details on error handling, you can refer to the following documentation pages:

Body parameter

{
  "headers": {
    "property1": "string",
    "property2": "string"
  },
  "profileId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "url": "https://example.com/callback"
}

Parameters

Name In Type Required Description
body body NewCallbackConfigurationDTO true none

Example responses

201 Response

{
  "id": "a4762c77-94cb-43d6-bbab-9f37e088ad11"
}

Responses

Status Meaning Description Schema
201 Created Created CallbackConfigurationResponse
400 Bad Request Constraint violation ConstraintViolationResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Delete Callback Configuration

Code samples

# You can also use wget
curl -X DELETE https://api.tyntec.com/2fa/v4/configurations/callbacks/{id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

DELETE https://api.tyntec.com/2fa/v4/configurations/callbacks/{id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/configurations/callbacks/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.delete 'https://api.tyntec.com/2fa/v4/configurations/callbacks/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.delete('https://api.tyntec.com/2fa/v4/configurations/callbacks/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.tyntec.com/2fa/v4/configurations/callbacks/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/configurations/callbacks/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://api.tyntec.com/2fa/v4/configurations/callbacks/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /2fa/v4/configurations/callbacks/{id}

Deletes the Callback Configuration by specified ID

Parameters

Name In Type Required Description
id path string true none

Example responses

400 Response

{
  "status": 400,
  "title": "Constraint Violation",
  "violations": [
    {
      "field": "name",
      "message": "must not be blank"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Constraint violation ConstraintViolationResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Patch Callback Configuration

Code samples

# You can also use wget
curl -X PATCH https://api.tyntec.com/2fa/v4/configurations/callbacks/{id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

PATCH https://api.tyntec.com/2fa/v4/configurations/callbacks/{id} HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "headers": {
    "property1": "string",
    "property2": "string"
  },
  "profileId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "url": "https://example.com/callback"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/configurations/callbacks/{id}',
{
  method: 'PATCH',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.patch 'https://api.tyntec.com/2fa/v4/configurations/callbacks/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.patch('https://api.tyntec.com/2fa/v4/configurations/callbacks/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PATCH','https://api.tyntec.com/2fa/v4/configurations/callbacks/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/configurations/callbacks/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PATCH", "https://api.tyntec.com/2fa/v4/configurations/callbacks/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PATCH /2fa/v4/configurations/callbacks/{id}

Patches the Callback Configuration by specified ID

Body parameter

{
  "headers": {
    "property1": "string",
    "property2": "string"
  },
  "profileId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "url": "https://example.com/callback"
}

Parameters

Name In Type Required Description
id path string true none
body body PatchCallbackConfigurationDTO true none

Example responses

200 Response

{
  "headers": {
    "property1": "string",
    "property2": "string"
  },
  "id": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "profileId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "url": "https://example.com/callback"
}

Responses

Status Meaning Description Schema
200 OK OK CallbackConfigurationDTO
400 Bad Request Constraint violation ConstraintViolationResponseSchema
404 Not Found Not Found NotFoundSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

WhatsApp Configuration Management

The WhatsApp Configuration Endpoint provides a centralized method to set up and manage your WhatsApp integration by defining the WhatsApp Account ID. This endpoint enables users to configure the essential WhatsApp Account ID, which will be used for all subsequent requests towards the WhatsApp.

Read WhatsApp Configuration

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/configurations/channels/whatsapp

Returns details of a WhatsApp Configuration.

Example responses

200 Response

{
  "whatsAppAccountId": "289a1c20-06c5-4964-b32d-24d214a78ae5"
}

Responses

Status Meaning Description Schema
200 OK OK WhatsAppConfigResponse
404 Not Found Not Found NotFoundSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Create WhatsApp Configuration

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

POST https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "whatsAppAccountId": "289a1c20-06c5-4964-b32d-24d214a78ae5"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/2fa/v4/configurations/channels/whatsapp", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /2fa/v4/configurations/channels/whatsapp

Creates a new WhatsApp Configuration.

Body parameter

{
  "whatsAppAccountId": "289a1c20-06c5-4964-b32d-24d214a78ae5"
}

Parameters

Name In Type Required Description
body body NewWhatsAppConfigRequest true none

Example responses

400 Response

{
  "status": 400,
  "title": "Constraint Violation",
  "violations": [
    {
      "field": "name",
      "message": "must not be blank"
    }
  ]
}

Responses

Status Meaning Description Schema
201 Created Created None
400 Bad Request Constraint violation ConstraintViolationResponseSchema
409 Conflict Constraint violation ConflictResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema
Response Schema

Schemas

CallbackConfigurationDTO

{
  "headers": {
    "property1": "string",
    "property2": "string"
  },
  "id": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "profileId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "url": "https://example.com/callback"
}

Properties

Name Type Required Restrictions Description
headers object false none Callback Request Headers
» Headers string false none Callback Request Headers
id string(uuid) false none ID of the Callback
profileId string(uuid) false none Id of the profile for which the callbacks will be filtered
url string false none Callback URL

CallbackConfigurationResponse

{
  "id": "a4762c77-94cb-43d6-bbab-9f37e088ad11"
}

Properties

Name Type Required Restrictions Description
id string(uuid) false none ID of the Callback

CallbackConflictResponseSchema

{
  "detail": "Callback configuration already exists.",
  "status": 409,
  "title": "Conflict"
}

Conflict

Properties

Name Type Required Restrictions Description
detail string false none Description of conflict
status integer(int64) false none Http Status code
title string false none Http Status text

ConflictResponseSchema

{
  "detail": "WhatsApp configuration already exist.",
  "status": 409,
  "title": "Conflict"
}

Conflict

Properties

Name Type Required Restrictions Description
detail string false none Description of conflict
status integer(int64) false none Http Status code
title string false none Http Status text

ConstraintViolationResponseSchema

{
  "status": 400,
  "title": "Constraint Violation",
  "violations": [
    {
      "field": "name",
      "message": "must not be blank"
    }
  ]
}

Constraint Violation

Properties

Name Type Required Restrictions Description
status integer(int64) false none Http Status code
title string false none Invalid request body parameters
violations [ViolationResponseSchema] false none List of violations

Error

{
  "code": "tyntec::internal::500",
  "message": "Internal Server Error"
}

Error

Properties

Name Type Required Restrictions Description
code string false none Error code
message string false none Error message

ErrorResponseSchema

{
  "detail": "Unexpected error occurred on server",
  "status": 500,
  "title": "Internal Server Error"
}

Internal Server Error

Properties

Name Type Required Restrictions Description
detail string false none Description of an error
status integer(int64) false none Http Status code
title string false none The server encountered an unexpected condition

NewCallbackConfigurationDTO

{
  "headers": {
    "property1": "string",
    "property2": "string"
  },
  "profileId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "url": "https://example.com/callback"
}

New Callback Configuration

Properties

Name Type Required Restrictions Description
headers object false none Callback Request Headers
» Headers string false none Callback Request Headers
profileId string false none Id of the profile for which the callbacks will be filtered
url string true none Callback URL

NewWhatsAppConfigRequest

{
  "whatsAppAccountId": "289a1c20-06c5-4964-b32d-24d214a78ae5"
}

New WhatsApp Configuration

Properties

Name Type Required Restrictions Description
whatsAppAccountId string true none Id of WhatsApp Account

NotFoundSchema

{
  "detail": "Resource with ID 6f1f2438-f1bf-4ba0-892a-d6a3f5692a11 not found",
  "resourceId": "6f1f2438-f1bf-4ba0-892a-d6a3f5692a11",
  "status": 404,
  "title": "No Resource Found"
}

Not Found

Properties

Name Type Required Restrictions Description
detail string false none Explanation message
resourceId string false none ID of the Resource
status integer(int64) false none Not Found Http Status code
title string false none Resource not found on the server

PatchCallbackConfigurationDTO

{
  "headers": {
    "property1": "string",
    "property2": "string"
  },
  "profileId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "url": "https://example.com/callback"
}

Patch Callback Configuration

Properties

Name Type Required Restrictions Description
headers object false none Callback Request Headers
» Headers string false none Callback Request Headers
profileId string false none Id of the profile for which the callbacks will be filtered
url string true none Callback URL

ViolationResponseSchema

{
  "field": "name",
  "message": "must not be blank"
}

Violations

Properties

Name Type Required Restrictions Description
field string false none The field which is violated
message string false none Indicates the constraint violation

WebhookStatusMessage

{
  "channel": "SMS",
  "otpId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "status": "DISPATCHED",
  "timestamp": "2023-11-15T03:00:00Z"
}

Properties

Name Type Required Restrictions Description
channel string false none Channel of Delivery
otpId string(uuid) false none Unique identifier of the OTP
status string false none Status of the OTP Delivery
timestamp string(date-time) false none Timestamp of the OTP event
Enumerated values
Property Value
channel SMS
channel VOICE
channel VIBER
channel WHATSAPP
status DISPATCHED
status TIMED_OUT
status DELIVERED
status UNDELIVERABLE

WebhookStatusWithError

{
  "channel": "SMS",
  "error": {
    "code": "tyntec::internal::500",
    "message": "Internal Server Error"
  },
  "otpId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "status": "UNDELIVERABLE",
  "timestamp": "2023-11-15T03:00:00Z"
}

Properties

Name Type Required Restrictions Description
channel string false none none
error Error false none none
otpId string(uuid) false none Unique identifier of the OTP
status string false none status of the OTP Delivery
timestamp string(date-time) false none Timestamp of the OTP event
Enumerated values
Property Value
channel SMS
channel VOICE
channel VIBER
channel WHATSAPP
status DISPATCHED
status TIMED_OUT
status DELIVERED
status UNDELIVERABLE

WhatsAppConfigResponse

{
  "whatsAppAccountId": "289a1c20-06c5-4964-b32d-24d214a78ae5"
}

WhatsApp Configuration

Properties

Name Type Required Restrictions Description
whatsAppAccountId string(uuid) false none Id of WhatsApp Account

Priority Management API

Version: v4

Base URLs

Priority Management

Priority grants the authority to strategically optimize communication methods, ensuring messages reach recipients through their preferred channels in a manner that resonates most effectively.

List Priorities

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/priorities \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/priorities HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/priorities',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/priorities',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/priorities', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/priorities', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/priorities");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/priorities", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/priorities

Lists all Priorities.

Parameters

Name In Type Required Description
name query string false Name of the Priority to be searched for

Example responses

200 Response

[
  {
    "channelPriority": [
      [
        {
          "channel": "SMS",
          "priority": 1
        },
        {
          "channel": "VIBER",
          "priority": 2
        }
      ]
    ],
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "name": "tyntec_priority_sms-viber"
  }
]

Responses

Status Meaning Description Schema
200 OK OK Inline
500 Internal Server Error Internal Server Error ErrorResponseSchema
Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [PriorityDTO] false none [OTP priority configuration]
» Priority PriorityDTO false none OTP priority configuration
»» channelPriority [ChannelPriorityDTO] false none [Channel priority configuration]
»»» Channel Priority ChannelPriorityDTO false none Channel priority configuration
»»»» channel string false none Name of the Channel
»»»» priority integer(int32) false none Priority given integer
»» id string(uuid) false none ID of the Priority in UUID format
»» name string false none Name of the Priority
Enumerated values
Property Value
channel SMS
channel VOICE
channel WHATSAPP
channel VIBER

Create Priority

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/2fa/v4/priorities \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

POST https://api.tyntec.com/2fa/v4/priorities HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "channelPriority": [
    [
      {
        "channel": "SMS",
        "priority": 1
      },
      {
        "channel": "VIBER",
        "priority": 2
      }
    ]
  ],
  "name": "tyntec_priority_sms-viber"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/priorities',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/2fa/v4/priorities',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/2fa/v4/priorities', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/2fa/v4/priorities', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/priorities");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/2fa/v4/priorities", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /2fa/v4/priorities

Creates a new Priority.

Body parameter

{
  "channelPriority": [
    [
      {
        "channel": "SMS",
        "priority": 1
      },
      {
        "channel": "VIBER",
        "priority": 2
      }
    ]
  ],
  "name": "tyntec_priority_sms-viber"
}

Parameters

Name In Type Required Description
body body NewPriorityDTO true Priority Object that needs to be created

Example responses

201 Response

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

Responses

Status Meaning Description Schema
201 Created Created CreatedPriorityDTO
400 Bad Request Constraint violation ConstraintViolationResponseSchema
409 Conflict Conflict ConflictResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Delete Priority

Code samples

# You can also use wget
curl -X DELETE https://api.tyntec.com/2fa/v4/priorities/{id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

DELETE https://api.tyntec.com/2fa/v4/priorities/{id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/priorities/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.delete 'https://api.tyntec.com/2fa/v4/priorities/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.delete('https://api.tyntec.com/2fa/v4/priorities/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.tyntec.com/2fa/v4/priorities/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/priorities/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://api.tyntec.com/2fa/v4/priorities/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /2fa/v4/priorities/{id}

Deletes the Priority by specified ID

Parameters

Name In Type Required Description
id path string true ID of the Priority in UUID format

Example responses

500 Response

{
  "detail": "Unexpected error occurred on server",
  "status": 500,
  "title": "Internal Server Error"
}

Responses

Status Meaning Description Schema
200 OK OK None
500 Internal Server Error Internal Server Error ErrorResponseSchema

Read Priority

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/priorities/{id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/priorities/{id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/priorities/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/priorities/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/priorities/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/priorities/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/priorities/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/priorities/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/priorities/{id}

Returns details of a Priority by specified ID.

Parameters

Name In Type Required Description
id path string true ID of the Priority in UUID format

Example responses

200 Response

{
  "channelPriority": [
    [
      {
        "channel": "SMS",
        "priority": 1
      },
      {
        "channel": "VIBER",
        "priority": 2
      }
    ]
  ],
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "name": "tyntec_priority_sms-viber"
}

Responses

Status Meaning Description Schema
200 OK OK PriorityDTO
404 Not Found Not Found NotFoundSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Patch Priority

Code samples

# You can also use wget
curl -X PATCH https://api.tyntec.com/2fa/v4/priorities/{id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

PATCH https://api.tyntec.com/2fa/v4/priorities/{id} HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "channelPriority": [
    [
      {
        "channel": "SMS",
        "priority": 1
      },
      {
        "channel": "VIBER",
        "priority": 2
      }
    ]
  ],
  "name": "tyntec_priority_sms-viber"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/priorities/{id}',
{
  method: 'PATCH',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.patch 'https://api.tyntec.com/2fa/v4/priorities/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.patch('https://api.tyntec.com/2fa/v4/priorities/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PATCH','https://api.tyntec.com/2fa/v4/priorities/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/priorities/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PATCH", "https://api.tyntec.com/2fa/v4/priorities/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PATCH /2fa/v4/priorities/{id}

Patches the Priority

Body parameter

{
  "channelPriority": [
    [
      {
        "channel": "SMS",
        "priority": 1
      },
      {
        "channel": "VIBER",
        "priority": 2
      }
    ]
  ],
  "name": "tyntec_priority_sms-viber"
}

Parameters

Name In Type Required Description
id path string true ID of the Priority in UUID format
body body PatchPriorityDTO true none

Example responses

400 Response

{
  "status": 400,
  "title": "Constraint Violation",
  "violations": [
    {
      "field": "name",
      "message": "must not be blank"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Constraint violation ConstraintViolationResponseSchema
404 Not Found Not Found NotFoundSchema
409 Conflict Constraint violation ConflictResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Schemas

ChannelPriorityDTO

[
  {
    "channel": "SMS",
    "priority": 1
  },
  {
    "channel": "VIBER",
    "priority": 2
  }
]

Channel Priority

Properties

Name Type Required Restrictions Description
channel string false none Name of the Channel
priority integer(int32) false none Priority given integer
Enumerated values
Property Value
channel SMS
channel VOICE
channel WHATSAPP
channel VIBER

ConflictResponseSchema

{
  "detail": "Priority with name tyntec_priority_sms-viber already exists. Priority name must be unique.",
  "priorityName": "tyntec_priority_sms-viber",
  "status": 409,
  "title": "Conflict"
}

Conflict

Properties

Name Type Required Restrictions Description
detail string false none Description of conflict
priorityName string false none The Priority Name
status integer(int64) false none Http Status code
title string false none Http Status text

ConstraintViolationResponseSchema

{
  "status": 400,
  "title": "Constraint Violation",
  "violations": [
    {
      "field": "name",
      "message": "must not be blank"
    }
  ]
}

Constraint Violation

Properties

Name Type Required Restrictions Description
status integer(int64) false none Http Status code
title string false none Invalid request body parameters
violations [ViolationResponseSchema] false none List of violations

CreatedPriorityDTO

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

Created Priority

Properties

Name Type Required Restrictions Description
id string(uuid) false none ID of the Priority in UUID format

ErrorResponseSchema

{
  "detail": "Unexpected error occurred on server",
  "status": 500,
  "title": "Internal Server Error"
}

Internal Server Error

Properties

Name Type Required Restrictions Description
detail string false none Description of an error
status integer(int64) false none Http Status code
title string false none The server encountered an unexpected condition

NewChannelPriorityDTO

[
  {
    "channel": "SMS",
    "priority": 1
  },
  {
    "channel": "VIBER",
    "priority": 2
  }
]

New Channel Entry

Properties

Name Type Required Restrictions Description
channel string false none Name of the Channel
priority integer(int32) false none Priority given integer
Enumerated values
Property Value
channel SMS
channel VOICE
channel VIBER
channel WHATSAPP

NewPriorityDTO

{
  "channelPriority": [
    [
      {
        "channel": "SMS",
        "priority": 1
      },
      {
        "channel": "VIBER",
        "priority": 2
      }
    ]
  ],
  "name": "tyntec_priority_sms-viber"
}

New Priority

Properties

Name Type Required Restrictions Description
channelPriority [NewChannelPriorityDTO] true none List of Channels
name string false none Name of the Priority

NotFoundSchema

{
  "detail": "Resource with ID 6f1f2438-f1bf-4ba0-892a-d6a3f5692a11 not found",
  "resourceId": "6f1f2438-f1bf-4ba0-892a-d6a3f5692a11",
  "status": 404,
  "title": "No Resource Found"
}

Not Found

Properties

Name Type Required Restrictions Description
detail string false none Explanation message
resourceId string false none ID of the Resource
status integer(int64) false none Not Found Http Status code
title string false none Resource not found on the server

PatchPriorityDTO

{
  "channelPriority": [
    [
      {
        "channel": "SMS",
        "priority": 1
      },
      {
        "channel": "VIBER",
        "priority": 2
      }
    ]
  ],
  "name": "tyntec_priority_sms-viber"
}

Patch Priority

Properties

Name Type Required Restrictions Description
channelPriority [NewChannelPriorityDTO] false none [List of Channels]
name string false none Name of the Priority

PriorityDTO

{
  "channelPriority": [
    [
      {
        "channel": "SMS",
        "priority": 1
      },
      {
        "channel": "VIBER",
        "priority": 2
      }
    ]
  ],
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "name": "tyntec_priority_sms-viber"
}

Priority

Properties

Name Type Required Restrictions Description
channelPriority [ChannelPriorityDTO] false none [Channel priority configuration]
id string(uuid) false none ID of the Priority in UUID format
name string false none Name of the Priority

ViolationResponseSchema

{
  "field": "name",
  "message": "must not be blank"
}

Violations

Properties

Name Type Required Restrictions Description
field string false none The field which is violated
message string false none Indicates the constraint violation

Profile Management API

Version: v4

Base URLs

Profile Management

Profiles empowers users to assemble a collection of diverse templates, tailored for various languages and channels, all orchestrated for a specific use case.

List Profiles

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/profiles \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/profiles HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/profiles',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/profiles',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/profiles', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/profiles', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/profiles");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/profiles", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/profiles

Lists all Profiles.

Parameters

Name In Type Required Description
name query string false Name of the Profile to be searched for

Example responses

200 Response

[
  {
    "alphanumeric": true,
    "attempts": 3,
    "channels": [
      {
        "templates": [
          {
            "languageCode": "en_US",
            "name": "tyntec_sms_en_US"
          }
        ],
        "type": "SMS"
      }
    ],
    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
    "name": "tyntec_profile_register",
    "otpCodeLength": 8
  }
]

Responses

Status Meaning Description Schema
200 OK OK Inline
500 Internal Server Error Internal Server Error ErrorResponseSchema
Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [ProfileDTO] false none [OTP Profile configuration]
» Profile ProfileDTO false none OTP Profile configuration
»» alphanumeric boolean false none Type of autogenerated OTP Code
»» attempts integer(int32) false none Customer can define how many times an OTP is allowed to be tried. If the number of the allowed attempts is reached, the OTP code will be invalidated
»» channels [ChannelEntryDTO] false none Channel configuration for OTP Profile
»»» Channel Entry ChannelEntryDTO false none Channel configuration for OTP Profile
»»»» templates [TemplateChannel] false none [Template to be used for a channel]
»»»»» languageCode string false none Language Code of the Template
»»»»» name string false none Name of the Template
»»»» type string false none Channel to be used in the Template
»» id string(uuid) false none OTP Profile ID in UUID format
»» name string false none Name of the Profile
»» otpCodeLength integer(int32) false none Number of OTP code characters.
Enumerated values
Property Value
type SMS
type VOICE
type WHATSAPP
type VIBER

Create Profile

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/2fa/v4/profiles \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

POST https://api.tyntec.com/2fa/v4/profiles HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "alphanumeric": "true",
  "attempts": 3,
  "channels": [
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_register_sms_en_us"
        },
        {
          "languageCode": "es",
          "name": "tyntec_register_sms_es"
        }
      ],
      "type": "SMS"
    },
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_register_viber_en_us"
        }
      ],
      "type": "VIBER"
    }
  ],
  "name": "tyntec_profile_register",
  "otpCodeLength": 8
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/profiles',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/2fa/v4/profiles',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/2fa/v4/profiles', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/2fa/v4/profiles', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/profiles");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/2fa/v4/profiles", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /2fa/v4/profiles

Creates a new Profile.

Body parameter

{
  "alphanumeric": "true",
  "attempts": 3,
  "channels": [
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_register_sms_en_us"
        },
        {
          "languageCode": "es",
          "name": "tyntec_register_sms_es"
        }
      ],
      "type": "SMS"
    },
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_register_viber_en_us"
        }
      ],
      "type": "VIBER"
    }
  ],
  "name": "tyntec_profile_register",
  "otpCodeLength": 8
}

Parameters

Name In Type Required Description
body body NewProfileDTO true Profile Object that needs to be created

Example responses

201 Response

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

Responses

Status Meaning Description Schema
201 Created Created CreatedProfileDTO
400 Bad Request Constraint violation ConstraintViolationResponseSchema
403 Forbidden Missing Configuration ConfigurationNotFound
500 Internal Server Error Internal Server Error ErrorResponseSchema

Delete Profile

Code samples

# You can also use wget
curl -X DELETE https://api.tyntec.com/2fa/v4/profiles/{id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

DELETE https://api.tyntec.com/2fa/v4/profiles/{id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/profiles/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.delete 'https://api.tyntec.com/2fa/v4/profiles/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.delete('https://api.tyntec.com/2fa/v4/profiles/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.tyntec.com/2fa/v4/profiles/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/profiles/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://api.tyntec.com/2fa/v4/profiles/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /2fa/v4/profiles/{id}

Deletes the Profile by specified ID

Parameters

Name In Type Required Description
id path string true ID of the Profile in UUID format

Example responses

500 Response

{
  "accountId": "8561cca6-682a-47e7-9b55-0c4be1d4033e",
  "detail": "Unexpected error occurred on server",
  "status": 500,
  "templateName": "otp_template_test",
  "title": "Internal Server Error"
}

Responses

Status Meaning Description Schema
200 OK OK None
500 Internal Server Error Internal Server Error ErrorResponseSchema

Read Profile

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/profiles/{id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/profiles/{id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/profiles/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/profiles/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/profiles/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/profiles/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/profiles/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/profiles/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/profiles/{id}

Returns details of a Profile by specified ID.

Parameters

Name In Type Required Description
id path string true ID of the Profile in UUID format

Example responses

200 Response

{
  "alphanumeric": true,
  "attempts": 3,
  "channels": [
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_sms_en_US"
        }
      ],
      "type": "SMS"
    }
  ],
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "tyntec_profile_register",
  "otpCodeLength": 8
}

Responses

Status Meaning Description Schema
200 OK OK ProfileDTO
404 Not Found Not Found NotFoundSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Patch Profile

Code samples

# You can also use wget
curl -X PATCH https://api.tyntec.com/2fa/v4/profiles/{id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

PATCH https://api.tyntec.com/2fa/v4/profiles/{id} HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "alphanumeric": "true",
  "attempts": 3,
  "channels": [
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_register_es"
        }
      ],
      "type": "SMS"
    }
  ],
  "name": "tyntec_profile_register",
  "otpCodeLength": 8
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/profiles/{id}',
{
  method: 'PATCH',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.patch 'https://api.tyntec.com/2fa/v4/profiles/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.patch('https://api.tyntec.com/2fa/v4/profiles/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PATCH','https://api.tyntec.com/2fa/v4/profiles/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/profiles/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PATCH", "https://api.tyntec.com/2fa/v4/profiles/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PATCH /2fa/v4/profiles/{id}

Patches the Profile

Body parameter

{
  "alphanumeric": "true",
  "attempts": 3,
  "channels": [
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_register_es"
        }
      ],
      "type": "SMS"
    }
  ],
  "name": "tyntec_profile_register",
  "otpCodeLength": 8
}

Parameters

Name In Type Required Description
id path string true ID of the Profile in UUID format
body body PatchProfileDTO true none

Example responses

404 Response

{
  "detail": "Resource with ID 6f1f2438-f1bf-4ba0-892a-d6a3f5692a11 not found",
  "resourceId": "6f1f2438-f1bf-4ba0-892a-d6a3f5692a11",
  "status": 404,
  "title": "No Resource Found"
}

Responses

Status Meaning Description Schema
200 OK OK None
404 Not Found Not Found NotFoundSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Add Template to Profile

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

POST https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "channels": [
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_sms_en_US"
        }
      ],
      "type": "SMS"
    }
  ]
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /2fa/v4/profiles/{profile-id}/templates

Adds Template to Profile.

Body parameter

{
  "channels": [
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_sms_en_US"
        }
      ],
      "type": "SMS"
    }
  ]
}

Parameters

Name In Type Required Description
profile-id path string true ID of the Profile in UUID format
body body AddTemplateBodyDTO true Channels List Object

Example responses

400 Response

{
  "status": 400,
  "title": "Constraint Violation",
  "violations": [
    {
      "field": "field_name",
      "message": "must not be blank"
    }
  ]
}

Responses

Status Meaning Description Schema
201 Created Created None
400 Bad Request Constraint violation ConstraintViolationResponseSchema
404 Not Found Not Found NotFoundSchema
409 Conflict Conflict ProfileConflictResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Remove Template from Profile

Code samples

# You can also use wget
curl -X DELETE https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates/{template-name} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

DELETE https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates/{template-name} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates/{template-name}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.delete 'https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates/{template-name}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.delete('https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates/{template-name}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates/{template-name}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates/{template-name}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://api.tyntec.com/2fa/v4/profiles/{profile-id}/templates/{template-name}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /2fa/v4/profiles/{profile-id}/templates/{template-name}

Removes Template from Profile.

Parameters

Name In Type Required Description
profile-id path string true ID of the Profile in UUID format
template-name path string true Name of the Template

Example responses

400 Response

{
  "status": 400,
  "title": "Constraint Violation",
  "violations": [
    {
      "field": "field_name",
      "message": "must not be blank"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Constraint violation ConstraintViolationResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Schemas

AddTemplateBodyDTO

{
  "channels": [
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_sms_en_US"
        }
      ],
      "type": "SMS"
    }
  ]
}

Add Template Body

Properties

Name Type Required Restrictions Description
channels [AddTemplateChannelEntryDTO] true none none

AddTemplateChannelDTO

{
  "languageCode": "en_US",
  "name": "tyntec_sms_en_US"
}

List of Templates

Properties

Name Type Required Restrictions Description
languageCode string false none Language Code of the Template to be added
name string false none Name of the Template to be added

AddTemplateChannelEntryDTO

{
  "templates": [
    {
      "languageCode": "en_US",
      "name": "tyntec_sms_en_US"
    }
  ],
  "type": "SMS"
}

Template Channel Entry

Properties

Name Type Required Restrictions Description
templates [AddTemplateChannelDTO] true none none
type string false none Channel object will link the type of the channel with the templates to be used in this channel.
Enumerated values
Property Value
type SMS
type VOICE
type VIBER
type WHATSAPP

ChannelEntryDTO

{
  "templates": [
    {
      "languageCode": "en_US",
      "name": "tyntec_sms_en_US"
    }
  ],
  "type": "SMS"
}

Channel Entry

Properties

Name Type Required Restrictions Description
templates [TemplateChannel] false none [Template to be used for a channel]
type string false none Channel to be used in the Template
Enumerated values
Property Value
type SMS
type VOICE
type WHATSAPP
type VIBER

ConfigurationNotFound

{
  "detail": "Account is not allowed to use WhatsApp functionality",
  "status": 403,
  "title": "Missing WhatsApp Configuration"
}

Forbidden

Properties

Name Type Required Restrictions Description
detail string false none Description
status integer(int64) false none Http Status code
title string false none none

ConstraintViolationResponseSchema

{
  "status": 400,
  "title": "Constraint Violation",
  "violations": [
    {
      "field": "field_name",
      "message": "must not be blank"
    }
  ]
}

Constraint Violation

Properties

Name Type Required Restrictions Description
status integer(int64) false none Http Status code
title string false none Invalid request body parameters
violations [ViolationResponseSchema] false none List of violations

CreatedProfileDTO

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

Created Profile

Properties

Name Type Required Restrictions Description
id string(uuid) false none ID of the Profile in UUID format

ErrorResponseSchema

{
  "accountId": "8561cca6-682a-47e7-9b55-0c4be1d4033e",
  "detail": "Unexpected error occurred on server",
  "status": 500,
  "templateName": "otp_template_test",
  "title": "Internal Server Error"
}

Internal Server Error

Properties

Name Type Required Restrictions Description
accountId string false none Customers WhatsApp account id, if applicable
detail string false none Description of an error
status integer(int64) false none Http Status code
templateName string false none The template Name, if applicable
title string false none The server encountered an unexpected condition

NewChannelEntryDTO

[
  {
    "type": "SMS",
    "templates": [
      {
        "name": "tyntec_register_sms_en_us",
        "languageCode": "en_US"
      },
      {
        "name": "tyntec_register_sms_es",
        "languageCode": "es"
      }
    ]
  },
  {
    "type": "VIBER",
    "templates": [
      {
        "name": "tyntec_register_viber_en_us",
        "languageCode": "en_US"
      }
    ]
  }
]

Channel Entry

Properties

Name Type Required Restrictions Description
templates [NewTemplateChannel] true none Templates to be linked with this profile
type string false none Channel object will link the type of the channel with the templates to be used in this channel.
Enumerated values
Property Value
type SMS
type VOICE
type VIBER
type WHATSAPP

NewProfileDTO

{
  "alphanumeric": "true",
  "attempts": 3,
  "channels": [
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_register_sms_en_us"
        },
        {
          "languageCode": "es",
          "name": "tyntec_register_sms_es"
        }
      ],
      "type": "SMS"
    },
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_register_viber_en_us"
        }
      ],
      "type": "VIBER"
    }
  ],
  "name": "tyntec_profile_register",
  "otpCodeLength": 8
}

New Profile

Properties

Name Type Required Restrictions Description
alphanumeric string false none Type of autogenerated OTP Code
attempts integer(int32) false none Customer can define how many times an OTP is allowed to be tried. If the number of the allowed attempts is reached, the OTP code will be invalidated
channels [NewChannelEntryDTO] true none List of Channels to be linked with profile
name string false none Name of the Profile
otpCodeLength integer(int32) false none Number of OTP code characters.

NewTemplateChannel

{
  "languageCode": "en_US",
  "name": "tyntec_register_es"
}

Template

Properties

Name Type Required Restrictions Description
languageCode string false none none
name string false none none

NotFoundSchema

{
  "detail": "Resource with ID 6f1f2438-f1bf-4ba0-892a-d6a3f5692a11 not found",
  "resourceId": "6f1f2438-f1bf-4ba0-892a-d6a3f5692a11",
  "status": 404,
  "title": "No Resource Found"
}

Not Found

Properties

Name Type Required Restrictions Description
detail string false none Explanation message
resourceId string false none ID of the Resource
status integer(int64) false none Not Found Http Status code
title string false none Resource not found on the server

PatchChannelEntryDTO

{
  "templates": [
    {
      "languageCode": "en_US",
      "name": "tyntec_register_es"
    }
  ],
  "type": "SMS"
}

Patch Channel Entry

Properties

Name Type Required Restrictions Description
templates [NewTemplateChannel] true none Templates to be linked with this profile
type string false none Channel object will link the type of the channel with the templates to be used in this channel.
Enumerated values
Property Value
type SMS
type VOICE
type WHATSAPP

PatchProfileDTO

{
  "alphanumeric": "true",
  "attempts": 3,
  "channels": [
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_register_es"
        }
      ],
      "type": "SMS"
    }
  ],
  "name": "tyntec_profile_register",
  "otpCodeLength": 8
}

Patch Profile

Properties

Name Type Required Restrictions Description
alphanumeric string false none Type of autogenerated OTP Code
attempts integer(int32) false none Customer can define how many times an OTP is allowed to be tried. If the number of the allowed attempts is reached, the OTP code will be invalidated
channels [PatchChannelEntryDTO] false none none
name string false none Name of the Profile
otpCodeLength integer(int32) false none Number of OTP code characters.

ProfileConflictResponseSchema

{
  "channel": "VOICE",
  "detail": "Template with language en_US for VOICE channel already exists. Only one language per channel is allowed.",
  "language": "en_US",
  "status": 409,
  "title": "Conflict"
}

Conflict

Properties

Name Type Required Restrictions Description
channel string false none The Channel which Template belongs to
detail string false none Description of conflict
language string false none The template Language
status integer(int64) false none Http Status code
title string false none none

ProfileDTO

{
  "alphanumeric": true,
  "attempts": 3,
  "channels": [
    {
      "templates": [
        {
          "languageCode": "en_US",
          "name": "tyntec_sms_en_US"
        }
      ],
      "type": "SMS"
    }
  ],
  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
  "name": "tyntec_profile_register",
  "otpCodeLength": 8
}

Profile

Properties

Name Type Required Restrictions Description
alphanumeric boolean false none Type of autogenerated OTP Code
attempts integer(int32) false none Customer can define how many times an OTP is allowed to be tried. If the number of the allowed attempts is reached, the OTP code will be invalidated
channels [ChannelEntryDTO] false none Channel configuration for OTP Profile
id string(uuid) false none OTP Profile ID in UUID format
name string false none Name of the Profile
otpCodeLength integer(int32) false none Number of OTP code characters.

TemplateChannel

{
  "languageCode": "en_US",
  "name": "tyntec_sms_en_US"
}

Template to be used for a channel

Properties

Name Type Required Restrictions Description
languageCode string false none Language Code of the Template
name string false none Name of the Template

ViolationResponseSchema

{
  "field": "field_name",
  "message": "must not be blank"
}

Violations

Properties

Name Type Required Restrictions Description
field string false none The field which is violated
message string false none Indicates the constraint violation

Template Management API

Version: v4

Base URLs

SMS Template Management

SMS Template Management provides users with the ability to create and customize message templates designed for One-Time Passwords (OTP) in specific languages. This feature facilitates efficient and consistent delivery of OTP messages while accommodating diverse language preferences.

List SMS Templates

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/templates/sms \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/templates/sms HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/sms',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/templates/sms',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/templates/sms', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/templates/sms', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/sms");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/templates/sms", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/templates/sms

Lists all SMS Templates.

Parameters

Name In Type Required Description
name query string false Name of the Template to be searched for
language query string false Language of the Template to be searched for
Enumerated values
Parameter Value
language ar
language bg
language ca
language zh_CN
language zh_HK
language zh_TW
language hr
language cs
language da
language nl
language en
language en_GB
language en_US
language fi
language fr
language de
language el
language he
language hu
language id
language it
language ja
language ko
language ms
language nb
language pl
language pt_BR
language pt_PT
language ro
language ru
language sk
language sl
language es
language es_ES
language es_MX
language sv
language ta
language te
language th
language tr
language vi

Example responses

200 Response

[
  {
    "channel": "SMS",
    "codeExpirationTime": 3,
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "language": "en_US",
    "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
    "name": "tyntec_sms_en_US"
  }
]

Responses

Status Meaning Description Schema
200 OK OK Inline
500 Internal Server Error Internal Server Error ErrorResponseSchema
Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [SMSTemplateDTO] false none [SMS Template object]
» SMS Template SMSTemplateDTO false none SMS Template object
»» channel string false none Channel for template
»» codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
»» id string(uuid) false none ID of the Template in UUID format
»» language string false none Language of the Template in the ISO 639-1 format
»» message string false none The text template for the specific language. Placeholder '{{otp_code}}' must exist at least once, otherwise template will not be created. '{{expiration_time}}' is an optional placeholder
»» name string false none Name of the Template
Enumerated values
Property Value
channel SMS
channel VOICE
channel WHATSAPP
channel VIBER

Create SMS Template

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/2fa/v4/templates/sms \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

POST https://api.tyntec.com/2fa/v4/templates/sms HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "codeExpirationTime": 3,
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_sms_en_US"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/sms',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/2fa/v4/templates/sms',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/2fa/v4/templates/sms', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/2fa/v4/templates/sms', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/sms");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/2fa/v4/templates/sms", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /2fa/v4/templates/sms

Creates a new SMS Template.

Body parameter

{
  "codeExpirationTime": 3,
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_sms_en_US"
}

Parameters

Name In Type Required Description
body body NewSMSTemplateDTO true SMS Template Object that needs to be created

Example responses

201 Response

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

Responses

Status Meaning Description Schema
201 Created Created CreatedSMSTemplateDTO
400 Bad Request Constraint violation ConstraintViolationResponseSchema
409 Conflict Conflict TemplateConflictResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Delete SMS Template

Code samples

# You can also use wget
curl -X DELETE https://api.tyntec.com/2fa/v4/templates/sms/{id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

DELETE https://api.tyntec.com/2fa/v4/templates/sms/{id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/sms/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.delete 'https://api.tyntec.com/2fa/v4/templates/sms/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.delete('https://api.tyntec.com/2fa/v4/templates/sms/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.tyntec.com/2fa/v4/templates/sms/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/sms/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://api.tyntec.com/2fa/v4/templates/sms/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /2fa/v4/templates/sms/{id}

Deletes the SMS Template by specified ID

Parameters

Name In Type Required Description
id path string true ID of the Template in UUID format

Example responses

500 Response

{
  "accountId": "8561cca6-682a-47e7-9b55-0c4be1d4033e",
  "detail": "Unexpected error occurred on server",
  "status": 500,
  "templateName": "otp_template_test",
  "title": "Internal Server Error"
}

Responses

Status Meaning Description Schema
200 OK OK None
500 Internal Server Error Internal Server Error ErrorResponseSchema

Read SMS Template

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/templates/sms/{id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/templates/sms/{id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/sms/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/templates/sms/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/templates/sms/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/templates/sms/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/sms/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/templates/sms/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/templates/sms/{id}

Returns details of a template by specified ID.

Parameters

Name In Type Required Description
id path string true ID of the Template in UUID format

Example responses

200 Response

{
  "channel": "SMS",
  "codeExpirationTime": 3,
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_sms_en_US"
}

Responses

Status Meaning Description Schema
200 OK OK SMSTemplateDTO
404 Not Found Not Found NotFoundResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Patch SMS Template

Code samples

# You can also use wget
curl -X PATCH https://api.tyntec.com/2fa/v4/templates/sms/{id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

PATCH https://api.tyntec.com/2fa/v4/templates/sms/{id} HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "codeExpirationTime": 3,
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_sms_en_US"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/sms/{id}',
{
  method: 'PATCH',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.patch 'https://api.tyntec.com/2fa/v4/templates/sms/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.patch('https://api.tyntec.com/2fa/v4/templates/sms/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PATCH','https://api.tyntec.com/2fa/v4/templates/sms/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/sms/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PATCH", "https://api.tyntec.com/2fa/v4/templates/sms/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PATCH /2fa/v4/templates/sms/{id}

Patches the SMS Template

Body parameter

{
  "codeExpirationTime": 3,
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_sms_en_US"
}

Parameters

Name In Type Required Description
id path string true ID of the Template in UUID format
body body PatchSMSTemplateDTO true none

Example responses

404 Response

{
  "detail": "Template with ID 6f1f2438-f1bf-4ba0-892a-d6a3f5692a11 not found",
  "status": 404,
  "templateId": "6f1f2438-f1bf-4ba0-892a-d6a3f5692a11",
  "title": "No Template Found"
}

Responses

Status Meaning Description Schema
200 OK OK None
404 Not Found Not Found NotFoundResponseSchema
409 Conflict Conflict TemplateConflictResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

WhatsApp Template Management

WhatsApp Template Management provides users with the ability to create and customize message templates designed for One-Time Passwords (OTP) in specific languages. This feature facilitates efficient and consistent delivery of OTP messages while accommodating diverse language preferences.

Retrieve WhatsApp Template by Name and/or Language

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/templates/whatsapp \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/templates/whatsapp HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/whatsapp',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/templates/whatsapp',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/templates/whatsapp', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/templates/whatsapp', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/whatsapp");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/templates/whatsapp", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/templates/whatsapp

Returns details of a template by specified Name and/or language. Search rules:

  1. Find all templates by not providing any values
  2. Find by template name
  3. Find by template name & language
  4. Find by language

Parameters

Name In Type Required Description
name query string false Name of the Template
language query string false Language of the Template

Example responses

200 Response

[
  {
    "accountId": "8561cca6-682a-47e7-9b55-0c4be1d4033e",
    "autofillButtonText": "Click to Autofill",
    "buttonUrl": "https://www.whatsapp.com/otp/code/?otp_type=COPY_CODE&code=otp{{1}}",
    "codeExpirationText": "This code expires in 3 minutes.",
    "codeExpirationTime": 3,
    "copyButtonText": "copy now",
    "createdAt": "2023‐06‐27T09:51:14",
    "isAddSecurityRecommendation": true,
    "language": "en_US",
    "message": "*{{1}}* is your verification code. For your security, do not share this code.",
    "name": "tyntec_sms_en_US",
    "otpType": "COPY_CODE or ONE_TAP",
    "packageName": "com.example.myapplication",
    "signatureHash": "K8a%2FAINcGX7",
    "status": "APPROVED",
    "templateId": "auth_template_en",
    "type": "OTP",
    "updatedAt": "2023‐06‐27T09:51:14"
  }
]

Responses

Status Meaning Description Schema
200 OK OK Inline
400 Bad Request Bad Request BadRequestResponse
401 Unauthorized Unauthorized UnauthorizedResponse
403 Forbidden Forbidden ForbiddenResponse
404 Not Found Not Found NotFoundResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema
Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [ResponseWhatsAppTemplate] false none [WhatsApp Template Response]
» Response WhatsApp Template ResponseWhatsAppTemplate false none WhatsApp Template Response
»» accountId string false none The whatsApp account id
»» autofillButtonText string false none Replace the default autofill button text of "Autofill" with your own text
»» buttonUrl string false none URL provided for the button
»» codeExpirationText string false none Indicates the number of minutes OTP code is valid
»» codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
»» copyButtonText string false none Replace the default copy code button text of "Copy code" with your own text
»» createdAt string false none The date template was created [ISO-8601] without timezone
»» isAddSecurityRecommendation boolean false none Set to "true" to display the security text ("For your security, do not share this code."), otherwise set to "false" to exclude it
»» language string false none Language of the Template in the ISO 639-1 format
»» message string false none The text template for the specific language."Placeholder {{1}} is your verification code, addRecommendation field appends the following text into message { For your security, do not share this code.}"
»» name string false none Name of the Template
»» otpType string false none Indicates the button type
»» packageName string false none Android app's package name
»» signatureHash string false none Your app's signing key hash
»» status string false none The real time template status in the WhatsApp account
»» templateId string false none ID of the Template
»» type string false none The template type is always "OTP"
»» updatedAt string false none The date template was last updated [ISO-8601] without timezone

Submit For Review WhatsApp Template

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/2fa/v4/templates/whatsapp \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

POST https://api.tyntec.com/2fa/v4/templates/whatsapp HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "addSecurityRecommendation": true,
  "autofillButtonText": "Click to Autofill",
  "codeExpirationTime": 3,
  "copyButtonText": "copy now",
  "language": "en_US",
  "name": "tyntec_sms_en_US",
  "otpType": "COPY_CODE or ONE_TAP",
  "packageName": "com.example.myapplication",
  "signatureHash": "K8a%2FAINcGX7",
  "type": "OTP"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/whatsapp',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/2fa/v4/templates/whatsapp',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/2fa/v4/templates/whatsapp', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/2fa/v4/templates/whatsapp', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/whatsapp");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/2fa/v4/templates/whatsapp", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /2fa/v4/templates/whatsapp

Creates a new WhatsApp Template into Meta account

Body parameter

{
  "addSecurityRecommendation": true,
  "autofillButtonText": "Click to Autofill",
  "codeExpirationTime": 3,
  "copyButtonText": "copy now",
  "language": "en_US",
  "name": "tyntec_sms_en_US",
  "otpType": "COPY_CODE or ONE_TAP",
  "packageName": "com.example.myapplication",
  "signatureHash": "K8a%2FAINcGX7",
  "type": "OTP"
}

Parameters

Name In Type Required Description
body body InputWhatsAppTemplate true WhatsApp Template Object that needs to be created

Example responses

400 Response

{
  "detail": "400 BAD_REQUEST Required query parameter 'templateId' is not present",
  "status": 400,
  "title": "Bad Request"
}

Responses

Status Meaning Description Schema
200 OK OK None
201 Created Created None
400 Bad Request Bad Request BadRequestResponse
401 Unauthorized Unauthorized UnauthorizedResponse
404 Not Found Not Found NotFoundResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema
Response Schema

Delete a WhatsApp Template

Code samples

# You can also use wget
curl -X DELETE https://api.tyntec.com/2fa/v4/templates/whatsapp/{template-id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

DELETE https://api.tyntec.com/2fa/v4/templates/whatsapp/{template-id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/whatsapp/{template-id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.delete 'https://api.tyntec.com/2fa/v4/templates/whatsapp/{template-id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.delete('https://api.tyntec.com/2fa/v4/templates/whatsapp/{template-id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.tyntec.com/2fa/v4/templates/whatsapp/{template-id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/whatsapp/{template-id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://api.tyntec.com/2fa/v4/templates/whatsapp/{template-id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /2fa/v4/templates/whatsapp/{template-id}

Deletes the template from your WhatsApp account. After deleting the template, a 30-days grace period is starting. This is indicated by the expiresAt property of the localizations.

Parameters

Name In Type Required Description
template-id path string true ID of the Template

Example responses

400 Response

{
  "detail": "400 BAD_REQUEST Required query parameter 'templateId' is not present",
  "status": 400,
  "title": "Bad Request"
}

Responses

Status Meaning Description Schema
204 No Content No Content None
400 Bad Request Bad Request BadRequestResponse
401 Unauthorized Unauthorized UnauthorizedResponse
404 Not Found Not Found NotFoundResponseSchema
Response Schema

Viber Template Management

Viber Template Management provides users with the ability to create and customize message templates designed for One-Time Passwords (OTP) in specific languages. This feature facilitates efficient and consistent delivery of OTP messages while accommodating diverse language preferences.

List Viber Templates

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/templates/viber \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/templates/viber HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/viber',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/templates/viber',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/templates/viber', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/templates/viber', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/viber");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/templates/viber", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/templates/viber

Lists all Viber Templates.

Parameters

Name In Type Required Description
name query string false Name of the Template to be searched for
language query string false Language of the Template to be searched for
Enumerated values
Parameter Value
language ar
language bg
language ca
language zh_CN
language zh_HK
language zh_TW
language hr
language cs
language da
language nl
language en
language en_GB
language en_US
language fi
language fr
language de
language el
language he
language hu
language id
language it
language ja
language ko
language ms
language nb
language pl
language pt_BR
language pt_PT
language ro
language ru
language sk
language sl
language es
language es_ES
language es_MX
language sv
language ta
language te
language th
language tr
language vi

Example responses

200 Response

[
  {
    "channel": "SMS",
    "codeExpirationTime": 3,
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "language": "en_US",
    "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
    "name": "tyntec_sms_en_US"
  }
]

Responses

Status Meaning Description Schema
200 OK OK Inline
500 Internal Server Error Internal Server Error ErrorResponseSchema
Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [ViberTemplateDTO] false none [Viber Template object]
» Viber Template ViberTemplateDTO false none Viber Template object
»» channel string false none Channel for template
»» codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
»» id string(uuid) false none ID of the Template in UUID format
»» language string false none Language of the Template in the ISO 639-1 format
»» message string false none The text template for the specific language. Placeholder '{{otp_code}}' must exist at least once, otherwise template will not be created. '{{expiration_time}}' is an optional placeholder
»» name string false none Name of the Template
Enumerated values
Property Value
channel SMS
channel VOICE
channel WHATSAPP
channel VIBER

Create Viber Template

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/2fa/v4/templates/viber \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

POST https://api.tyntec.com/2fa/v4/templates/viber HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "codeExpirationTime": 3,
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_viber_en_US"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/viber',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/2fa/v4/templates/viber',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/2fa/v4/templates/viber', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/2fa/v4/templates/viber', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/viber");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/2fa/v4/templates/viber", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /2fa/v4/templates/viber

Creates a new Viber Template.

Body parameter

{
  "codeExpirationTime": 3,
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_viber_en_US"
}

Parameters

Name In Type Required Description
body body NewViberTemplateDTO true Viber Template Object that needs to be created

Example responses

201 Response

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

Responses

Status Meaning Description Schema
201 Created Created CreatedViberTemplateDTO
400 Bad Request Constraint violation ConstraintViolationResponseSchema
409 Conflict Conflict TemplateConflictResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Delete Viber Template

Code samples

# You can also use wget
curl -X DELETE https://api.tyntec.com/2fa/v4/templates/viber/{id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

DELETE https://api.tyntec.com/2fa/v4/templates/viber/{id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/viber/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.delete 'https://api.tyntec.com/2fa/v4/templates/viber/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.delete('https://api.tyntec.com/2fa/v4/templates/viber/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.tyntec.com/2fa/v4/templates/viber/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/viber/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://api.tyntec.com/2fa/v4/templates/viber/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /2fa/v4/templates/viber/{id}

Deletes the Viber Template by specified ID

Parameters

Name In Type Required Description
id path string true ID of the Template in UUID format

Example responses

500 Response

{
  "accountId": "8561cca6-682a-47e7-9b55-0c4be1d4033e",
  "detail": "Unexpected error occurred on server",
  "status": 500,
  "templateName": "otp_template_test",
  "title": "Internal Server Error"
}

Responses

Status Meaning Description Schema
200 OK OK None
500 Internal Server Error Internal Server Error ErrorResponseSchema

Read Viber Template

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/templates/viber/{id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/templates/viber/{id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/viber/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/templates/viber/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/templates/viber/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/templates/viber/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/viber/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/templates/viber/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/templates/viber/{id}

Returns details of a template by specified ID.

Parameters

Name In Type Required Description
id path string true ID of the Template in UUID format

Example responses

200 Response

{
  "channel": "SMS",
  "codeExpirationTime": 3,
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_sms_en_US"
}

Responses

Status Meaning Description Schema
200 OK OK ViberTemplateDTO
404 Not Found Not Found NotFoundResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Patch Viber Template

Code samples

# You can also use wget
curl -X PATCH https://api.tyntec.com/2fa/v4/templates/viber/{id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

PATCH https://api.tyntec.com/2fa/v4/templates/viber/{id} HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "codeExpirationTime": 3,
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_viber_en_US"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/viber/{id}',
{
  method: 'PATCH',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.patch 'https://api.tyntec.com/2fa/v4/templates/viber/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.patch('https://api.tyntec.com/2fa/v4/templates/viber/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PATCH','https://api.tyntec.com/2fa/v4/templates/viber/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/viber/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PATCH", "https://api.tyntec.com/2fa/v4/templates/viber/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PATCH /2fa/v4/templates/viber/{id}

Patches the Viber Template

Body parameter

{
  "codeExpirationTime": 3,
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_viber_en_US"
}

Parameters

Name In Type Required Description
id path string true ID of the Template in UUID format
body body PatchViberTemplateDTO true none

Example responses

404 Response

{
  "detail": "Template with ID 6f1f2438-f1bf-4ba0-892a-d6a3f5692a11 not found",
  "status": 404,
  "templateId": "6f1f2438-f1bf-4ba0-892a-d6a3f5692a11",
  "title": "No Template Found"
}

Responses

Status Meaning Description Schema
200 OK OK None
404 Not Found Not Found NotFoundResponseSchema
409 Conflict Conflict TemplateConflictResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Voice Template Management

Voice Template Management provides users with the ability to create and customize message templates designed for One-Time Passwords (OTP) in specific languages. This feature facilitates efficient and consistent delivery of OTP messages while accommodating diverse language preferences.

List Voice Templates

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/templates/voice \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/templates/voice HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/voice',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/templates/voice',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/templates/voice', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/templates/voice', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/voice");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/templates/voice", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/templates/voice

Lists all Voice Templates.

Parameters

Name In Type Required Description
name query string false Name of the Template to be searched for
language query string false Language of the Template to be searched for
Enumerated values
Parameter Value
language ar
language bg
language ca
language zh_CN
language zh_HK
language zh_TW
language hr
language cs
language da
language nl
language en
language en_GB
language en_US
language fi
language fr
language de
language el
language he
language hu
language id
language it
language ja
language ko
language ms
language nb
language pl
language pt_BR
language pt_PT
language ro
language ru
language sk
language sl
language es
language es_ES
language es_MX
language sv
language ta
language te
language th
language tr
language vi

Example responses

200 Response

[
  {
    "channel": "SMS",
    "codeExpirationTime": 3,
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "language": "en_US",
    "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
    "name": "tyntec_sms_en_US"
  }
]

Responses

Status Meaning Description Schema
200 OK OK Inline
500 Internal Server Error Internal Server Error ErrorResponseSchema
Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [VoiceTemplateDTO] false none [Voice Template object]
» Voice Template VoiceTemplateDTO false none Voice Template object
»» channel string false none Channel for template
»» codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
»» id string(uuid) false none ID of the Template in UUID format
»» language string false none Language of the Template in the ISO 639-1 format
»» message string false none The text template for the specific language. Placeholder '{{otp_code}}' must exist at least once, otherwise template will not be created. '{{expiration_time}}' is an optional placeholder
»» name string false none Name of the Template
Enumerated values
Property Value
channel SMS
channel VOICE
channel WHATSAPP
channel VIBER

Create Voice Template

Code samples

# You can also use wget
curl -X POST https://api.tyntec.com/2fa/v4/templates/voice \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

POST https://api.tyntec.com/2fa/v4/templates/voice HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "codeExpirationTime": 3,
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_voice_en_US"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/voice',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.post 'https://api.tyntec.com/2fa/v4/templates/voice',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.post('https://api.tyntec.com/2fa/v4/templates/voice', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','https://api.tyntec.com/2fa/v4/templates/voice', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/voice");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "https://api.tyntec.com/2fa/v4/templates/voice", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /2fa/v4/templates/voice

Creates a new Voice Template.

Body parameter

{
  "codeExpirationTime": 3,
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_voice_en_US"
}

Parameters

Name In Type Required Description
body body NewVoiceTemplateDTO true Voice Template Object that needs to be created

Example responses

201 Response

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

Responses

Status Meaning Description Schema
201 Created Created CreatedVoiceTemplateDTO
400 Bad Request Constraint violation ConstraintViolationResponseSchema
409 Conflict Conflict TemplateConflictResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Delete Voice Template

Code samples

# You can also use wget
curl -X DELETE https://api.tyntec.com/2fa/v4/templates/voice/{id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

DELETE https://api.tyntec.com/2fa/v4/templates/voice/{id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/voice/{id}',
{
  method: 'DELETE',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.delete 'https://api.tyntec.com/2fa/v4/templates/voice/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.delete('https://api.tyntec.com/2fa/v4/templates/voice/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('DELETE','https://api.tyntec.com/2fa/v4/templates/voice/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/voice/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("DELETE");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("DELETE", "https://api.tyntec.com/2fa/v4/templates/voice/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

DELETE /2fa/v4/templates/voice/{id}

Deletes the Voice Template by specified ID

Parameters

Name In Type Required Description
id path string true ID of the Template in UUID format

Example responses

500 Response

{
  "accountId": "8561cca6-682a-47e7-9b55-0c4be1d4033e",
  "detail": "Unexpected error occurred on server",
  "status": 500,
  "templateName": "otp_template_test",
  "title": "Internal Server Error"
}

Responses

Status Meaning Description Schema
200 OK OK None
500 Internal Server Error Internal Server Error ErrorResponseSchema

Read Voice Template

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/templates/voice/{id} \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/templates/voice/{id} HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/voice/{id}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/templates/voice/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/templates/voice/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/templates/voice/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/voice/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/templates/voice/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/templates/voice/{id}

Returns details of a template by specified ID.

Parameters

Name In Type Required Description
id path string true ID of the Template in UUID format

Example responses

200 Response

{
  "channel": "SMS",
  "codeExpirationTime": 3,
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_sms_en_US"
}

Responses

Status Meaning Description Schema
200 OK OK VoiceTemplateDTO
404 Not Found Not Found NotFoundResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Patch Voice Template

Code samples

# You can also use wget
curl -X PATCH https://api.tyntec.com/2fa/v4/templates/voice/{id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

PATCH https://api.tyntec.com/2fa/v4/templates/voice/{id} HTTP/1.1
Host: api.tyntec.com
Content-Type: application/json
Accept: application/json
apiKey: API_KEY

const inputBody = '{
  "codeExpirationTime": 3,
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_voice_en_US"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates/voice/{id}',
{
  method: 'PATCH',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.patch 'https://api.tyntec.com/2fa/v4/templates/voice/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.patch('https://api.tyntec.com/2fa/v4/templates/voice/{id}', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('PATCH','https://api.tyntec.com/2fa/v4/templates/voice/{id}', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates/voice/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PATCH");
con.setRequestProperty("Content-Type", "application/json");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PATCH", "https://api.tyntec.com/2fa/v4/templates/voice/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

PATCH /2fa/v4/templates/voice/{id}

Patches the Voice Template

Body parameter

{
  "codeExpirationTime": 3,
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_voice_en_US"
}

Parameters

Name In Type Required Description
id path string true ID of the Template in UUID format
body body PatchVoiceTemplateDTO true none

Example responses

404 Response

{
  "detail": "Template with ID 6f1f2438-f1bf-4ba0-892a-d6a3f5692a11 not found",
  "status": 404,
  "templateId": "6f1f2438-f1bf-4ba0-892a-d6a3f5692a11",
  "title": "No Template Found"
}

Responses

Status Meaning Description Schema
200 OK OK None
404 Not Found Not Found NotFoundResponseSchema
409 Conflict Conflict TemplateConflictResponseSchema
500 Internal Server Error Internal Server Error ErrorResponseSchema

Template Management

Provides common template management for all channels of communication.

List Templates

Code samples

# You can also use wget
curl -X GET https://api.tyntec.com/2fa/v4/templates \
  -H 'Accept: application/json' \
  -H 'apiKey: API_KEY'

GET https://api.tyntec.com/2fa/v4/templates HTTP/1.1
Host: api.tyntec.com
Accept: application/json
apiKey: API_KEY


const headers = {
  'Accept':'application/json',
  'apiKey':'API_KEY'

};

fetch('https://api.tyntec.com/2fa/v4/templates',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json',
  'apiKey' => 'API_KEY'
}

result = RestClient.get 'https://api.tyntec.com/2fa/v4/templates',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json',
  'apiKey': 'API_KEY'
}

r = requests.get('https://api.tyntec.com/2fa/v4/templates', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Accept' => 'application/json',
    'apiKey' => 'API_KEY',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('GET','https://api.tyntec.com/2fa/v4/templates', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("https://api.tyntec.com/2fa/v4/templates");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
con.setRequestProperty("Accept", "application/json");
con.setRequestProperty("apiKey", "API_KEY");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        "apiKey": []string{"API_KEY"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "https://api.tyntec.com/2fa/v4/templates", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

GET /2fa/v4/templates

Lists all Templates.

Example responses

200 Response

[
  {
    "channel": "SMS",
    "codeExpirationTime": 3,
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "language": "en_US",
    "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
    "name": "tyntec_sms_en_US"
  }
]

Responses

Status Meaning Description Schema
200 OK OK Inline
500 Internal Server Error Internal Server Error ErrorResponseSchema
Response Schema
Enumerated values
Property Value
channel SMS
channel VOICE
channel WHATSAPP
channel VIBER
channel SMS
channel VOICE
channel WHATSAPP
channel VIBER

Schemas

BadRequestResponse

{
  "detail": "400 BAD_REQUEST Required query parameter 'templateId' is not present",
  "status": 400,
  "title": "Bad Request"
}

Bad Request

Properties

Name Type Required Restrictions Description
detail string false none Explanation message
status integer(int64) false none Bad request Http Status code
title string false none The server cannot or will not process the request due to something that is perceived to be a client error

ConstraintViolationResponseSchema

{
  "status": 400,
  "title": "Constraint Violation",
  "violations": [
    {
      "field": "field_name",
      "message": "must not be blank"
    }
  ]
}

Constraint Violation

Properties

Name Type Required Restrictions Description
status integer(int64) false none Http Status code
title string false none Invalid request body parameters
violations [ViolationResponseSchema] false none List of violations

CreatedSMSTemplateDTO

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

Created SMS Template

Properties

Name Type Required Restrictions Description
id string(uuid) false none ID of the Template in UUID format

CreatedViberTemplateDTO

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

Created Viber Template

Properties

Name Type Required Restrictions Description
id string(uuid) false none ID of the Template in UUID format

CreatedVoiceTemplateDTO

{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}

Created Voice Template

Properties

Name Type Required Restrictions Description
id string(uuid) false none ID of the Template in UUID format

ErrorResponseSchema

{
  "accountId": "8561cca6-682a-47e7-9b55-0c4be1d4033e",
  "detail": "Unexpected error occurred on server",
  "status": 500,
  "templateName": "otp_template_test",
  "title": "Internal Server Error"
}

Internal Server Error

Properties

Name Type Required Restrictions Description
accountId string false none Customers WhatsApp account id, if applicable
detail string false none Description of an error
status integer(int64) false none Http Status code
templateName string false none The template Name, if applicable
title string false none The server encountered an unexpected condition

ForbiddenResponse

{
  "accountId": "8561cca6-682a-47e7-9b55-0c4be1d4033e",
  "detail": "Invalid authentication credentials",
  "status": 403,
  "templateName": "otp_template_test",
  "title": "Forbidden"
}

Forbidden

Properties

Name Type Required Restrictions Description
accountId string false none Customers WhatsApp account id
detail string false none Explanation message
status integer(int64) false none Forbidden Http Status code
templateName string false none The template Name
title string false none The server understands the request but refuses to authorize it

InputWhatsAppTemplate

{
  "addSecurityRecommendation": true,
  "autofillButtonText": "Click to Autofill",
  "codeExpirationTime": 3,
  "copyButtonText": "copy now",
  "language": "en_US",
  "name": "tyntec_sms_en_US",
  "otpType": "COPY_CODE or ONE_TAP",
  "packageName": "com.example.myapplication",
  "signatureHash": "K8a%2FAINcGX7",
  "type": "OTP"
}

Submit WhatsApp Template for Review

Properties

Name Type Required Restrictions Description
addSecurityRecommendation boolean false none Set to "true" to display the security text ("For your security, do not share this code."), otherwise set to "false" to exclude it
autofillButtonText string false none Replace the default autofill button text of "Autofill" with your own text
codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid (default set to 3)
copyButtonText string false none Replace the default copy code button text of "Copy code" with your own text
language string true none Language of the Template in the ISO 639-1 format
name string true none Name of the Template
otpType string false none Indicates the button type
packageName string false none Android app's package name
signatureHash string false none Your app's signing key hash
type string false none The template type is always "OTP"

NewSMSTemplateDTO

{
  "codeExpirationTime": 3,
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_sms_en_US"
}

New SMS Template

Properties

Name Type Required Restrictions Description
codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
language string false none Language of the Template in the ISO 639-1 format
message string false none The text template for the specific language. Placeholder '{{otp_code}}' must exist at least once, otherwise template will not be created. '{{expiration_time}}' is an optional placeholder
name string false none Name of the Template
Enumerated values
Property Value
language ar
language bg
language ca
language zh_CN
language zh_HK
language zh_TW
language hr
language cs
language da
language nl
language en
language en_GB
language en_US
language fi
language fr
language de
language el
language he
language hu
language id
language it
language ja
language ko
language ms
language nb
language pl
language pt_BR
language pt_PT
language ro
language ru
language sk
language sl
language es
language es_ES
language es_MX
language sv
language ta
language te
language th
language tr
language vi

NewViberTemplateDTO

{
  "codeExpirationTime": 3,
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_viber_en_US"
}

New Viber Template

Properties

Name Type Required Restrictions Description
codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
language string false none Language of the Template in the ISO 639-1 format
message string false none The text template for the specific language. Placeholder '{{otp_code}}' must exist at least once, otherwise template will not be created. '{{expiration_time}}' is an optional placeholder
name string false none Name of the Template
Enumerated values
Property Value
language ar
language bg
language ca
language zh_CN
language zh_HK
language zh_TW
language hr
language cs
language da
language nl
language en
language en_GB
language en_US
language fi
language fr
language de
language el
language he
language hu
language id
language it
language ja
language ko
language ms
language nb
language pl
language pt_BR
language pt_PT
language ro
language ru
language sk
language sl
language es
language es_ES
language es_MX
language sv
language ta
language te
language th
language tr
language vi

NewVoiceTemplateDTO

{
  "codeExpirationTime": 3,
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_voice_en_US"
}

New Voice Template

Properties

Name Type Required Restrictions Description
codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
language string false none Language of the Template in the ISO 639-1 format
message string false none The text template for the specific language. Placeholder '{{otp_code}}' must exist at least once, otherwise template will not be created. '{{expiration_time}}' is an optional placeholder
name string false none Name of the Template
Enumerated values
Property Value
language ar
language bg
language ca
language zh_CN
language zh_HK
language zh_TW
language hr
language cs
language da
language nl
language en
language en_GB
language en_US
language fi
language fr
language de
language el
language he
language hu
language id
language it
language ja
language ko
language ms
language nb
language pl
language pt_BR
language pt_PT
language ro
language ru
language sk
language sl
language es
language es_ES
language es_MX
language sv
language ta
language te
language th
language tr
language vi

NotFoundResponseSchema

{
  "detail": "Template with ID 6f1f2438-f1bf-4ba0-892a-d6a3f5692a11 not found",
  "status": 404,
  "templateId": "6f1f2438-f1bf-4ba0-892a-d6a3f5692a11",
  "title": "No Template Found"
}

Not Found

Properties

Name Type Required Restrictions Description
detail string false none Explanation message
status integer(int64) false none Not Found Http Status code
templateId string false none ID of the Template
title string false none Resource not found on the server

PatchSMSTemplateDTO

{
  "codeExpirationTime": 3,
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_sms_en_US"
}

Patch SMS Template

Properties

Name Type Required Restrictions Description
codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
message string false none The text template for the specific language. Placeholder '{{otp_code}}' must exist at least once, otherwise template will not be created. '{{expiration_time}}' is an optional placeholder
name string false none Name of the Template

PatchViberTemplateDTO

{
  "codeExpirationTime": 3,
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_viber_en_US"
}

Patch Viber Template

Properties

Name Type Required Restrictions Description
codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
message string false none The text template for the specific language. Placeholder '{{otp_code}}' must exist at least once, otherwise template will not be created. '{{expiration_time}}' is an optional placeholder
name string false none Name of the Template

PatchVoiceTemplateDTO

{
  "codeExpirationTime": 3,
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_voice_en_US"
}

Patch Voice Template

Properties

Name Type Required Restrictions Description
codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
message string false none The text template for the specific language. Placeholder '{{otp_code}}' must exist at least once, otherwise template will not be created. '{{expiration_time}}' is an optional placeholder
name string false none Name of the Template

ResponseWhatsAppTemplate

{
  "accountId": "8561cca6-682a-47e7-9b55-0c4be1d4033e",
  "autofillButtonText": "Click to Autofill",
  "buttonUrl": "https://www.whatsapp.com/otp/code/?otp_type=COPY_CODE&code=otp{{1}}",
  "codeExpirationText": "This code expires in 3 minutes.",
  "codeExpirationTime": 3,
  "copyButtonText": "copy now",
  "createdAt": "2023‐06‐27T09:51:14",
  "isAddSecurityRecommendation": true,
  "language": "en_US",
  "message": "*{{1}}* is your verification code. For your security, do not share this code.",
  "name": "tyntec_sms_en_US",
  "otpType": "COPY_CODE or ONE_TAP",
  "packageName": "com.example.myapplication",
  "signatureHash": "K8a%2FAINcGX7",
  "status": "APPROVED",
  "templateId": "auth_template_en",
  "type": "OTP",
  "updatedAt": "2023‐06‐27T09:51:14"
}

Response WhatsApp Template

Properties

Name Type Required Restrictions Description
accountId string false none The whatsApp account id
autofillButtonText string false none Replace the default autofill button text of "Autofill" with your own text
buttonUrl string false none URL provided for the button
codeExpirationText string false none Indicates the number of minutes OTP code is valid
codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
copyButtonText string false none Replace the default copy code button text of "Copy code" with your own text
createdAt string false none The date template was created [ISO-8601] without timezone
isAddSecurityRecommendation boolean false none Set to "true" to display the security text ("For your security, do not share this code."), otherwise set to "false" to exclude it
language string false none Language of the Template in the ISO 639-1 format
message string false none The text template for the specific language."Placeholder {{1}} is your verification code, addRecommendation field appends the following text into message { For your security, do not share this code.}"
name string false none Name of the Template
otpType string false none Indicates the button type
packageName string false none Android app's package name
signatureHash string false none Your app's signing key hash
status string false none The real time template status in the WhatsApp account
templateId string false none ID of the Template
type string false none The template type is always "OTP"
updatedAt string false none The date template was last updated [ISO-8601] without timezone

SMSTemplateDTO

{
  "channel": "SMS",
  "codeExpirationTime": 3,
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_sms_en_US"
}

SMS Template

Properties

Name Type Required Restrictions Description
channel string false none Channel for template
codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
id string(uuid) false none ID of the Template in UUID format
language string false none Language of the Template in the ISO 639-1 format
message string false none The text template for the specific language. Placeholder '{{otp_code}}' must exist at least once, otherwise template will not be created. '{{expiration_time}}' is an optional placeholder
name string false none Name of the Template
Enumerated values
Property Value
channel SMS
channel VOICE
channel WHATSAPP
channel VIBER

TemplateConflictResponseSchema

{
  "detail": "Template with name tyntec_sms_en_US already exists in SMS channel. Template name must be unique.",
  "status": 409,
  "templateName": "tyntec_sms_en_US",
  "title": "Conflict"
}

Conflict

Properties

Name Type Required Restrictions Description
detail string false none Description of conflict
status integer(int64) false none Http Status code
templateName string false none The Name of Template
title string false none Http Status text

UnauthorizedResponse

{
  "accountId": "8561cca6-682a-47e7-9b55-0c4be1d4033e",
  "detail": "No API key found in request",
  "status": 401,
  "templateName": "otp_template_test",
  "title": "Unauthorized"
}

Unauthorized

Properties

Name Type Required Restrictions Description
accountId string false none Customers WhatsApp account id
detail string false none Explanation message
status integer(int64) false none Unauthorized Http Status code
templateName string false none The template Name
title string false none The server understands the request but refuses to authorize it

ViberTemplateDTO

{
  "channel": "SMS",
  "codeExpirationTime": 3,
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_sms_en_US"
}

Viber Template

Properties

Name Type Required Restrictions Description
channel string false none Channel for template
codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
id string(uuid) false none ID of the Template in UUID format
language string false none Language of the Template in the ISO 639-1 format
message string false none The text template for the specific language. Placeholder '{{otp_code}}' must exist at least once, otherwise template will not be created. '{{expiration_time}}' is an optional placeholder
name string false none Name of the Template
Enumerated values
Property Value
channel SMS
channel VOICE
channel WHATSAPP
channel VIBER

ViolationResponseSchema

{
  "field": "field_name",
  "message": "must not be blank"
}

Violations

Properties

Name Type Required Restrictions Description
field string false none The field which is violated
message string false none Indicates the constraint violation

VoiceTemplateDTO

{
  "channel": "SMS",
  "codeExpirationTime": 3,
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "language": "en_US",
  "message": "tyntec: {{otp_code}} is your security code. Your code will expire in {{expiration_time}} minutes. Don't share this code.",
  "name": "tyntec_sms_en_US"
}

Voice Template

Properties

Name Type Required Restrictions Description
channel string false none Channel for template
codeExpirationTime integer(int32) false none Indicates the number of minutes OTP code is valid
id string(uuid) false none ID of the Template in UUID format
language string false none Language of the Template in the ISO 639-1 format
message string false none The text template for the specific language. Placeholder '{{otp_code}}' must exist at least once, otherwise template will not be created. '{{expiration_time}}' is an optional placeholder
name string false none Name of the Template
Enumerated values
Property Value
channel SMS
channel VOICE
channel WHATSAPP
channel VIBER

Callback Events

Version: v4

Base URLs

Webhooks

Webhooks is a way for an 2FA application to provide real-time information events. Tyntec sends a webhook to your application to notify you when an event occurs in your account. For example, Tyntec sends a webhook when an OTP is dispatched or when an OTP is delivered. You can use webhooks to trigger actions in your application or store data in your database.

For configuration of the webhook/callback please see Webhook Configuration.

Send OTP event

Code samples

# You can also use wget
curl -X POST Customer defined URL for receiving information events/webhooks \
  -H 'Content-Type: application/json'

POST Customer defined URL for receiving information events/webhooks HTTP/1.1
Content-Type: application/json

const inputBody = '{
  "channel": "SMS",
  "otpId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "profileId": "adbe6521-f5bd-4295-9fd9-776debdf7dc2",
  "status": "DELIVERED",
  "timestamp": "2023-11-15T03:00:00Z"
}';
const headers = {
  'Content-Type':'application/json'

};

fetch('Customer defined URL for receiving information events/webhooks',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json'
}

result = RestClient.post 'Customer defined URL for receiving information events/webhooks',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json'
}

r = requests.post('Customer defined URL for receiving information events/webhooks', params={

}, headers = headers)

print(r.json())

<?php

require 'vendor/autoload.php';

$headers = array(
    'Content-Type' => 'application/json',

    );

$client = new \GuzzleHttp\Client();

// Define array of request body.
$request_body = array();

try {
    $response = $client->request('POST','Customer defined URL for receiving information events/webhooks', array(
        'headers' => $headers,
        'json' => $request_body,
       )
    );
    print_r($response->getBody()->getContents());
 }
 catch (\GuzzleHttp\Exception\BadResponseException $e) {
    // handle exception or api errors.
    print_r($e->getMessage());
 }

 // ...

URL obj = new URL("Customer defined URL for receiving information events/webhooks");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
con.setRequestProperty("Content-Type", "application/json");

int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},

    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "Customer defined URL for receiving information events/webhooks", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

POST /webhooks

Sends OTP events to the callback URL registered.

  • DISPATCHED
  • DELIVERED
  • UNDELIVERABLE
  • TIMED_OUT

For details on error handling, you can refer to the following documentation pages:

Body parameter

{
  "channel": "SMS",
  "otpId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "profileId": "adbe6521-f5bd-4295-9fd9-776debdf7dc2",
  "status": "DELIVERED",
  "timestamp": "2023-11-15T03:00:00Z"
}

Parameters

Name In Type Required Description
body body any true Status of the OTP

Responses

Status Meaning Description Schema
200 OK OK None

Schemas

DeliveryStatus

{
  "channel": "SMS",
  "otpId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "profileId": "adbe6521-f5bd-4295-9fd9-776debdf7dc2",
  "status": "DELIVERED",
  "timestamp": "2023-11-15T03:00:00Z"
}

Properties

Name Type Required Restrictions Description
channel string false none Channel of Delivery
otpId string(uuid) false none Unique identifier of the OTP
profileId string(uuid) false none Unique identifier of the OTP
status string false none Status of the OTP Delivery
timestamp string(date-time) false none Timestamp of the OTP event
Enumerated values
Property Value
channel SMS
channel VOICE
channel VIBER
channel WHATSAPP
status DISPATCHED
status TIMED_OUT
status DELIVERED
status UNDELIVERABLE

DeliveryStatusWithError

{
  "channel": "SMS",
  "error": {
    "code": "tyntec::internal::500",
    "message": "Internal Server Error"
  },
  "otpId": "a4762c77-94cb-43d6-bbab-9f37e088ad11",
  "profileId": "adbe6521-f5bd-4295-9fd9-776debdf7dc2",
  "status": "UNDELIVERABLE",
  "timestamp": "2023-11-15T03:00:00Z"
}

Properties

Name Type Required Restrictions Description
channel string false none none
error Error false none none
otpId string(uuid) false none Unique identifier of the OTP
profileId string(uuid) false none Unique identifier of the OTP
status string false none status of the OTP Delivery
timestamp string(date-time) false none Timestamp of the OTP event
Enumerated values
Property Value
channel SMS
channel VOICE
channel VIBER
channel WHATSAPP
status DISPATCHED
status TIMED_OUT
status DELIVERED
status UNDELIVERABLE

Error

{
  "code": "tyntec::internal::500",
  "message": "Internal Server Error"
}

Error

Properties

Name Type Required Restrictions Description
code string false none Error code
message string false none Error message