You can use the SMS campaign endpoints to send an SMS campaign, check the cost of sending an SMS campaign, view SMS campaign history, and cancel a scheduled SMS campaign. Add these endpoints as part of your workflow.
Relevant guides: SMS campaign analytics, Can we shorten a URL manually?, and How to send a SMS campaign?.
You can post to a list with up to 20000 recipients
with each API call. You can only send to a single list containing up to 20,000 recipients. The response is far less detailed than the normal Send SMS endpoint. Use the SMS Send endpoint if you would like to send to less than 1000 recipients at once.
You are required to add an opt-out message to the end of your message body if you are sending marketing message. This can be in the form of asking users to reply STOP to opt-out or by including StopMsg.me/xxxxx
which is a placeholder that will add a link that can be clicked to out-out.
Refer to Status Codes for definitions of HTTP status code responses.
list_id required | integer The |
name required | string The SMS campaign name. |
from required | string The sender of the message. This is also referred to as the Sender ID. You can use:
|
body required | string The message to send. The price of sending a message depends on the number of characters and the type of message. There are two types:
|
source | string The source of the request. For example, the name of your application. It's used to identify messages sent from various applications. |
schedule | integer The time you want the message to be sent. It should be in Unix format. |
required | Array of objects (senders) The
The senders parameter is currently in beta and available only to beta testing users.
Join the BETA Program: Early access to Smart Assign is available. Contact the sales team to opt-in and participate in the BETA program. |
url_to_shorten | string The URL you want to shorten. The shortened URL will be appended to the end of the message body. |
Successful response
{- "list_id": "{{listId}}",
- "name": "My Campaign",
- "from": "+6141111111",
- "body": "Hey (First Name), I want to ask if this is your lastname: (Last Name)? Visit http://smsg.io/xxxxx for more details.",
- "subject": "New sms campaign test",
- "senders": [
- {
- "country": "AU",
- "sender_id": "+6141111111",
- "sender_type": "longcode"
}, - {
- "country": "US",
- "sender_type'": "shared_longcode",
- "sender_country_code": "US"
}
]
}
{- "http_code": 200,
- "response_code": "SUCCESS",
- "response_msg": "Your new campaign has been added.",
- "data": {
- "sms_campaign_id": 7,
- "name": "My Campaign 1",
- "user_id": 1,
- "subaccount_id": 1,
- "list_id": 428,
- "from": "+61353787448",
- "body": "This is my new campaign message. StopMsg.me/xxxxx",
- "schedule": "1444821615",
- "status": "Queued",
- "date_added": "1444962630",
- "custom_string": null,
- "url_to_shorten": "string",
- "unsubscribe_link": 0,
- "source": null,
- "senders": [
- {
- "recipient_country_code": "string",
- "sender_id": "string",
- "sender_type": "string",
- "sender_country_code": "string"
}
], - "_total_count": 10,
- "_list_name": "string"
}
}
Calculate price for sms campaign
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
list_id | integer(int32) | true | none | Your list id. |
name | string | true | none | Your campaign name. |
body | string | true | none | Your campaign message. |
from | string | true | yes | Your sender id |
schedule | integer(int32) | false | none | Your schedule timestamp. |
Refer to Status Codes for definitions of HTTP status code responses.
Successful response
{- "list_id": "{{listId}}",
- "name": "My Campaign",
- "from": "+61411111111",
- "body": "Hey (First Name), I want to ask if this is your lastname: (Last Name)?"
}
{- "http_code": 200,
- "response_code": "SUCCESS",
- "response_msg": "Here is your price for your SMS Campaign.",
- "data": {
- "total_count": 1,
- "total_price": "0.035",
- "data": {
- "from": "+61353787448",
- "body": "John, this is your new campaign message.",
- "schedule": "1444381346"
}, - "_currency": {
- "currency_name_short": "AUD",
- "currency_prefix_d": "$",
- "currency_prefix_c": "c",
- "currency_name_long": "Australian Dollars"
}
}
}
Update sms campaign
Parameter | In | Type | Required | Description |
---|---|---|---|---|
sms_campaign_id | path | integer(int32) | true | ID of SMS campaign to update |
Name | Type | Required | Restrictions | Description |
---|---|---|---|---|
list_id | integer(int32) | true | none | Your list id. |
name | string | true | none | Your campaign name. |
body | string | true | none | Your campaign message. |
from | string | true | yes | Your sender id |
schedule | integer(int32) | false | none | Your schedule timestamp. |
Refer to Status Codes for definitions of HTTP status code responses.
Successful response
{- "list_id": "{{listId}}",
- "name": "My Campaign2",
- "from": "+61411111111",
- "body": "Hey (First Name), I want to ask if this is your lastname: (Last Name)?"
}
{- "http_code": 200,
- "response_code": "SUCCESS",
- "response_msg": "Your SMS Campaign has been updated.",
- "data": {
- "sms_campaign_id": 7,
- "name": "My Campaign 1",
- "user_id": 1,
- "subaccount_id": 1,
- "list_id": 428,
- "from": "+61353787448",
- "body": "This is my new campaign message. StopMsg.me/xxxxx",
- "schedule": "1444821615",
- "status": "Queued",
- "date_added": "1444962630",
- "custom_string": null,
- "url_to_shorten": "string",
- "unsubscribe_link": 0,
- "source": null,
- "senders": [
- {
- "recipient_country_code": "string",
- "sender_id": "string",
- "sender_type": "string",
- "sender_country_code": "string"
}
], - "_total_count": 10,
- "_list_name": "string"
}
}
Use this endpoint to view a specific SMS campaign.
Successful response
curl --include \ --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA==" \ 'https://rest.clicksend.com/v3/sms-campaigns/{sms_campaign_id}'
{- "http_code": 200,
- "response_code": "SUCCESS",
- "response_msg": "Your SMS Campaign.",
- "data": {
- "sms_campaign_id": 7,
- "name": "My Campaign 1",
- "user_id": 1,
- "subaccount_id": 1,
- "list_id": 428,
- "from": "+61353787448",
- "body": "This is my new campaign message. StopMsg.me/xxxxx",
- "schedule": "1444821615",
- "status": "Queued",
- "date_added": "1444962630",
- "custom_string": null,
- "url_to_shorten": "string",
- "unsubscribe_link": 0,
- "source": null,
- "senders": [
- {
- "recipient_country_code": "string",
- "sender_id": "string",
- "sender_type": "string",
- "sender_country_code": "string"
}
], - "_total_count": 10,
- "_list_name": "string"
}
}
Use this endpoint to cancel a scheduled SMS campaign.
Successful response
curl --include \ --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA==" \ --request PUT \ 'https://rest.clicksend.com/v3/sms-campaigns/{sms_campaign_id}/cancel'
{- "http_code": 200,
- "response_code": "SUCCESS",
- "response_msg": "Your SMS Campaign.",
- "data": {
- "sms_campaign_id": 2135501,
- "name": "kkde",
- "user_id": 496596,
- "subaccount_id": 563840,
- "list_id": 2484219,
- "from": "edwardo3312",
- "body": "new message2👍👎 smsu.io/xxxxx Reply STOP to opt-out ",
- "schedule": 2147483647,
- "status": "Scheduled",
- "date_added": 1726199079,
- "custom_string": "testz1",
- "unsubscribe_link": 0,
- "source": "new_soruce",
- "senders": [
- {
- "sender_id": "+1234",
- "sender_country_code": "AU"
}, - {
- "sender_type": "shared_longcode",
- "sender_country_code": "FR",
- "recipient_country_code": "BG"
}
], - "_total_count": 5,
- "_list_name": "Opt-Out List"
}
}
Use this endpoint to view SMS campaigns.
page | integer Default: 1 The page number to retrieve. Use this parameter to navigate through the [pagination]/#pagination) results. The default value is 1. Example: page=1 |
limit | integer [ 15 .. 100 ] Default: 15 The number of items to return per page. This parameter controls the size of each page of results. The default value is 15. |
q | string Allows filtering of results based on your search criteria. The query should be in the format
For example, if you are searching for a SMS campaign with the status of Scheduled, the final query would look like this:
Note:
Some characters have to be encoded. For example, if you are searching for SMS sent from the phone number +61437085284, your search query q would be:
You can use the URL encoder to encode the text. If a character is not an alphanumeric character (A-Z, a-z, 0-9), it is typically either reserved or unsafe and should be encoded. |
order_by | string Specifies the field and order to sort the results by. The value is composed of the field name followed by a colon and the sort direction (asc for ascending or desc for descending). The default sort order is by date_added in ascending order. You can use the following fields:
For example, if you want to order by the most recently sent or scheduled SMS, you should sort by date in descending order. The query would look like this:
Note:
You can also sort by these fields:
But this is less common in practice. |
date_from | integer Start date to filter results. It should be in Unix format. |
date_to | integer End date to filter results. It should be in Unix format. |
Successful response
curl --include \ --header "Authorization: Basic YXBpLXVzZXJuYW1lOmFwaS1wYXNzd29yZA==" \ 'https://rest.clicksend.com/v3/sms-campaigns'
{- "http_code": 200,
- "response_code": "SUCCESS",
- "response_msg": "Here are your SMS campaign(s) (shared included).",
- "data": {
- "total": 1,
- "per_page": 15,
- "current_page": 1,
- "last_page": 1,
- "next_page_url": null,
- "prev_page_url": null,
- "from": 1,
- "to": 1,
- "data": [
- {
- "sms_campaign_id": 2145880,
- "name": "taz",
- "user_id": 496596,
- "subaccount_id": 563840,
- "list_id": 2760107,
- "from": "+61428584957",
- "body": "Hey (First Name), I want to ask if this is your lastname: (Last Name)?",
- "schedule": 1925594636,
- "status": "Scheduled",
- "date_added": 1726466470,
- "custom_string": "custom_name",
- "url_to_shorten": "",
- "unsubscribe_link": 0,
- "source": "sample_soruce",
- "senders": [
- {
- "sender_id": "+12124567890",
- "recipient_country_code": "US"
}, - {
- "sender_type": "shared_longcode",
- "sender_country_code": "FR",
- "recipient_country_code": "BG"
}
], - "_total_count": 1,
- "_list_name": "frrfe"
}
]
}
}