API

Through our robust API, you can interface your website, application or system with our gateway by using our HTTP API. You will be able to send SMS and also check your balance with our API.

 

To Send Through Normal Route 

https://topsms.site/api/sms/sendsms?username=xxx&password=xxx&sender=@@sender@@&recipient=@@recipient@@&message=@@message@@

 

To Send Through DND  Route 

https://topsms.site/api/sms/dnd-route?username=yyy&password=xxx&sender=@@sender@@&recipient=@@recipient@@&message=@@message@@

 

DND Fall-back Route

To send through normal route then automatically use DND route as fall back for the number on DND

https://topsms.site/api/sms/dnd-fallback?username=yyy&password=xxx&sender=@@sender@@&recipient=@@recipient@@&message=@@message@@

 
To check Balance

https://topsms.site/api/sms/balance?username=xx&password=yyy

 

Parameters

1. recipient: The destination phone numbers. Separate multiple numbers with a comma(,)

3. username: Your topsms.site account username

4. password: Your topsms.site account password

5. sender: The sender ID to show on the receiver's phone

6. message: The text message to be sent

7. balance: Set to true only when you want to check your credit balance

 

The values that could be returned are

'TG00' => 'MESSAGE PROCESSED'
'TG11' => 'Invalid Authentication Credentials'
'TG12' => 'Empty Username'
'TG13' => 'Empty Password'
'TG14' => 'Empty Recipients'
'TG15' => 'Empty Message'
'TG16' => 'Empty SenderID'
'TG17' => 'Not Enough Units Balance'
'TG18' => 'Blocked Words Found Sender ID'
'TG19' => 'Blocked Words Found in Message Body'
'TG20' => 'Recipients above the maximum target'

 

BATCH CODE-BATCH DESCRIPTION:STATUSCODE|Recepient|MessageID|Message status|Status description,STATUSCODE|Recepient|MessageID|Message status|Status description

For Instance:

When a message is successfully accepted/processed by our system, the following response will be returned

TG00-MESSAGE PROCESSED:0000|2348012345678|9967534522177818556581618|SENT|MESSAGE SENT TO PROVIDER,3333|234803456789|6667534522177818556581618|DND_REJECTED|DND_REJECTED_NUMBER

Any other status apart from TG00 means the message is rejected and will not be processed. 

Each number sent will have its own message code, message id, message status and message description.

Message Code

Message status

Message Description

0000

SENT

MESSAGE SENT TO PROVIDER

2222

REJECTED

MESSAGE REJECTED

0014

DND_SENT

MESSAGE THROUGH COOPERATE

DND ROUTE

3333

DND_REJECTED

DND_REJECTED_NUMBER