> ## Documentation Index
> Fetch the complete documentation index at: /docs/llms.txt
> Use this file to discover all available pages before exploring further.

# SMS

> Send SMS by campaign, template, open text or bulk, and track delivery.

Send a single message, a templated message, free text, or thousands of personalised messages in one call.

| API | Endpoint | Best for |
| - | - | - |
| Campaign | `POST /api/sms/send-msg` | Sending a pre-built portal campaign to a mobile number. |
| Template send | `POST /api/sms/template/send` | DLT-registered templates with dynamic variables. |
| Open text | `POST /api/sms/send` | Free-form text sent programmatically. |
| Bulk send | `POST /api/sms/json` | Different messages to different numbers in one call. |
| Status | `GET /api/sms/status` | Checking delivery status. |

> [!NOTE]
>
> A `success` response means the message was submitted, not delivered. Use the status API for delivery results.

## Campaign API

Run a campaign in the portal, then copy its Campaign ID from the **Campaigns** section. Send `Content-Type: text/plain`.

| Parameter | Required | Description |
| - | - | - |
| `campaign_id` | Yes | Campaign ID from the portal. |
| `phone` | Yes | Destination mobile number. |
| `params` | Yes | JSON array of the dynamic values defined in the template. |

```bash theme={null}
curl -X POST 'https://api.yourcpaas.com/api/sms/send-msg?campaign_id=XXXXX&phone=XXXXX&params=["XXX","XXX"]' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

```json Success theme={null}
{ "status": "success", "ref_id": "26f5b436-7377-4574-9173-c07e81b164d5" }
```

`ref_id` is the unique message ID of the request.

| Field | Error | Resolution |
| - | - | - |
| `campaign_id` | The campaign id field is required. | Add the field to your request. |
| `campaign_id` | Invalid Campaign Id | Verify the ID under SMS Campaigns in the portal. |
| `phone` | The phone field is required. | Add the field to your request. |
| `phone` | The phone number must be between 6 and 15 digits | Correct the mobile number. |
| `params` | The params field is required. | Add the field to your request. |
| `params` | Params count not matching, expecting X param | Pass the same number of values as defined in the template. |

## Template send API

Get the Template ID (`alias`) from the portal under **SMS Channel, then Template tab**. Pass variables in the order the template defines them.

```bash theme={null}
curl --location 'https://api.yourcpaas.com/api/sms/template/send' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --data '{
    "alias": "TEMPLATE_ID",
    "to": ["91XXXXXXXXXX"],
    "params": { "1": "Var1" },
    "correlation_id": ""
  }'
```

```json Success theme={null}
{
  "status": "success",
  "message": "Messages are sent successfully.",
  "data": [
    { "status": "submitted", "message_id": "d0056007-2e32-44fa-beb7-1dbdfb0d8bc2", "number": "91XXXXXXXXXX", "units": 1, "received_at": "2026-03-25 20:13:54" }
  ]
}
```

| Field | Description |
| - | - |
| `status` | `submitted` once passed to the provider for delivery. |
| `message_id` | Unique message ID. Use it for the status API. |
| `number` | The mobile number from the request. |
| `units` | SMS units used: 160 characters for plain text, 70 for Unicode. Longer messages use more units. |
| `received_at` | Time the request was received (`YYYY-MM-DD HH:MM:SS`). |

An invalid number returns `200` with that entry marked `failed` and an `error` such as `Invalid phone number`. A missing or inactive template returns:

```json Template error theme={null}
{ "status": "error", "error_code": 422, "error_message": "Template not found or inactive" }
```

## Open text API

Send free text to up to 100 numbers.

| Parameter | Required | Description |
| - | - | - |
| `from` | Yes | Sender ID, source address or header configured on the platform. |
| `to` | Yes | Destination numbers (up to 100). |
| `text` | Yes | Message content. |
| `type` | No | `N` plain text (default), `U` Unicode, `A` auto-detect. |
| `product` | No | `Transactional`, `Promotional`, `OTP` or `Other`. |
| `template_id` | India | DLT-registered Template ID. Mandatory in India. |
| `entity_id` | India | DLT-registered Entity ID. Mandatory in India. |

```bash theme={null}
curl --location 'https://api.yourcpaas.com/api/sms/send' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --data '{
    "from": "SENDER",
    "to": ["91XXXXXXXXXX"],
    "text": "Message Text",
    "type": "A",
    "product": "Transactional",
    "template_id": "TEMPLATE_ID",
    "entity_id": "ENTITY_ID",
    "correlation_id": ""
  }'
