Authentication | Interface Information and Resource URLs
Learn more about the interface and tyntec’s 2FA REST API. Our easy access to tyntec’s two-factor authentication.
1. Interface Information and Resource URLs
The REST API (Representational State Transfer Application Programming Interface) enables quick and easy access to tyntec‘s messaging platform. The communication is established via HTTPS (Hypertext Transfer Protocol Secure) connections. The exchanged object types are JSON (JavaScript Object Notation). tyntec accepts “application/json” as “Content-Type” (and “charset=utf-8”) in the HTTP header.
The 2FA API service is accessible through the base URL (Unique Resource Location) (${baseURL}):
https://api.tyntec.com/2fa/v1/
The API key should be either as HTTP header with the key “apiKey” HTTP header:
apiKey: <your_API_key>
Or as part of the query url with query parameter key name “apiKey”
Send a 2FA using the default settings example:
curl -X POST
-H "apiKey: yourApiKey" https://api.tyntec.com/2fa/v1/otp?number=004989202451100
Response:
HTTP/1.1 200 OK
{
"accountId": "yourAccountId",
"applicationId": "4b5b626d-d79f-3c88-a139-000000000000",
"otpId": "5b757dbf-7c25-49b5-bcef-4ff8b488e5f2",
"number": "+4989202451100",
"attemptCount": 0,
"otpStatus": "ACTIVE",
"expire": 1499677361834,
"created": 1499677061834,
"timestampCreated": "2017-07-10T08:57:41.834Z",
"timestampExpire": "2017-07-10T09:02:41.834Z"
}
Check delivered OTP example:
curl -X POST
-H "apiKey: yourApiKey" https://api.tyntec.com/2fa/v1/otp/5b757dbf-7c25-49b5-bcef-4ff8b488e5f2/check?otpCode=1234
Response:
HTTP/1.1 202 Accepted
{
"accountId": "yourAccountId",
"applicationId": "4b5b626d-d79f-3c88-a139-cac021a95a7e",
"otpId": "5b757dbf-7c25-49b5-bcef-4ff8b488e5f2",
"number": "+4989202451100",
"attemptCount": 1,
"otpStatus": "VERIFIED",
"expire": 1499677361834,
"created": 1499677061834,
"timestampCreated": "2017-07-10T08:57:41.834Z",
"timestampExpire": "2017-07-10T09:02:41.834Z"
}
2. Resource URLs delivering and checking OTPs
This part of the API is using for delivering and checking OTP codes to destination numbers.
Operation | Resource URL | Method |
---|---|---|
Sends OTP to a destination number | ${baseURL}/otp | POST |
Get a specific OTP request status | ${baseURL}/otp/{otpId} | GET |
Resends an OTP | ${baseURL}/otp/{otpId} | POST |
Deletes an OTP request | ${baseURL}/otp/{otpId} | DELETE |
Verify an OTP code against this OTP request | ${baseURL}/otp/{otpId}/check | POST |
Get events for OTP delivery | ${baseURL}/otp/{otpId}/events | GET |
3. Resource URLs Managing Your 2FA Application
The 2FA API has a part where the user can create different 2FA applications and separate his configuration. tyntec stores these configurations for the user and the user can refer to the applicationId that points to the desired configuration that will be applied for the specific OTP delivery.
There is a default application for each user which contains some default values and an English language template. This default application will be used in case no applicationId is specified in an OTP delivery request. The user can change the default parameters of the default application as well.
Operation | Resource URL | Method |
---|---|---|
Get your applications | ${baseURL}/application/ | GET |
Create an application | ${baseURL}/application/ | POST |
Delete an application | ${baseURL}/application/{applicationId} | DELETE |
Get a specific application | ${baseURL}/application/{applicationId} | GET |
Edit a specific application | ${baseURL}/application/{applicationId} | POST |
Add or edit a language template for an application | ${baseURL}/application/{applicationId}/language | POST |
Delete a language template | ${baseURL}/application/{applicationId}/language | DELETE |