---
title: "Create an SMS campaign using the API"
slug: "api-create-sms"
updated: 2026-05-29T13:38:24Z
published: 2026-06-05T12:54:43Z
canonical: "docs.xtremepush.com/api-create-sms"
stale: true
---

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

# Create an SMS campaign using the API

If you haven't already, first review the general overview of using the [create and send campaign methods](/documentation/docs/api-campaign) to send messages via the API.

To create an SMS you will need to add an SMS message in your POST params when calling the `create` method. Parameters used in SMS message content are listed below:

## Parameters

| Parameter | Description |
| --- | --- |
| messages | Set to number 9 for SMS i.e., ```Code "messages": { "9": { "SMS_CONTENT PARAMS" } } ``` A JSON object containing the SMS params |
| sms | ```Code "sms": { "from": "xtremepush", "text": "Hello" } ``` |
| from | The from header that is used to identify your brand |
| text | The body text of the SMS message |

> [!NOTE]
> SMS from names
> 
> SMS from names replaces the sender number in your SMS message seen by your audience and are captured by the `from` parameter. These need to be pre-configured from the [SMS settings](/documentation/docs/sms-settings) page.

## Example

The SMS channel is turned on with `"sms": 1` and the SMS type 9 is added to the messages object with parameters for the SMS content. In this example `"broadcast": 1` is used to target your entire available user base. Conditions that target a subsection of your audience, and scheduling and other options can be added as described in the [campaign model guide](ref:campaign-model).

In this example a personalisation tag has been added in the SMS text to pull in the users' first names.

```shell
curl --request POST \
  --url https://external-api.xtremepush.com/api/external/create/campaign \
  --header 'content-type: application/json' \
  --data '{
    "apptoken": "YOUR_APPTOKEN",
    "title": "SMS example via API",
    "sms": 1,
    "broadcast": 1,
    "messages": {
      "9": {
        "sms": {
          "from": "xtremepush",
          "text": "{{first_name}}, check out our SMS API test"
        }
      }
    }
  }'
```

Your resulting SMS from above would look something like this one:

![750](https://cdn.document360.io/b056e88b-f6c1-4bd2-b5b8-08e9336a17c9/Images/Documentation/481e12f-sms_example_message(1).png)
