Mailrelay API Reference

Send SMS campaign

POST https://{account}/api/v1/sms/campaigns/{id}/send_all

Authentication

Requires an API key sent in the X-AUTH-TOKEN header.

This method is used to send a SMS campaign to groups or a text_list. It will return some attributes, including the ID of the SMS sent campaign which can be used to check the progress and results of the SMS campaign.

If you specify a callback URL, we will send a POST request right after the SMS sent campaign is processed. It will contain a JSON with the type of the callback and the ID of the SMS sent campaign.

You can use the following command to simulate a callback request:

curl --request POST \
  --url https://your-callback-domain.com/callback-url \
  --header 'content-type: application/json' \
  --data '{"type":"sms_sent_campaign_finished","id":1}'

Parameters

NameTypeRequiredDescription
id integer Yes ID of the record
target string Yes Allows you to specify to whom this campaign will be sent
recipients array No Should only be specified when target is set to text_list. Send an array with recipients using E.164 format.
group_ids array No Groups IDs. This is required if target is set to groups. It should be an array of group ids. Example: [1, 4, 5]
scheduled_at string No Allows you to send campaign later. If you want to send it immediately, do not send this parameter. This parameter should be in UTC timezone with the following format: YYYY-MM-DD HH:MM:SS.
callback_url string No A URL that will be called after the campaign is sent. A POST request will be sent to this URL with a JSON payload containing the ID of the sent campaign.

Responses

StatusDescription
200 Success
400 The request is invalid. Check if the field names in the request and the request data is valid.
422 A validation error occurred. Check the response body for more information.
401 The API key wasn't sent or is invalid
429 Too many requests. You have exceeded the rate limit, wait and try again later.
500 An internal error happened. Try again later.

Response fields

NameTypeDescription
id integer Id
name string Name
sender_name string Sender name
message string Message
status string Status
target string Target
callback_url string Callback url
scheduled_at string Scheduled at
created_at string Created at
updated_at string Updated at