2FA REST API
Overview
This page describes the resources that make up the 2FA REST API v1, for developers who want to integrate Two Factor Authentication into their application.
The 2FA REST API provides access to resources (data entities) via URI paths. To use a REST API, your application will make an HTTP request and parse the response. The response format is JSON. Your method will be the standard HTTP method POST.
Authentication
HTTP Basic Authentication is used for all requests. If you access the API without having the correct credentials OR permission to access the API, you will get a HTTP 401 response.
We will provide you with a username and password to use. Your application username is the same as your application name on this page. If you don’t have these details, please contact optussd@modicagroup.com.

Base URI
All API access is over HTTPS, and accessed from: https://api.sms.optus.com.au/rest/2fa
Versions
The REST API version is currently v1. A custom media type is used to let consumers choose the data format they wish to receive:
Accept: application/vnd.modica.2fa.v1+json
Creating a Challenge
To send a challenge to a mobile handset, submit a POST request:
POST /challenges
{
"destination": str:mobile-number
}
To add a personalised message simply add the optional ‘content’ attribute:
{
"content": "Your 2FA code is: %(code)s"
}
To mask the source to a custom string, add the optional ‘mask’ attribute:
{
"mask": "ModGrpExmpl"
}
To modify the validity time for the 2FA code, add the optional ’expiresIn’ attribute:
{
"expiresIn": "600"
}
On success:
HTTP/1.1 201 Created
X-Modica-Request-Id: uuid:request-id
{
"created": str:timestamp,
"expires": str:timestamp,
"id": uuid:challenge-id
}
On validation error:
HTTP/1.1 400 Bad Request
X-Modica-Request-Id: uuid:request-id
{
"error": str:error-code
}
Challenge Response
To validate a response to a challenge submit a POST request:
POST /responses
{
"challenge_id": uuid:challenge-id,
"code": str:challenge-code
}
On success:
HTTP/1.1 201 Created
X-Modica-Request-Id: uuid:request-id
{
"status": str:status-code
}
On validation error:
HTTP/1.1 400 Bad Request
X-Modica-Request-Id: uuid:request-id
{
"error": str:error-code
}
Help
Having trouble integrating with any of our services? Contact optussd@modicagroup.com and we’ll help you sort it out.