> For the complete documentation index, see [llms.txt](https://postman-v2.guides.gov.sg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://postman-v2.guides.gov.sg/endpoints-for-api-users/retrieve-batch.md).

# Retrieve Batch

{% hint style="danger" %}
We will be updating our response payload to include a `creatorId` field from **24 Feb 2025**. Please read the last section to find out where the amendment is and update your own systems if necessary, **before 24 Feb 2025.**
{% endhint %}

Retrieves messages and their delivery statuses given a batch ID. Please refer to this table in [possible message statuses](/endpoints-for-api-users/the-message-object.md#lateststatus-string) and what they mean on what each message status means.

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

```sh
GET /campaigns/:campaignId/batch/:batchId/messages
```

{% endcode %}

### Supported Query Parameters

#### `limit` string (Mandatory)

You can specify the number of messages to return per page using the `limit` query parameter. The minimum value is 1, and the maximum value is 1000.

#### `after` string (Optional)

Find messages after the cursorId

#### `before` string (Optional)

Find messages before the cursorId

#### `search` string (Optional)

This supports searching by recipient phone number only.

It is a substring match, eg. a "11" would match with "91122233"

**\[Now to 26 Jan 2025] Example response body**

{% code title="Example response body" overflow="wrap" %}

```json
{
    "data": [
        {
            "createdAt": "2024-05-16T16:34:06.582+08:00",
            "updatedAt": "2024-05-16T16:35:13.122+08:00",
            "id": "<YOUR_MESSAGE_ID>",
            "recipient": "6522222222",
            "values": {
                "body": "test"
            },
            "fullMessage": "This is a test message used for training purposes.\n\nOpen Government Products\n\n---\n\ntest\n\n---\n\nThis is an automated message sent by the Singapore Government.",
            "latestStatus": "failure",
            "templateBodyId": "<YOUR_GENERATED_TEMPLATE_ID>",
            "campaignId": "<YOUR_GENERATED_CAMPAIGN_ID>",
            "templateBody": {
                "createdAt": "2024-05-06T11:00:03.467+08:00",
                "updatedAt": "2024-05-06T11:00:03.467+08:00",
                "id": "<YOUR_GENERATED_TEMPLATE_BODY_ID>",
                "templateId": "<YOUR_GENERATED_TEMPLATE_ID>",
                "language": "english",
                "body": "{{body}}",
                "creatorId": "<YOUR_GENERATED_CREATOR_ID>"
            },
            "messageAttempts": [
                {
                    "sentAt": "2024-05-16T16:35:13.118+08:00",
                    "deliveredAt": null,
                    "createdAt": "2024-05-16T16:34:06.604+08:00",
                    "updatedAt": "2024-05-16T16:35:13.118+08:00",
                    "id": "<YOUR_GENERATED_MESSAGE_ATTEMPT_ID>",
                    "messageId": "<YOUR_GENERATED_MESSAGE_ID>",
                    "externalAttemptId": "",
                    "status": "failure",
                    "errorType": "server_error",
                    "errorCode": "server_unknown_error",
                    "metadata": {},
                    "creatorId": "<YOUR_GENERATED_CREATOR_ID>",
                    "creator": {
                        "email": "<YOUR_GENERATED_CAMAPIGN_CREATOR_EMAIL>"
                    }
                }
            ],
            "language": "english",
            "creatorEmail": "<YOUR_GENERATED_CAMPAIGN_CREATOR_EMAIL>",
            "numAttempts": 1
        },
        {
            "createdAt": "2024-05-16T16:34:06.582+08:00",
            "updatedAt": "2024-05-16T16:35:13.093+08:00",
            "id": "<YOUR_GENERATED_MESSAGE_ID>",
            "recipient": "6511119999",
            "values": {
                "body": "test"
            },
            "fullMessage": "This is a test message used for training purposes.\n\nOpen Government Products\n\n---\n\ntest\n\n---\n\nThis is an automated message sent by the Singapore Government.",
            "latestStatus": "failure",
            "templateBodyId": "<YOUR_GENERATED_TEMPLATE_ID>",
            "campaignId": "<YOUR_GENERATED_CAMPAIGN_ID>",
            "templateBody": {
                "createdAt": "2024-05-06T11:00:03.467+08:00",
                "updatedAt": "2024-05-06T11:00:03.467+08:00",
                "id": "<YOUR_GENERATED_TEMPLATE_BODY_ID>",
                "templateId": "<YOUR_GENERATED_TEMPLATE_ID>",
                "language": "english",
                "body": "{{body}}",
                "creatorId": "<YOUR_GENERATED_CREATOR_ID>"
            },
            "messageAttempts": [
                {
                    "sentAt": "2024-05-16T16:35:13.089+08:00",
                    "deliveredAt": null,
                    "createdAt": "2024-05-16T16:34:06.604+08:00",
                    "updatedAt": "2024-05-16T16:35:13.090+08:00",
                    "id": "<YOUR_GENERATED_MESSAGE_ATTEMPT_ID>",
                    "messageId": "<YOUR_GENERATED_MESSAGE_ID>",
                    "externalAttemptId": "",
                    "status": "failure",
                    "errorType": "delivery_error",
                    "errorCode": "delivery_unknown_error",
                    "metadata": {},
                    "creatorId": "<YOUR_GENERATED_CREATOR_ID>",
                    "creator": {
                        "email": "<YOUR_GENERATED_CAMAPIGN_CREATOR_EMAIL>"
                    }
                }
            ],
            "language": "english",
            "creatorEmail": <YOUR_GENERATED_CAMAPIGN_CREATOR_EMAIL>,
            "numAttempts": 1
        },
        {
            "createdAt": "2024-05-16T16:34:06.582+08:00",
            "updatedAt": "2024-05-16T16:36:05.595+08:00",
            "id": <YOUR_GENERATED_MESSAGE_ID>,
            "recipient": "6599999999",
            "values": {
                "body": "test"
            },
            "fullMessage": "This is a test message used for training purposes.\n\nOpen Government Products\n\n---\n\ntest\n\n---\n\nThis is an automated message sent by the Singapore Government.",
            "latestStatus": "success",
            "templateBodyId": "<YOUR_GENERATED_TEMPLATE_ID>",
            "campaignId": "<YOUR_GENERATED_CAMPAIGN_ID>",
            "templateBody": {
                "createdAt": "2024-05-06T11:00:03.467+08:00",
                "updatedAt": "2024-05-06T11:00:03.467+08:00",
                "id": "<YOUR_GENERATED_TEMPLATE_BODY_ID>",
                "templateId": "<YOUR_GENERATED_TEMPLATE_ID>",
                "language": "english",
                "body": "{{body}}",
                "creatorId": "<YOUR_GENERATED_CREATOR_ID>"
            },
            "messageAttempts": [
                {
                    "sentAt": "2024-05-16T16:35:43.009+08:00",
                    "deliveredAt": null,
                    "createdAt": "2024-05-16T16:34:06.604+08:00",
                    "updatedAt": "2024-05-16T16:36:05.593+08:00",
                    "id": "<YOUR_GENERATED_MESSAGE_ATTEMPT_ID>",
                    "messageId": "<YOUR_GENERATED_MESSAGE_ID>",
                    "externalAttemptId": "<YOUR_GENERATED_EXTERNAL_ATTEMPT_ID>",
                    "status": "success",
                    "errorType": null,
                    "errorCode": null,
                    "metadata": {},
                    "creatorId": "<YOUR_GENERATED_CREATOR_ID>",
                    "creator": {
                        "email": "<YOUR_GENERATED_CAMAPIGN_CREATOR_EMAIL>"
                    }
                }
            ],
            "language": "english",
            "creatorEmail": <YOUR_GENERATED_CAMAPIGN_CREATOR_EMAIL>,
            "numAttempts": 1
        }
    ],
    "pageData": {
        "hasNextPage": false,
        "hasPreviousPage": false,
        "startCursor": "WyIyMDI0LTA1LTE2VDE2OjM0OjA2LjU5MCswODowMCIsIjMwMjE5Il0=",
        "endCursor": "WyIyMDI0LTA1LTE2VDE2OjM0OjA2LjU5MCswODowMCIsIjMwMjE3Il0="
    }
}
```

{% endcode %}

**\[From 24 Feb 2025] The `creatorId` field will be inserted in the response payload for each message object from 24 Feb 2025.  In this above example it will be inserted once per message object i.e. total of 3 times. Please amend your own code accordingly for**&#x20;

`"creatorId": "<USER_ID_OF_MESSAGE_CREATOR>"`

<figure><img src="https://862051585-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fl3mC1ibWq8HG4BKl4qlL%2Fuploads%2FjdIUxQtdjLVZPPagTXJP%2FScreenshot%202025-01-16%20at%2011.35.22%E2%80%AFAM.png?alt=media&amp;token=f8a9c2b3-bcca-47b6-9452-3fdb563e27b2" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://postman-v2.guides.gov.sg/endpoints-for-api-users/retrieve-batch.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
