SMS API

Overview

SMS Local SMS API allows you to test sending SMS messages to any destination through a REST API. Each message is identified by a unique random ID so that users can always check the status of a message using the given endpoint. SMS Local SMS API uses HTTP verbs and a RESTful endpoint structure with an access key (token) that is used as the API Authorization. Request and response payloads are formatted as JSON using UTF-8 encoding and URL encoded values.

API Endpoint

All URLs referenced in SMS Local CPaaS SMS API documentation have the base URL:
https:// {secure.smslocal.com} /api/service/enterprise-service/external/sms

Available HTTP methods 

SMS Local API uses HTTP verbs to understand if you want to read (GET), or create (POST) an object.
POST {protocol}:// {secure.smslocal.com} /api/service/enterprise-service/external/sms GET {protocol}:// {secure.smslocal.com} /api/service/enterprise-service/external/sms

Authentication Parameters

ParameterDescription
TokenWhen calling our API, send your access key with the authentication type set as Token (Example: Token: {accessKey}). Required.
Content-TypeSet to application/json
Authentication Example:
curl -X POST https://test-cpaas.enabld.tech/api/service/enterprise-service/external/sms -H
Token: 7K1aSEyjlE5FUf0

The Message Object

AttributesTypeDescription
msgiduuidA unique random ID which is created on the Service Provider platform and is returned upon creation of the object.
FromStringThe sender of the message. This can be a telephone number (including country code) or an alphanumeric string. In the case of an alphanumeric string, the maximum length is 11 characters.
tointRecipient number
contentstringThe content of the SMS message
datacodingintNote: Using Unicode will limit the maximum number of characters to 70 instead of 160. If message character size exceeds the limit, messages will be concatenated, resulting in separately billed messages.
SendOndatetimeThe date and time of the creation of the message in RFC3339 format (Y-m-dTH:i:sP)
directionstringTells you if the message is sent or received. mt: mobile terminated (sent to mobile) mo: mobile originated (received from mobile)
errorcodeintError code of message

Message Object Example (SMS)

{“msgid“:”jsauGFsyuadssaiu”,
from“:”new”,
to“:”373795846855”,
direction“:”mt”,
content“:”This is a test message”,
“datacoding”:”0″,
sendOn“:”2022-12-29T15:10:00+02:00”,
“errorcode”:”200″}

Send SMS

SMS Local Programmable SMS API enables you to programmatically send SMS messages from your web application. First, you need to create a new message object. SMS Local returns the created message object with each request. Send your first SMS message with this example request.
 
Example Request
curl –location –request POST https://test-cpaas.enabld.tech/api/service/enterprise-service/external/sms
-header Content-Type: application/json –header
Token: 7K1aSEyjlE5FUf0
data{“from”:”new”, “to”:”373795846855″,”content”:”This is a test message“}
Example Response
msgid“: “d0skeudgeh2l”, “errorcode“: “200”

Handle Status Report

Status reports are HTTP GET or POST requests that are sent to your platform. The requests hold information about the status of a message that you have sent through our API. Status reports are only provided for SMS messages that have a reference defined when sending the message, and a status report URL is set as report URL when sending the message or configured in their account as callback Endpoint.
AttributesTypeDescription
msgidstringThe message ID allocated to the message by CPaaS system when has been originally submitted.
recipientintThe recipient MSISDN.
statusint | nullError code that describes the failure (optional, null if not available). It may hold a Network specific error code or an SMSC error code for the attempted delivery of the message.
Status Error CodestringThe content of the SMS message
subdatedatetimeThe time and date at which the message has been submitted. In the case of a message which has been replaced, this is the date that the original message was replaced. The format is as follow: YYMMDDhhmm
donedatedatetimeThe time and date at which the message reached its final state. The format is the same as for the submit date.
datacodingstringThe encoding of the message. Possible values: GSM7, Unicode.
smspartintIndicates that SMS is part of long message.
smsidentifierintThe part number of long SMS.

Response

The platform of Enterprise should respond with a 200 OK HTTP header. When the platform doesn’t receive a 200 OK header, it will try to deliver the receipt again (according to STFW policy).
Example Request
GET http://secure.smslocal.com/ report?msgid=gstafd4saftghsad& recipient=373798756364& status=Delivrd&statusDatetime=2017-09-01T10:00:05+00:00&datacoding=Gsm7
Example Response
200 OK