API reference
USSD API
USSD API allows your applications to initiate USSD sessions using a HTTP-based API. You can build USSD menu driven applications, monetize based on menu request, maintain an active session with customs etc.
- Base URL
- https://api.mspace.lk
- Content type
- application/json;charset=utf-8
- Endpoints
- 2
Ussd Send Services
https://api.mspace.lk/ussd/sendThis service is used when sending USSD messages to a mobile phone from an application.USSD send service supports only POST HTTP requests.
Request bodyapplication/json;charset=utf-8
versionstringRequiredAPI version shall be numbered as 1.0, 2.0 etc.
If version is specified in the request, same version must be sent in the response.
If version is not specified in the request, the latest version will be specified in the response.
Example:1.0applicationIdstringRequiredUsed to identify the application. This is a unique identifier generated while provisioning an application.
Only a single value can be sent per request.
Example:APP_000001messagestringRequiredContent of the message sent by the application
Example:1. Press One 2. Press two 3. Press three 4. ExitpasswordstringRequiredUsed to authenticate the application originated message against the credentials of the service provider.
Encoded, single value.
Example:passwordsessionIdstringRequiredUnique number that USSD Gateway assigns to the application for the duration of the session. This number will be maintained in all the messages throughout a single session.
Example:1330929317043ussdOperationstringRequiredUSSD operation
mo-cont:TAP to assign for and USSD message originated from subscriber, that comes after a init
nmt-init: App to assign when a USSD session is initiated by an application
mt-cont: App to assign for any USSD message originated from application, that comes after a init
mt-fin: App to assign when session ends in final message
Data type will be string where the operation name itself will be used in the parameter value.
Enum:mo-initmo-contmt-initmt-contmt-finExample:mt-contdestinationAddressstringRequiredDestination address should be a telephone number (tel - for MSISDN)
Note : tel might be a masked number depending on the type of application
Example:tel:94702725777encodingstringOptionalEncoding scheme used in the message
440 - Plain ASCII characters
Enum:440Example:440
{
"version": "1.0",
"applicationId": "APP_000001",
"message": "1. Press One\n 2. Press two\n 3. Press three\n 4. Exit\n",
"password": "password",
"sessionId": "1330929317043",
"ussdOperation": "mt-cont",
"destinationAddress": "tel:94702725777 ",
"encoding": "440"
}Response200 successapplication/json;charset=utf-8
versionstringRequiredAPI version shall be numbered as 1.0, 2.0 etc.
If version is specified in the request, same version must be sent in the response.
If version is not specified in the request, the latest version will be specified in the response.
Example:1.0requestIdstringRequiredUniquely identifies a request within TAP
Example:101901031657410007timeStampstringRequiredProcessed timestamp
Example:20190103165801statusCodestringRequiredThe status code for the entire request
Enum:S1000E1303E1308E1309E1312E1313E1315E1317E1318E1319E1325E1334E1341E1342E1343E1601E1603Example:S1000statusDetailstringRequiredDescription of the status for the entire request.
S1000 - Process completed successfully for all the available destination numbers.
E1303 - IP address from which this request originated is not provisioned to send requests to application <application-id>. Please use a provisioned system to send requests or contact system admin to provision the new IP.
E1308 - Permanent charging error due to<specify_reason E.g., Insufficient Balance>.
E1309 - Requested SMS service is not allowed for this Application. Please check the issue with Idea Mart system administrator.
E1312 - Request is invalid. <specify_the_reason> Refer the TAP NBL API Developer Guide for the mandatory fields and correct format of the request.
E1313 - Authentication failed. No such active application with applicationId <application-id>, or no active service provider or the given password in the request is invalid.
E1315 - Cannot find the requested service SMS or it is not active.
E1317 - < MSISDN > in request is invalid or not allowed.
E1318 - Transaction limit per second has exceeded. Please throttle requests not to exceed the transaction limit. Contact TAP admin to increase the traffic limit.
E1319 - Transaction limit for today has exceeded. Please try again tomorrow or contact TAP admin to increase the transaction per day limit.
E1325 - Format of the address is invalid. Expected format is tel:94716177301.
E1334 - SMS sent to < application name > application could not be processed as the message length is too long. Maximum message length allowed is < specify_max_limit >.
E1341 - Request failed.An error occurred while sending the request for all the destinations.
E1342 - MSISDN is black listed. Not authorized to use the application <application_name>.
E1343 - MSISDN is not white listed. Only white list numbers are allowed to send messages at this state.
E1601 - System experienced an unexpected error.
E1603 - Temporary system error occurred while delivering your request
Example:Success.
{
"version": "1.0",
"requestId": "101901031657410007",
"timeStamp": "20190103165801",
"statusCode": "S1000",
"statusDetail": "Success."
}Code samples (Java, PHP, javaScript, .net): coming soon
Ussd Receive Services
https://api.mspace.lk/ussd/receiveThis service allows TAP to deliver MO messages to the application using HTTP – based API. The flow of messages is initiated by a MO request sent to an application,TAP will deliver the message to the application as an acknowledgement. Hence it could be either request-response exchange or a request-exception exchange.
Receive USSD request is a MO message which will be sent to the application through mSpace as a delivery request.
Request bodyapplication/json;charset=utf-8
versionstringRequiredAPI version shall be numbered as 1.0, 2.0 etc.
If version is specified in the request, same version must be sent in the response.
If version is not specified in the request, the latest version will be specified in the response.
Example:1.0applicationIdstringRequiredUsed to identify the application. This is a unique identifier generated while provisioning an application.
Only a single value can be sent per request.
Example:APP_000029messagestringRequiredContent of the message sent by the user
Example:*141#requestIdstringRequiredUniquely identifies a request within TAP
Example:1330933229901sessionIdstringRequiredUnique number that USSD Gateway assigns to the application for the duration of the session. This number will be maintained in all the messages throughout a single session.
Example:1330929317043ussdOperationstringRequiredUSSD operation
mo-cont:TAP to assign for and USSD message originated from subscriber, that comes after a init
mt-init: App to assign when a USSD session is initiated by an application
mt-cont: App to assign for any USSD message originated from application, that comes after a init
mt-fin: App to assign when session ends in final message
Enum:mo-initmo-contmt-initmt-contmt-finExample:mt-contsourceAddressstringRequiredAddress of the source.
sourceAddress:tel:94702725777
at least one will be specified
Example:tel:94702725777vlrAddressstringOptionalVLR(Visitor Location Register) address of the sender
Example:tel:94702725777encodingstringRequiredEncoding scheme used in the message
440 - Plain ASCII characters
Enum:440Example:440
{
"version": "1.0",
"applicationId": "APP_000029",
"message": "*141#",
"requestId": "1330933229901",
"sessionId": "1330929317043",
"ussdOperation": "mt-cont",
"sourceAddress": "tel:94702725777",
"vlrAddress": "tel:94702725777",
"encoding": "440"
}Response200 successapplication/json;charset=utf-8
statusCodestringRequiredThe status code for the entire request
Enum:S1000E1303E1308E1309E1312E1313E1315E1317E1318E1319E1325E1334E1341E1342E1343E1601E1603Example:S1000statusDetailstringRequiredDescription of the status for the entire request.
S1000 - Process completed successfully for all the available destination numbers.
E1303 - IP address from which this request originated is not provisioned to send requests to application <application-id>. Please use a provisioned system to send requests or contact system admin to provision the new IP.
E1308 - Permanent charging error due to<specify_reason E.g., Insufficient Balance>.
E1309 - Requested SMS service is not allowed for this Application. Please check the issue with Idea Mart system administrator.
E1312 - Request is invalid. <specify_the_reason> Refer the TAP NBL API Developer Guide for the mandatory fields and correct format of the request.
E1313 - Authentication failed. No such active application with applicationId <application-id>, or no active service provider or the given password in the request is invalid.
E1315 - Cannot find the requested service SMS or it is not active.
E1317 - < MSISDN > in request is invalid or not allowed.
E1318 - Transaction limit per second has exceeded. Please throttle requests not to exceed the transaction limit. Contact TAP admin to increase the traffic limit.
E1319 - Transaction limit for today has exceeded. Please try again tomorrow or contact TAP admin to increase the transaction per day limit.
E1325 - Format of the address is invalid. Expected format is tel:94716177301.
E1334 - SMS sent to < application name > application could not be processed as the message length is too long. Maximum message length allowed is < specify_max_limit >.
E1341 - Request failed.An error occurred while sending the request for all the destinations.
E1342 - MSISDN is black listed. Not authorized to use the application <application_name>.
E1343 - MSISDN is not white listed. Only white list numbers are allowed to send messages at this state.
E1601 - System experienced an unexpected error.
E1603 - Temporary system error occurred while delivering your request
Example:Success
{
"statusCode": "S1000",
"statusDetail": "Success"
}Code samples (Java, PHP, javaScript, .net): coming soon