The MailUp transactional API for SMS does not use OAuth 2.0. Please refer to the "Getting started" section below for details.
The MailUp transactional API for text messages (SMS) is the best choice when sending individual text messages, regardless of the number of messages you need to send.
The main features of this API are the following:
- sending is immediate
- authentication is very simple
- it works with HTTP post, which means that you can use the "send" command as a callback function in any system that supports webhooks
Using the ListSecret parameter
In order to send an SMS you need to know the "ListSecret" value of the MailUp list you are using. "ListSecret" is an additional field that has been added to introduce a level of security to these API methods, it is list specific and it can be enabled/disabled using APIs.
- You can use the GET method to check if a ListSecret already exists.
- If it does not, you can use the POST method to create it.
- As soon as you get the value of ListSecret you can start sending text messages (refer to next paragraph) with no restrictions.
If you want to disable the ability to send transactional SMS on that list, you can use DELETE method. This method can also be used - followed by a POST method - to change an existing ListSecret value.
All these methods require Basic Authentication, hence an encoded value must be specified as header
Once you have obtained the value of the ListSecret parameter:
- you can start sending transactional text messages (see example below)
- basic authentication is no longer required in those API calls
Retrieving, creating, and deleting the ListSecret parameter
Sending a transactional SMS
The example below sends an SMS to the number +393350000001
MailUp account ID (e.g. if the main user is "m59484", then the account ID is 59848).
List identifier for the selected list within that account.
Hash code that identifies the same list. This parameter is unique to a list within the entire MailUp system, unlike the List ID, which is unique only within a given MailUp account.
The parameter described above and used to enable or disable the use of this API (it’s an auto-generated GUID).
Used to aggregate statistics. If the value specified does not exist, a new record is created in the “SMS” table, otherwise the existing one is reused.
The text of the message. No parsing nor length check is required.
SIZE LIMIT: messages longer than 459 characters are truncated by sending engine.
The recipient’s number. Include the international prefix (either with 00 or +), or the default list prefix will be applied.
(Ask for MailUp standard regex for phone numbers).
Only a single phone number is allowed
|An array of value pairs that allows you to use merge tags in your transactional text messages.||String|
(optional) Boolean value indicating whether to use Western alphabets only (0 means "false"), or Eastern alphabets as well, such as Arabic, Russian, Chinese, and so on (1 means "true").
It is up to you to decide if the message contains Unicode characters.
|Sender||(optional) Message sender. It can be numeric or alphanumeric but some restrictions may apply. As a consequence, when the sender value is not allowed, message may be blocked or sender may be replaced. We recommend you to specify this value only when you are confident about the delivery result (e.g. you've already tested it using the MailUp web platform), otherwise it is better to not specify this parameter in the request|
|TemplateId||(optional) reference to a MailUp message ID that has already been defined on MailUp. Do not add the "Content" parameter if you want to use TemplateId|
HTTP response statuses that can be returned by this API, and the corresponding error code provided by the application (inside the response).
HTTP response code
No request found
Missing or empty parameters
ListGUID is not valid for the current account or list
ListSecret is not valid for the current account or list
SMS sender name is empty for list nr. N
Number or Prefix missing in the recipient
Recipient is invalid
Content too long
listID is not valid for the current account or list
ListGUID is not in a correct format
ListSecret is not in a correct format
Cannot send SMS to USA recipient
Sending denied: NO CREDITS
SMS number [recipient] is in optout state for list nr.[idList].
Provided SMS sender is not certified and cannot be used to send messages
Operation failed: a generic error occur
The message was sent but the statistics are incorrect due to an error
Error delivering message to [recipient]
In addition to HTTP and Application codes, a successful response has the following format:
where DeliveryId is a unique identifier that can be used to retrieve the result of a specific sending (link), while Cost is the cost in credits of the sending operation