# Send message

This command allows you to send one or more SMS messages. To send messages to your database of mobile numbers, you can call this command in a loop.

The server will respond with a unique identifier for each message (referred to as an API message ID). This API message ID can be used to track and monitor the status of your message.

You can also send to multiple handsets in one single `HTTP/S` request by comma separating mobile numbers (up to 300 numbers with an `HTTP` `GET` and 600 with `HTTP` `POST`). This is useful if you are sending the same message text to all the handsets.

For high volume messaging, we encourage the use of persistent `HTTP/S` connections (keep-alive). Multiple concurrent `HTTP/S` connections may also be used for additional performance.

### **Command**

You can copy and paste the URL below into your web browser. Simply set your authentication details, mobile number and text. Remember to URL encode your parameter values.

{% code overflow="wrap" fullWidth="true" %}

```
https://api.clickatell.com/http/sendmsg?user=xxxx&password=xxxx&api_id=xxxx&to=xxxx&text=xxxx
```

{% endcode %}

### **Parameters**

In addition to authentication parameters, only *to* and *text* are required to send a message. It’s important to note that when sending from a two-way number, the *from* and *mo* parameters will also be required as stated in the table below.

<table><thead><tr><th width="136">Parameter</th><th width="145">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>to</code></td><td>Yes</td><td>The mobile number to which the message must be delivered. The number should be in international number format (i.e. no leading zeros or + symbol should be used).</td></tr><tr><td><code>text</code></td><td>Yes</td><td>The text content of the message. Note that some characters take up two character spaces due to GSM encoding standards.</td></tr><tr><td><code>msg_callback</code></td><td>No</td><td>Enable message delivery status updates to be sent to your server via an HTTP request. </td></tr><tr><td><code>from</code></td><td>Only when sending from a two-way number or specifying a custom sender ID.</td><td>The two-way number that you are sending from. This parameter is only required if you want to send messages using a two-way number OR when a two-way number is a legal requirement to send messages as is the case in the USA, for example.</td></tr><tr><td><code>mo</code></td><td>Only when sending from a two-way number.</td><td>Must be set to 1 when sending from a two-way number.</td></tr></tbody></table>

### **Examples**

#### **Send to two mobile numbers:**

{% code overflow="wrap" %}

```
https://api.clickatell.com/http/sendmsg?user=xxxx&password=xxxx&api_id=xxxx&to=2799900001,2799900002&text=xxxx<.pre>
```

{% endcode %}

#### **Send a Unicode message:**

{% code overflow="wrap" %}

```
https://api.clickatell.com/http/sendmsg?user=xxxx&password=xxxx&api_id=xxxx&to=2799900001&text=005400680069007300200069007300200061002000730061006d0070006c00650020006d006500730073006100670065002000730065006e007400200061007300200055006e00690063006f0064006500200064006100740061002e&unicode=1
```

{% endcode %}

#### **Send a flash message:**

{% code overflow="wrap" %}

```
https://api.clickatell.com/http/sendmsg?user=xxxx&password=xxxx&api_id=xxxx&to=2799900001&text=xxxx&msg_type=SMS_FLASH
```

{% endcode %}

#### **Send a binary message:**

{% code overflow="wrap" %}

```
https://api.clickatell.com/http/sendmsg?user=xxxx&password=xxxx&api_id=xxxx&to=2799900001&text=040601AE02056A0045C60C037368008503656B732E636F6D0008010374657374000101&udh=0605040B8423F0
```

{% endcode %}

#### **Use callback and sender id:**

{% code overflow="wrap" %}

```
https://api.clickatell.com/http/sendmsg?user=xxxx&password=xxxx&api_id=xxxx&to=2799900001&text=xxxx&callback=2&from=123456789
```

{% endcode %}

### **Code samples**

#### **Single number submission**

*Bash*

{% code overflow="wrap" lineNumbers="true" %}

```
username="place username here"
password="place password here"
api_id="place password here"
to="mobile number"message="Test+Message"
curl --data "user=$username&password=$password&api_id=$api_id&to=$to&text=$message" \ 'https://api.clickatell.com/http/sendmsg'
```

{% endcode %}

*PHP*

{% code overflow="wrap" lineNumbers="true" %}

