Loading...

Bulk SMS JSON API


In order to use the JSON API you need to have an account on Ebulk SMS.

You may register an account and start testing our API right away. Click here to get started

Once you have an account you will be able to start sending JSON requests to our API in the format below

{
"SMS": {
    "auth": {
        "username": "your_username",
        "apikey": "your_api_key"
    },
    "message": {
        "sender": "Sender_Name",
        "messagetext": "Your_message_content",
        "flash": "0"
    },
    "recipients":
    {
        "gsm": [
            {
                "msidn": "23480...",
                "msgid": "uniqueid1..."
            },
            {
                "msidn": "23480...",
                "msgid": "uniqueid2..."
            }
        ]
    }
}
}

Now you only have to post the above JSON data using HTTP post to: http://api.ebulksms.com:8080/sendsms.json

 

Parameters

Name Description
username Your login username on eBulkSMS (same as your email address)
apikey This is generated for you here.
sender

Your chosen sender name

Alphanumeric sender name: Maximum of 11 characters

Numeric sender name: Maximum of 14 characters

messagetext

The text message you wish to send

Single page message is 160 characters

Maximum of 6 pages with 918 characters

flash

0 - for normal SMS.

1 - for flash text (Only displays on the screen and will not be saved to the recipients phone)

gsm

Recipient’s mobile number in full international format

For messages which require delivery reports be sure include your unique message id for each GSM phone number in the JSON data:

{"gsm": {"msidn": "23480...", "msgid": "unique_message_id..."}}

VERY IMPORTANT!!! Ensure you specify the "application/json" Content-Type header. If you do not send this header you may get some unexpected errors.

 

If for any reason you post an XML request to the JSON API the response would be a 500 server error in an unformatted string.

 

Please note that if you are on a shared hosting server you may have to send a request to your hosting company to open outgoing connections on port 8080 to api.ebulksms.com Here is a sample message you can send.


Dear Web Hosting Team,
Please I need access to the API on www.ebulksms.com
The API runs on port 8080. 
Kindly grant my request by opening outgoing connections to api.ebulksms.com on port 8080.
Thanks.
    
 

API Responses


The following responses will indicate if your message was received - success, or if there was an error in your request - failure.

Importantly, you must be aware that errors that have to do with recipient numbers are permanent and such messages should not be resent.

For errors relating to the message format and actual message you could modify the message and resend it.

The same applies to the sender name. As much as possible avoid using special characters in the sender name.

 
Status Description
INVALID_JSON The JSON format is not valid.
MISSING_USERNAME Username field is empty
MISSING_APIKEY API Key field is empty
AUTH_FAILURE The username and API key combination is not correct.
MISSING_SENDER Sender name is empty
MISSING_MESSAGE Empty message content
MISSING_RECIPIENT No mobile phone number was found
INVALID_RECIPIENT An invalid mobile phone number was found
INVALID_MESSAGE Message is either too long or contains characters that cannot be sent.
INVALID_SENDER The sender name entered is not valid or is missing.
INSUFFICIENT_CREDIT Your account balance is too low to send the message.
UNKNOWN_CONTENTTYPE Check you post method to ensure you have included a content-type header of "application/json" or "text/json".
UNKNOWN_ERROR Rarely used - Errors in data specification / headers.
SUCCESS Your message was received successfully.
 

Other Error Responses

If for any reason you post an XML request to the JSON API the response would be a 500 server error in an unformatted string.

 

Response Format

Since we are using the JSON API, each of the above responses would be sent back with a JSON format as shown below.

{
    "response": {
        "status": "STATUS_STRING",
        "totalsent": "<number of recipients>",
        "cost": "<units charged>"
    }
}
 

Checking SMS Credit Balance


You may check your SMS balance using the API with a simple HTTP GET request. Just make a request to this URL:

http://api.ebulksms.com:8080/balance/username/apikey

Here you will replace username and apikey with your username(email) and generated API key respectively.


For sample code on how to implement this in PHP please click here.


You may download this API documentation here.