To send an SMS through our API, you will need to make a HTTP POST request to 

https://<your_api_key>:<your_api_token>@<subdomain>/v1/Accounts/~exotel_sid~/Sms/send

 

  • Replace <your_api_key> and <your_api_token> with the API key and token created by you.

  • Replace <your_sid> with your “Account sid”

  • Replace <subdomain> with the region of your account

    • <subdomain> of Singapore cluster is api.exotel.com

    • <subdomain> of Mumbai cluster is api.in.exotel.com

<your_api_key> , <your_api_token> and <your_sid> are available in the API settings page of your Exotel Dashboard  



 

The HTTP request, available parameters and sample responses can be viewed on our developer channel.

Following are the mandatory parameters to be added along with the SMS API Request.

From:   Specify one of your ExoPhone or Sender ID (header) linked to it.
- To:        Mobile number to which SMS has to be sent.
- Body:   Content (Template) of your SMS.
DltTemplateId: Applicable only for SMS sent by Indian businesses to Indian destination numbers.   
DltEntityId: Applicable only for SMS sent by Indian businesses to Indian destination numbers.  



 

Errors:

When there are errors with the SMS submission, the HTTP code will be not 200. Like any good REST API, we give appropriate HTTP codes which give you hints on what type of errors it is and how you can handle it. You can refer here for more details on HTTP codes.

In addition to the HTTP Status code, the body of the SMS contains an XML with the details of the error

The XML (in the HTTP body) is of this form:

 

<TwilioResponse>

<RestException>

         <Status>xxx</Status>

         <Message>Detailed error message</Message>

    </RestException>

</TwilioResponse>

 

The 'Status' is the HTTP code itself again

The 'Message' gives you more details on the error. 

 

Example Status and Messages are below.

 

Status

Message

400

 Invalid Parameters

400 

 Invalid Recipient [xxxx]

403 

 Account is not active

403

 Insufficient balance to send the SMS

403

 Account validity has expired 

429

 Too Many Requests 

500 

 Internal Server Error

 

NOTE: Do not rely on the "Message" while doing your integration. Always rely only on the HTTP 'Status' code. 

 

SMS Delivery Status:

Please refer here on how to monitor the delivery status of your SMS.

 

Sample PHP and Java code to send SMS is available at Github

 

Before you start sending transactional SMS through this API, Please test whether your content is matching a template. Otherwise, the SMS ends up becoming promotional and this causes a lot of confusion.

 

For a detailed description of these Statues, See Exotel SMS status codes