Skip to content

API reference

OTP API

OTP API allows you to incorporate a One Time Password (OTP) verification process to enable subscription in the mobile application developed by you.

Base URL
https://api.mspace.lk
Content type
application/json;charset=utf-8
Endpoints
2
POSTotp/request

Request OTP

https://api.mspace.lk/otp/request

This service is used by the developer to request an OTP for a subscriber's MSISDN. Upon the request, mSpace will generate and send an OTP to the subscriber's MSISDN. This OTP must be entered by the subscriber into the mobile/web application to activate a subscription.

Request bodyapplication/json;charset=utf-8

applicationId
stringRequired

ID of the application

Example:APP_000375
password
stringRequired

Password/API key given to uniquely identify the application

Example:a07118cda5215fc6d01db5b2ab848edd
subscriberId
stringRequired

Mobile number of the end consumer

Example:tel:94716177301
applicationHash
stringOptional

Hash string to determine which verification messages to send to your app.

Example:abcdefgh
applicationMetaData
objectOptional
Object fields
client
ENUMOptional

Client type. values will be web browser or mobile app

Example:MOBILEAPP
device
stringOptional

Type/OS of device iPhone 6,Galaxy S5,PC, etc.

Example:Samsung S10
os
stringOptional

OS/Device version Android 6, iOS 5, Windows 10

Example:android 8
appCode
stringOptional

If you use app in store, your app identifier. If you use the web browser, web link

Example:https://play.google.com/store/apps/details?id=lk
Request sampleJSON
{
  "applicationId": "APP_000375",
  "password": "a07118cda5215fc6d01db5b2ab848edd",
  "subscriberId": "tel:94716177301",
  "applicationHash": "abcdefgh",
  "applicationMetaData": {
    "client": "MOBILEAPP",
    "device": "Samsung S10",
    "os": "android 8",
    "appCode": "https://play.google.com/store/apps/details?id=lk"
  }
}

Response200 successapplication/json;charset=utf-8

version
stringRequired

API version

Example:1.0
statusCode
stringRequired

The status code for the entire request.

Note: When the request is successful, statusCode will be S1000.

Example:S1000
referenceNo
stringRequired

Reference key to uniquely Identify the request

Example:213561321321613
statusDetail
stringRequired

The status detail for the entire request

S1000 - Successfully send OTP challenge to [msisdn/sender ID]

E1853 - Maximum number of OTP requests reached for [msisdn/sender ID]

E1856 - Invalid Request

E1857 - Internal Server Error Occur

E1301 - Requested ApplicationID is not allowed within the System for operator unknown.

E1346 - Subscription request for < MSISDN > could not be processed as the subscription rate limit has been exceeded. Maximum of < MAX_SUBS_PER_WINDOW > subscription attempts allowed within < WINDOW_SECONDS > seconds. Please try again after < retryAfter > seconds.

E1347 - Subscription request for < MSISDN > could not be processed as the maximum active subscription limit of < MAX_ACTIVE_SUBS > has been reached. The subscriber must unsubscribe from an existing application before subscribing to a new one.

Note: When E1346 or E1347 is returned, no OTP is sent to the subscriber.

Example:Success
Response sample200 · JSON
{
  "version": "1.0",
  "statusCode": "S1000",
  "referenceNo": "213561321321613",
  "statusDetail": "Success"
}

Code samples (Java, PHP, javaScript, .net): coming soon

POSTotp/verify

Verify OTP

https://api.mspace.lk/otp/verify

This service is used by the developer to verify an OTP entered by a subscriber into the application. Upon a successful verification the subscription process of mSpace will be activated.

Request bodyapplication/json;charset=utf-8

applicationId
stringRequired

ID of the application

Example:APP_000375
password
stringRequired

Password/API key given to uniquely identify the application

Example:a07118cda5215fc6d01db5b2ab848edd
referenceNo
stringRequired

Reference number returned with request OTP API

Example:213561321321613
otp
stringRequired

One time password (OTP) to be used to MSISDN verification for the application

Example:123564
Request sampleJSON
{
  "applicationId": "APP_000375",
  "password": "a07118cda5215fc6d01db5b2ab848edd",
  "referenceNo": "213561321321613",
  "otp": "123564"
}

Response200 successapplication/json;charset=utf-8

version
stringRequired

API version

Example:1.0
statusCode
stringRequired

The status code for the entire request.

Note: When the request is successful, statusCode will be S1000.

Example:S1000
subscriptionStatus
ENUMRequired

Subscription status of the user

Example:REGISTERED
statusDetail
stringRequired

The status detail for the entire request

S1000 - Successfully validated OTP for [msisdn/sender ID]

E1850 - Invalid OTP

E1851 - OTP request has being expired

E1852 - Maximum number of OTP attempts had reached

E1854 - Could not find OTP

E1855 - Invalid Reference Number

E1857 - Internal Server Error Occur

E1301 - Requested ApplicationID is not allowed within the System for operator unknown.

Example:Success
subscriberId
stringOptional

Masked mobile number of the end consumer.

Application has to use this for any subsequent request sent to TAP.

Example:tel:sdfasdfasdfwqerqwtgfgsafgasfgasdfasdfasdfasdfasdfasf
Response sample200 · JSON
{
  "version": "1.0",
  "statusCode": "S1000",
  "subscriptionStatus": "REGISTERED",
  "statusDetail": "Success",
  "subscriberId": "tel:sdfasdfasdfwqerqwtgfgsafgasfgasdfasdfasdfasdfasdfasf"
}

Code samples (Java, PHP, javaScript, .net): coming soon