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
Request OTP
https://api.mspace.lk/otp/requestThis 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
applicationIdstringRequiredID of the application
Example:APP_000375passwordstringRequiredPassword/API key given to uniquely identify the application
Example:a07118cda5215fc6d01db5b2ab848eddsubscriberIdstringRequiredMobile number of the end consumer
Example:tel:94716177301applicationHashstringOptionalHash string to determine which verification messages to send to your app.
Example:abcdefghapplicationMetaDataobjectOptionalObject fields
clientENUMOptionalClient type. values will be web browser or mobile app
Example:MOBILEAPPdevicestringOptionalType/OS of device iPhone 6,Galaxy S5,PC, etc.
Example:Samsung S10osstringOptionalOS/Device version Android 6, iOS 5, Windows 10
Example:android 8appCodestringOptionalIf 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
{
"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
versionstringRequiredAPI version
Example:1.0statusCodestringRequiredThe status code for the entire request.
Note: When the request is successful, statusCode will be S1000.
Example:S1000referenceNostringRequiredReference key to uniquely Identify the request
Example:213561321321613statusDetailstringRequiredThe 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
{
"version": "1.0",
"statusCode": "S1000",
"referenceNo": "213561321321613",
"statusDetail": "Success"
}Code samples (Java, PHP, javaScript, .net): coming soon
Verify OTP
https://api.mspace.lk/otp/verifyThis 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
applicationIdstringRequiredID of the application
Example:APP_000375passwordstringRequiredPassword/API key given to uniquely identify the application
Example:a07118cda5215fc6d01db5b2ab848eddreferenceNostringRequiredReference number returned with request OTP API
Example:213561321321613otpstringRequiredOne time password (OTP) to be used to MSISDN verification for the application
Example:123564
{
"applicationId": "APP_000375",
"password": "a07118cda5215fc6d01db5b2ab848edd",
"referenceNo": "213561321321613",
"otp": "123564"
}Response200 successapplication/json;charset=utf-8
versionstringRequiredAPI version
Example:1.0statusCodestringRequiredThe status code for the entire request.
Note: When the request is successful, statusCode will be S1000.
Example:S1000subscriptionStatusENUMRequiredSubscription status of the user
Example:REGISTEREDstatusDetailstringRequiredThe 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:SuccesssubscriberIdstringOptionalMasked mobile number of the end consumer.
Application has to use this for any subsequent request sent to TAP.
Example:tel:sdfasdfasdfwqerqwtgfgsafgasfgasdfasdfasdfasdfasdfasf
{
"version": "1.0",
"statusCode": "S1000",
"subscriptionStatus": "REGISTERED",
"statusDetail": "Success",
"subscriberId": "tel:sdfasdfasdfwqerqwtgfgsafgasfgasdfasdfasdfasdfasdfasf"
}Code samples (Java, PHP, javaScript, .net): coming soon