# Batch Sends

### batch\_create()

This method is for sending a batch of SMS messages to a list of mobile numbers contained in data file such as .csv, .zip, .xlsx, etc.\
\
This action supports zip compression of files, these must be base64 encoded zip files.

<mark style="color:green;">`POST`</mark> [`/https://eu-api.panaceamobile.com/json?action=batch_create`](#batch_create)

{% hint style="warning" %}
Please reach out to your Account Manager or Support to confirm your API URL as this may vary depending on your specific account configuration.&#x20;
{% endhint %}

**Query Parameters**

<table><thead><tr><th>Parameter</th><th width="140">Required</th><th>Description</th></tr></thead><tbody><tr><td><code>username</code></td><td>Yes</td><td>Provided account username</td></tr><tr><td><code>password</code></td><td>Yes</td><td>Provided account password</td></tr><tr><td><code>name</code></td><td>Yes</td><td>Name of the batch. This value is not unique</td></tr><tr><td><code>throughput</code></td><td>No</td><td>The desired speed for the batch: 1 – 100/s, 0 will imply fast as possible</td></tr><tr><td><code>filter</code></td><td>No</td><td>Deprecated – do not set or use</td></tr><tr><td><code>file_type</code></td><td>No</td><td><p>Default csv. </p><p></p><p><strong>Options:</strong></p><p>.csv – comma separated value file</p><p>.xls – Excel file</p><p>.zip – Zipped CSV file. May contain either .csv or .xls file.</p></td></tr><tr><td><code>start_time</code></td><td>No</td><td><p>Default not set, which will imply a manual start is required.</p><p>If you wish to start this batch automatically at a specified time set the timestamp in “YYYY-mm-dd HH:ii:ss” format, e.g. 2021-09-21 15:15:00. This time is in the user account’s set time zone. If a time in the past is specified, the batch will start automatically.</p></td></tr></tbody></table>

#### File Contents

The following columns are available. Any additional columns provided are discarded, or used as macro-replacement columns.

<table><thead><tr><th>Column</th><th width="167">Required</th><th>Description</th></tr></thead><tbody><tr><td>to</td><td>Yes</td><td>Phone number - format 0827247544 or 27827247544<br>Do not use 00 (double zero) or ignore the 0, e.g. 827247544 as this will be routed internationally.</td></tr><tr><td>from</td><td>Yes</td><td>Source address – although we will overwrite this value. So, it can be used as an ID or anything else internally. Max 20 characters.</td></tr><tr><td>message</td><td>Yes</td><td>The message content. Ensure to encode any relevant characters. Suggested max of 5 SMSs, more is possible but will depend on various other criteria</td></tr><tr><td>client_reference</td><td>No</td><td>Customer-defined value, max 36 characters</td></tr><tr><td>report_url</td><td>No</td><td><p>A URL-encoded, call-back location where we will push the message status updates. We replace the %d in the URL with the actual status code.</p><p></p><p>Example: https://sub.domain.com/path/to/script?id=12345&#x26;status=%d</p><p></p><p>Codes are listed under the report mask definition.</p></td></tr><tr><td>report_mask</td><td>No</td><td><p>This is the bitmask flag. If using the report URL call-back feature, simply set this value to 19.<br><br><strong>Codes:</strong></p><p></p><p>1 Delivered</p><p>2 Undelivered</p><p>16 Undelivered</p></td></tr></tbody></table>

### Examples

**cURL Example**

{% code overflow="wrap" %}

```
curl --location --request POST
'https://eu-api.panaceamobile.com/json?action=batch_create&username=USER&password=PASS&name=Test Batch 1' \
--data-urlencode 'data=to,from,message
27820000000,source000,"This is a test message"
27820000001,source001,"This is a test message"'
```

{% endcode %}

#### PHP Example

{% code overflow="wrap" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
    CURLOPT_URL=>
'https://eu-api.panaceamobile.com/jsonaction=batch_create&username=USER&password=PASS&name=Test%20Batch%201',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_ENCODING => '',
    CURLOPT_MAXREDIRS => 10,
    CURLOPT_TIMEOUT => 0,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS =>
'data=to%2Cfrom%2Cmessage%0A27820000000%2Csource000%2C%22This%20is%20a%20test%20message%22%0A27820000001%2Csource001%2C%22This%20is%20a%20test%20message%22%0A'
,));


$response = curl_exec($curl);
    
curl_close($curl);
echo $response;
```

{% endcode %}

{% hint style="danger" %}
Please ensure you replace USER and PASS with their correct values.
{% endhint %}

***

For developers looking for practical implementation guidance, please visit our **Examples** page. Here, you'll find a comprehensive collection of code samples tailored to help you integrate and use our HTTPS API effectively.

{% content-ref url="/pages/ne2mxI3hQBIJ2JIGt8V0" %}
[Examples](/panacea-mobile-help-centre/developers/https-api/examples.md)
{% endcontent-ref %}


---

# 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://panaceamobile.gitbook.io/panacea-mobile-help-centre/developers/https-api/batch-sends.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.
