API reference
SMS API
SMS API allows your application to send messages to your subscriber base and receive messages from your subscribers. It also provides you an extra service of reporting delivery details of messages to track the status of the delivery.
- Base URL
- https://api.mspace.lk
- Content type
- application/json;charset=utf-8
- Endpoints
- 3
SMS Mobile Termination
https://api.mspace.lk/sms/sendThis service allows the user to send SMS to one or more terminals (phones or any SMS-enabled device) from their application.
SMS send service supports only POST HTTP requests. This is used when sending SMS to a mobile phone from an application.
An application wishing to initiate an MT SMS message should use this operation type.
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_999999passwordstringRequiredUsed to authenticate the application originated message against the credentials of the service provider.
Encoded, single value.
Example:passwordmessagestringRequiredContent of the message that needs to be sent.
Messages over the limit shall be broken up by the platform before sending
Example:HellodestinationAddressesarray of stringsRequiredList of destination addresses should be telephone numbers.(tel - for MSISDN).
tel:94702725777.
Address can also have the value - tel: all
which will in return be a message to the subscribed base of the application
at least one should be specified
Note : tel might be a masked number depending on the type of application
sourceAddressstringOptionalAddress of the source.
sourceAddress: tel:94702725777
at least one will be specified
Example:77000deliveryStatusRequeststringOptionalIndicates the need of a Delivery Status Report for the message.
0 - Delivery Report not required
1 - Delivery Report Required
Enum:01Example:1encodingstringOptionalEncoding scheme used in the message
If not specified taken as Text
If the encoding type is “Binary” then the message content will be represented as hex encoded.
0 - Text
240 - Flash SMS
245 - Binary SMS
Enum:0240245Example:245binaryHeaderstring <hexadecimal>OptionalFor advanced type of messages where the binary header shall be sent from the application
Example:526574697265206170706c69636174696f6e20616e642072656c6561736520524b7320696620666f756e642065787069726564
{
"version": "1.0",
"applicationId": "APP_999999",
"password": "password",
"message": "Hello",
"destinationAddresses": [
"tel:94702725777"
],
"sourceAddress": "77000",
"deliveryStatusRequest": "1",
"encoding": "245",
"binaryHeader": "526574697265206170706c69636174696f6e20616e642072656c6561736520524b7320696620666f756e642065787069726564"
}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:101901031657410007destinationResponsesarray of objectsRequiredThe list of responses for the full list of addresses
It will be a collection with individual entry for each element in the address list of the request.
-Address
- timeStamp - Processed Time stamp
- messageId - Message Identifier
- statusCode - Status Code
- statusDetail – Status detail
Array item fields
timeStampstringOptional- Example:
20190103165801 addressstringOptional- Example:
tel:94702725777 messageIdstringOptional- Example:
101901031657410007 statusCodestringOptionalThe status code for the entire request
Enum:S1000E1303E1308E1309E1311E1312E1313E1315E1317E1318E1319E1325E1331E1334E1335E1341E1342E1343E1601E1603Example:S1000statusDetailstringOptionalThe status detail 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 request to application <application-id>. Please use a provisioned system to send request 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 mSpace system administrator.
E1311 - Mobile terminated SMS messages are not enabled. Check your NCS configuration in provisioning.
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:94702725777.
E1331 - < sourceAddress > is not allowed. Please use one of the values configured in alias configuration in the SLAs or send the request without < sourceAddres s>, so mSpace will use the default source address to send the message to subscriber.
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 >.
E1335 - SMS sent to < application name > application could not be processed as the advertisement message length is too long. Maximum message length allowed for advertisements is < specify_max_adv_limit >.
E1341 - Request failed. Errors 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
statusCodestringRequiredThe status code for the entire request
Enum:S1000E1303E1308E1309E1311E1312E1313E1315E1317E1318E1319E1325E1331E1334E1335E1341E1342E1343E1601E1603Example: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 mSpace system administrator.
E1311 - Mobile terminated SMS messages are not enabled. Check your NCS configuration in provisioning.
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:94702725777.
E1331 - < sourceAddress > is not allowed. Please use one of the values configured in alias configuration in the SLAs or send the request without < sourceAddress>, so mSpace will use the default source address to send the message to subscriber.
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 >.
E1335 - SMS sent to < application name > application could not be processed as the advertisement message length is too long. Maximum message length allowed for advertisements is < specify_max_adv_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 listed 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",
"destinationResponses": [
{
"timeStamp": "20190103165801",
"address": "tel:94702725777",
"messageId": "101901031657410007",
"statusCode": "S1000",
"statusDetail": "Success"
}
],
"statusCode": "S1000",
"statusDetail": "Success."
}Code samples (Java, PHP, javaScript, .net): coming soon
SMS Mobile Origination
https://api.mspace.lk/sms/receiveThis service retrieves the SMS sent to the web application. Receive service returns only a list of SMS messages received since the previous invocation of the method.
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_000029sourceAddressstringRequiredAddress of the source.
sourceAddress: tel:94702725777
at least one will be specified
Example:tel:94702725777messagestringRequiredContent of the message sent by the user
requestIdstringRequiredUniquely identifies a request within TAP
Example:APP_000001encodingstringRequiredEncoding scheme used in the message.
If the encoding type is “Binary” then the message content will be represented as hex encoded.
0 - Text
240 - Flash SMS
245 - Binary SMS
Enum:0240245Example:0
{
"version": "1.0",
"applicationId": "APP_000029",
"sourceAddress": "tel:94702725777",
"message": "string",
"requestId": "APP_000001",
"encoding": "0"
}Response200 successapplication/json;charset=utf-8
statusCodestringRequiredThe status code for the entire request
Enum:S1000E1303E1308E1309E1311E1312E1313E1315E1317E1318E1319E1325E1331E1334E1335E1341E1342E1343E1601E1603Example: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 mSpace system administrator.
E1311 - Mobile terminated SMS messages are not enabled. Check your NCS configuration in provisioning.
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:94702725777.
E1331 - < sourceAddress > is not allowed. Please use one of the values configured in alias configuration in the SLAs or send the request without < sourceAddress>, so mSpace will use the default source address to send the message to subscriber.
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 >.
E1335 - SMS sent to < application name > application could not be processed as the advertisement message length is too long. Maximum message length allowed for advertisements is < specify_max_adv_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 listed 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
Delivery Status Report Service
https://api.mspace.lk/sms/reportWhen performing a SendSms Operation if an application has requested for a Delivery Response message from the Message Centre, then TAP will initiate the Delivery Report service to hand over the Delivery Response message to the application. The messageId should be used to match the MT response with the Delivery Report.
Request bodyapplication/json;charset=utf-8
destinationAddressstringRequiredAddress of the subscriber
Example:tel:94702725777timeStampstringRequiredThe timestamp sent from the SMS
"yyMMddHHmm"
yy – last two digits of the year (00-99)
MM – month (01-12)
dd – day (01-31)
HH – hour (00-23)
mm- minute (00-59)
Example:20120113082110requestIdstringRequiredUniquely identifies a request within TAP
Example:MSG_000111deliveryStatusstringRequiredEnum from TAP to Application:
DELIVERED ,EXPIRED ,DELETED ,UNDELIVERABLE ,ACCEPTED ,UNKNOWN ,REJECTED
Enum:DELIVEREDEXPIREDDELETEDUNDELIVERABLEACCEPTEDUNKNOWNREJECTEDExample:DELIVERED
{
"destinationAddress": "tel:94702725777",
"timeStamp": "20120113082110",
"requestId": "MSG_000111",
"deliveryStatus": "DELIVERED"
}Response200 successapplication/json;charset=utf-8
statusCodestringRequiredThe status code for the entire request
Enum:S1000E1303E1308E1309E1311E1312E1313E1315E1317E1318E1319E1325E1331E1334E1335E1341E1342E1343E1601E1603Example: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 mSpace system administrator.
E1311 - Mobile terminated SMS messages are not enabled. Check your NCS configuration in provisioning.
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:94702725777.
E1331 - < sourceAddress > is not allowed. Please use one of the values configured in alias configuration in the SLAs or send the request without < sourceAddress>, so mSpace will use the default source address to send the message to subscriber.
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 >.
E1335 - SMS sent to < application name > application could not be processed as the advertisement message length is too long. Maximum message length allowed for advertisements is < specify_max_adv_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 listed 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