# Batch Send

{% hint style="danger" %}
[Postman test site](https://test.postman.gov.sg/login) has a .csv file limit of 20 rows to ensure no load testing is done on this site. More information [here](https://cal.gov.sg/n2g21zn65d6nr2pd80cd051p) on load testing.
{% endhint %}

Sends multiple messages in a single API request.

You will need to prepare a CSV file where, in addition to recipient and language, each column represents a value to the campaign’s template parameter.

{% code title="Example CSV File" overflow="wrap" %}

```
recipient,language,recipient_name,topic
6599999999,english,Emily Yeo,passport application #12345F
6599999998,chinese,James Tan,passport application #67890A
```

{% endcode %}

You will then need to upload this file to this endpoint.

To upload your file, send a `multipart/form-data` request to this endpoint.

{% code title="Endpoint #4" %}

```sh
POST /campaigns/:campaignId/batch/messages
```

{% endcode %}

If your client code is written in JavaScript, consider using a `FormData` object to contain your file ([MDN Web API docs](https://developer.mozilla.org/en-US/docs/Web/API/FormData/Using_FormData_Objects)).

{% code title="Example JavaScript code" overflow="wrap" %}

```javascript
// Assuming you have a constant or variable named "file" which is a File object:

const formData = new FormData();
formData.append("file", file);

const request = new XMLHttpRequest();
request.setRequestHeader("Authorization", "Bearer " + YOUR_API_KEY);
request.open(
  "POST",
  "https://<POSTMAN_V2_API_BASE_URL>/api/v2/campaigns/<YOUR_CAMPAIGN_ID>/batch/messages"
);

request.send(formData);
```

{% endcode %}

{% code title="Response Body" %}

```json
{
    "isValid": true,
    "batchId": "<YOUR_BATCH_ID>"
}
```

{% 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://postman-v2.guides.gov.sg/endpoints-for-api-users/batch-send.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.