```
<?php $username = urlencode("place username here");
 $password = urlencode("place password here");
 $api_id = urlencode("place api_id here");
 $to = urlencode("mobile number");
 $message = urlencode("Test Message");
 
 echo file_get_contents("https://api.clickatell.com/http/sendmsg"
 . "?user=$username&password=$password&api_id=$api_id&to=$to&text=$message"); ?>
```

{% endcode %}

*Python*

{% code overflow="wrap" lineNumbers="true" %}

```
import urllib2,
 
urllib params = { "user": "place username here", "password": "place password here", "api_id": "place password here", "to": "mobile number", "text": "message" }
 
params = urllib.urlencode(params)
 
f = urllib2.urlopen("https://api.clickatell.com/http/sendmsg", params)
 
print f.read()
```

{% endcode %}

#### **Multiple number submission**

*HTTP GET URL:*

{% code overflow="wrap" %}

```
https://api.clickatell.com/http/sendmsg?user=xxxx&password=xxxx&api_id=xxxx&to=xxxx,xxxx,xxxx&text=xxxx
```

{% endcode %}

*Bash*

{% code overflow="wrap" lineNumbers="true" %}

```
username="place username here"
password="place password here"
api_id="place password here"
to="number 1,number 2,number 3"
message="message"
 
curl --data "user=$username&password=$password&api_id=$api_id&to=$to&text=$message" \ 'https://api.clickatell.com/http/sendmsg'
```

{% endcode %}

*PHP*

{% code overflow="wrap" lineNumbers="true" %}

```
<?php
 
$username = urlencode("place username here");
$password = urlencode("place password here");
$api_id = urlencode("place api_id here");
 
$toList = array(urlencode("number 1"),urlencode("number 2"),urlencode("number 3"));
 
$to = implode(',', $toList);
$message = urlencode("Test Message");
echo file_get_contents("https://api.clickatell.com/http/sendmsg" . "?user=$username&password=$password&api_id=$api_id&to=$to&text=$message"); ?>
```

{% endcode %}

*Python*

{% code overflow="wrap" lineNumbers="true" %}

```
import urllib2,
 
urllib params = { "user": "place username here", "password": "place password here", "api_id": "place password here", "to": ",".join({"number 1", "number 2", "number 3"}), "text": "message" }
 
params = urllib.urlencode(params)
f = urllib2.urlopen("https://api.clickatell.com/http/sendmsg", params)
print f.read()
```

{% endcode %}

### **API responses**

#### **Example response – Single number submission**

*Successful API response:* 

{% code overflow="wrap" %}

```
ID: f7012c1edff2509a19ce1667c7f52b18
```

{% endcode %}

*Error response:*

{% code overflow="wrap" %}

```
ERR: 101, Authentication failed
```

{% endcode %}

#### **Example response – Multiple number submission**

*Successful API response:*

{% code overflow="wrap" %}

```
ID: f6b9af2a2c9e5b18ee2d257e3def5d66 To: <number 1> ID: 3e3ca2485ff340185e4af50851422943 To: <number 2> ID: 48e783af2f1e918f544d389310317369 To: <number 3>
```

{% endcode %}

*Error response:*

{% code overflow="wrap" %}

```
ERR: 001, Authentication failed To: <number 1> ERR: 001, Authentication failed To: <number 2> ERR: 001, Authentication failed To: <number 3>
```

{% endcode %}

#### **Format – Single number submission**

*Successful API response:* 

{% code overflow="wrap" %}

```
ID: <message ID>
```

{% endcode %}

*Error response:*

{% code overflow="wrap" %}

```
ERR: <error code>, <error description>
```

{% endcode %}

#### **Format – Multiple number submission**

*Successful API response:*

{% code overflow="wrap" %}

```
ID: <message ID> To: <number 1> ID: <message ID> To: <number 2> ID: <message ID> To: <number 3>
```

{% endcode %}

*Error response:*

{% code overflow="wrap" %}

```
ERR: <error code>, <error description> To: <number 1> ERR: <error code>, <error description> To: <number 2> ERR: <error code>, <error description> To: <number 3>
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.clickatell.com/developers-api-reference/developers-archive/sms-http-s-api/send-message.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