```

The success response has the same format as the template send API. A missing field returns a validation error:

```json Validation error theme={null}
{
  "message": "The text field is required.",
  "errors": { "text": ["The text field is required."] }
}
```

## Bulk send API

Send the same message to many numbers, or personalised messages to different numbers, in one call with the `data` array (maximum 500 entries). An entry that omits `from`, `text` or `to` uses the `root` values.

| Parameter | Required | Description |
| - | - | - |
| `root` | Yes | Fallback object. Must include `from`, `text` and `to`. |
| `data` | Yes | Array of message objects. Maximum 500 per request. |
| `data[].from` | No | Sender for this message. Overrides `root.from`. |
| `data[].text` | No | Text for this message. Overrides `root.text`. |
| `data[].to` | No | Number(s) for this entry. Overrides `root.to`. |

```bash theme={null}
curl --location 'https://api.yourcpaas.com/api/sms/json' \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_TOKEN' \
  --data '{
    "root": { "from": "CPAAS", "text": "Hello, your order is confirmed.", "to": ["91XXXXXXXXXX"] },
    "data": [
      { "from": "PROMO", "text": "Hi John, your OTP is 485923", "to": ["91XXXXXXXXXX"] },
      { "from": "PROMO", "text": "Hi Priya, your OTP is 736104", "to": ["91XXXXXXXXXX"] }
    ]
  }'
```

The response lists one result per entry, in the same format as the template send API.

> [!WARNING]
>
> Bulk send supports partial success. Some entries can succeed while others fail in the same call, so check every entry in `data`.

| Field | Error | Resolution |
| - | - | - |
| `root` | The root field is required. | Add the root object with `from`, `text` and `to`. |
| `data` | The data field is required. | Add the data array with at least one message object. |
| `data[].to` | Invalid phone number | Ensure the mobile number is correct. |
| `data` | Exceeds maximum of 500 objects | Split your request into batches of 500 or fewer. |

## Status API

Fetch delivery reports (DLR). All filters are optional and can be combined.

| Parameter | Description |
| - | - |
| `number` | Destination mobile number. |
| `id` | Message ID. |
| `from` | Sender or header. |
| `code` | Delivery code captured from the operator. |
| `status` | `DELIVRD` or `FAILED`. |
| `page` | Page number. Default 100 records per page. |
| `per_page` | Records per page. Maximum 100, or limit to 50, 25 or 10. |

```bash theme={null}
curl --location --globoff 'https://api.yourcpaas.com/api/sms/status?number=91XXXXXXXXXX&id=MESSAGE_ID&status=FAILED' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer YOUR_TOKEN'
```

```json Response theme={null}
{
  "status": "success",
  "data": [
    {
      "message_id": "5f3747eb-f92e-4b1a-97bf-72b8e00b75e9",
      "from": "SENDER",
      "number": "91XXXXXXXXXX",
      "status": "FAILED",
      "code": "105",
      "units": 1,
      "received_at": "2025-09-30 04:34:14",
      "submitted_at": "2025-09-30 04:34:14",
      "dlr_received_at": null
    }
  ],
  "pagination": { "total": 1, "count": 1, "per_page": 100, "current_page": 1, "total_pages": 1 }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.