API Reference

OverviewSMSSMS batch APIVoice CallingVoice MessagingConversations APIContacts API (v2)Integrations APIFile Storage APIOmnichannel WidgetNumbersPartner AccountsVerifyMMSHLRBalanceLookupContactsGroupsIntentFAQNamed Entity RecognitionLanguage Detection

SMS API

MessageBird’s SMS API allows you to send and receive SMS messages to and from any country in the world through a REST API. Each message is identified by a unique random ID so that users can always check the status of a message using the given endpoint.

The SMS API uses HTTP verbs and a RESTful endpoint structure with an access key that is used as the API Authorization. Request and response payloads are formatted as JSON using UTF-8 encoding and URL encoded values.


API Endpoint

All URLs referenced in MessageBird's SMS API documentation have the base URL in the code snippet on the right side:

API Endpoint

https://rest.messagebird.com/messages

Available HTTP methods

The MessageBird API uses HTTP verbs to understand if you want to read (GET), delete (DELETE) or create (POST) an object. When your web application cannot do a POST or DELETE, we provide the ability to set the method through the query parameter _method.

Available HTTP methods

POST /messages
GET /messages
GET /messages/{messageId}
DELETE /messages/{messageId}

Rate Limiting

Excessive HTTP requests will be rejected with status code 429 Too Many Requests. When you receive a 429 response, you can safely assume that the request has not been processed, and can be retried at a later time. Please reduce the rate of your requests and try the request again later.

Notification icon

Please contact support in case you need higher limits.

HTTP MethodLimit
GET50 req/s
POST500 req/s
PATCH50 req/s
DELETE50 req/s

Parameters

ParameterDescription
AuthorizationWhen calling our API, send your access key with the authentication type set as AccessKey (Example: Authorization: AccessKey {accessKey}). Required.
AcceptSet to application/json. Required.

Authentication Example

curl -X GET https://rest.messagebird.com/balance \
-H 'Authorization: AccessKey test_gshuPaZoeEG6ovbc8M79w0QyM'

The message object

This is an object representing an SMS message at MessageBird.com.

Attributes

AttributeTypeDescription
idstringA unique random ID which is created on the MessageBird platform and is returned upon creation of the object.
hrefstringThe URL of the created object.
directionstringTells you if the message is sent or received.
mt: mobile terminated (sent to mobile)
mo: mobile originated (received from mobile)
typestringThe type of message. Values can be: sms, binary, or flash
originatorstringThe sender of the message. This can be a telephone number (including country code) or an alphanumeric string. In case of an alphanumeric string, the maximum length is 11 characters. You can set a default originator in your account or use inbox to use the Sticky VMN feature.
bodystringThe body of the SMS message.
referencestringA client reference.
reportUrlstringThe status report URL to be used on a per-message basis. reference is required for a status report webhook to be sent.
validityintegerThe amount of seconds that the message is valid. If a message is not delivered within this time, the message will be discarded.
gatewayintegerThe SMS route that is used to send the message.
typeDetailshashmapA hashmap with extra information. Further explanation in the table below.
datacodingstringThe datacoding used, defaults to plain (GSM 03.38 characters only), or it can be set to unicode (contains non-GSM 03.38 characters) or set to auto and we will set unicode or plain depending on the body content.
Notification icon

Note: Using unicode will limit the maximum number of characters to 70 instead of 160. If message character size exceeds the limit, messages will be concatenated, resulting in separately billed messages. See this article for more information.

mclassintegerIndicated the message type. 1 is a normal message, 0 is a flash message. (0-3 are valid values)
scheduledDatetimedatetimeThe scheduled date and time of the message in RFC3339 format (Y-m-d\TH:i:sP)
createdDatetimedatetimeThe date and time of the creation of the message in RFC3339 format (Y-m-d\TH:i:sP)
recipientshashmapThe hashmap with recipient information. Further explanation in the table below.

Message Object Example (SMS)

{
"id":"e8077d803532c0b5937c639b60216938",
"href":"https://rest.messagebird.com/messages/e8077d803532c0b5937c639b60216938",
"direction":"mt",
"type":"sms",
"originator":"MessageBird",
"body":"The message to be sent",
"reference":"the-client-reference",
"validity":null,
"gateway":240,
"typeDetails":{
},
"datacoding":"plain",
"mclass":1,
"scheduledDatetime":null,
"createdDatetime":"2016-04-29T09:42:26+00:00",
"recipients":{
"totalCount":1,
"totalSentCount":1,
"totalDeliveredCount":1,
"totalDeliveryFailedCount":0,
"items":[
{
"recipient":31612345678,
"status":"sent",
"statusReason":"successfully delivered",
"statusErrorCode":null,
"statusDatetime":"2016-04-29T09:42:26+00:00",
"recipientCountry":"Netherlands",
"recipientCountryPrefix":31,
"recipientOperator":"KPN",
"mccmnc":"20408",
"mcc":"204",
"mnc":"08",
"messageLength":22,
"messagePartCount":1,
"price":{
"amount":0.075,
"currency":"EUR"
}
}
]
}
}

The recipients array

AttributeTypeDescription
totalCountintegerThe total count of recipients.
totalSentCountintegerThe count of recipients that have the message pending (status sent, and buffered).
totalDeliveredCountintegerThe count of recipients where the message is delivered (status delivered).
totalDeliveryFailedCountintegerThe count of recipients where the delivery has failed (status delivery_failed).
itemsarrayAn array of recipient hashmaps. Further explanation in the table below.

The items array

AttributeTypeDescription
recipientintegerThe msisdn of the recipient
statusstringThe status of the message sent to the recipient. Possible values: scheduled, sent, buffered, delivered, expired, and delivery_failed
statusReasonstringThe details about the message status. Possible values: successfully delivered, pending DLR, DLR not received, unknown subscriber, unavailable subscriber, expired, opted out, received network error, insufficient balance, carrier rejected, capacity limit reached and generic delivery failure. Read more about status reasons.
statusErrorCodeinteger | nullExtra error code that describes the failure in more detail (optional, null if not available)
statusDatetimedatetimeThe date and time of the last status in RFC3339 format (Y-m-d\TH:i:sP)
recipientCountrystringThe name of the recipient’s original country, based on MSISDN.
recipientCountryPrefixintegerThe prefix code for the recipient’s original country, based on MSISDN.
recipientOperatorstringThe name of the operator of the recipient. Identified by MCCMNC of the message.
mccmncstring | nullThe code of the operator of the message sender. It could have null value if the message isn’t delivered yet.
mccstring | nullThe MCC (Mobile Country Code) part of MCCMNC.
mncstring | nullThe MNC (Mobile Network Code) part of MCCMNC.
messageLengthintegerThe length of the message in characters. Depends on the message datacoding.
messagePartCountintegerThe count of total messages send. Personalisation not taken in account.
pricehashmapA hashmap with extra information about how much the message costs.
Note: see this article for more details about our pricing policy.
price.amountfloat | nullThe price the message was billed with. It could have a null value if the message isn’t billed yet.
price.currencystring | nullThe alphabetic code of the price currency, in ISO 4217 format. It could have null value if the message isn’t billed yet.

The typeDetails array

AttributeTypeDescription
udhstringThe UDH to prepend to the message payload. This can be used for sending concatenated SMS. Often required to send binary messages.

Message Object Example (Binary)

{
"id":"98154fa03532c2c3fc7b341b46487018",
"href":"https://rest.messagebird.com/messages/98154fa03532c2c3fc7b341b46487018",
"direction":"mt",
"type":"binary",
"originator":"MessageBird",
"body":"546865206d65737361676520746f2062652073656e74",
"reference":null,
"validity":null,
"gateway":240,
"typeDetails":{
"udh":"050003340201"
},
"datacoding":"plain",
"mclass":1,
"scheduledDatetime":null,
"createdDatetime":"2016-04-29T09:42:26+00:00",
"recipients":{
"totalCount":2,
"totalSentCount":1,
"totalDeliveredCount":1,
"totalDeliveryFailedCount":0,
"items":[
{
"recipient":31612345678,
"status":"sent",
"statusReason":"successfully delivered",
"statusErrorCode":null,
"statusDatetime":"2016-04-29T09:42:26+00:00",
"recipientCountry":"Netherlands",
"recipientCountryPrefix":31,
"recipientOperator":"KPN",
"mccmnc":"20408",
"mcc":"204",
"mnc":"08",
"messageLength":44,
"messagePartCount":1,
"price":{
"amount":0.075,
"currency":"EUR"
}
},
{
"recipient":31612345679,
"status":"delivery_failed",
"statusReason":"unknown subscriber",
"statusErrorCode":1,
"statusDatetime":"2016-04-29T09:42:26+00:00",
"recipientCountry":"Netherlands",
"recipientCountryPrefix":31,
"recipientOperator":"",
"mccmnc":null,
"mcc":null,
"mnc":null,
"messageLength":44,
"messagePartCount":1,
"price":{
"amount":null,
"currency":null
}
}
]
}
}

Send outbound SMS

MessageBird's Programmable SMS API enables you to programmatically send SMS messages from your web application.

First, you need to create a new message object. MessageBird returns the created message object with each request. A maximum of 50 recipients can be entered per request.

Send your first SMS message with this example request.

Sticky VMN

Sticky VMN's ensure that the same Sender phone number is selected each time a specific recipient receives an SMS from your web application.

Notification icon

Sticky VMN's are only available in Canada, Netherlands and United Kingdom. As there are no capacity limits in other countries, you won't need multiple VMNs. Learn more about specific country restrictions. Starting 1st March 2022 the services has been discontinued in the USA following a change in regulation.

Whether you are using a pool of dedicated VMNs or MessageBird's shared VMN pool, it is best practice to ensure that your recipients always receive your SMS messages from the same VMN as a sender.

MessageBird's Sticky-VMN-as-a-Sender service makes this configuration possible. Simply use inbox as the originator when sending SMS messages to the MessageBird SMS API.

This will trigger our system to select a random VMN (dedicated or shared - depending on what’s available) for the first SMS message and ensure that the selected VMN be reused for all following SMS messages.

Required parameters
attributetypedescription
originatorstringThe sender of the message. This can be a telephone number (including country code) or an alphanumeric string. In case of an alphanumeric string, the maximum length is 11 characters.
bodystringThe body of the SMS message.
recipientsarrayAn array of recipients msisdns.
Optional parameters
attributetypedescription
groupIdsarrayAn array of group id's. If provided recipients can be omitted.
typestringThe type of message. Values can be: sms, binary, or flash.
referencestringA client reference. Is required for a status report callback to be sent
reportUrlstringThe status report URL to be used on a per-message basis. This value overrides the standard status report url configured on the customer account.
validityintegerThe amount of seconds that the message is valid. If a message is not delivered within this time, the message will be discarded.
gatewayintegerThe SMS route that is used to send the message.
typeDetailshashmapA hashmap with extra information. Is only used when a binary message is sent.
datacodingstringThe datacoding used can be plain (GSM 03.38 characters only), unicode (contains non-GSM 03.38 characters) or auto: we will then set unicode or plain depending on the body content.
Notification icon

Note: Using unicode will limit the maximum number of characters to 70 instead of 160. If message character size exceeds the limit, messages will be concatenated, resulting in separately billed messages. See this article for more information.

mclassintegerIndicated the message type. 1 is a normal message, 0 is a flash message. (0-3 are valid values)
shortenUrlsbooleanbeta Shorten all the URLs present in the message body.
scheduledDatetimedatetimeThe scheduled date and time of the message in RFC3339 format (Y-m-d\TH:i:sP), when you want to schedule a message in the future. Don't set this value when message needs to be send directly.
createdDatetimedatetimeThe date and time of the creation of the message in RFC3339 format (Y-m-d\TH:i:sP)

Definition

POST https://rest.messagebird.com/messages

Example Request

curl -X POST https://rest.messagebird.com/messages \
-H 'Authorization: AccessKey test_gshuPaZoeEG6ovbc8M79w0QyM' \
-d "recipients=31612345678" \
-d "originator=YourName" \
-d "shortcode=1008" \
-d "body=This is a test message"
Notification icon

Do note that values are not automatically urlencoded with the above example. Use --data-urlencode if you want to urlencode the values.

Example Response

{
"id":"e8077d803532c0b5937c639b60216938",
"href":"https://rest.messagebird.com/messages/e8077d803532c0b5937c639b60216938",
"direction":"mt",
"type":"sms",
"originator":"YourName",
"body":"This is a test message",
"reference":null,
"validity":null,
"gateway":null,
"typeDetails":{},
"datacoding":"plain",
"mclass":1,
"scheduledDatetime":null,
"createdDatetime":"2016-05-03T14:26:57+00:00",
"recipients":{
"totalCount":1,
"totalSentCount":1,
"totalDeliveredCount":0,
"totalDeliveryFailedCount":0,
"items":[
{
"recipient":31612345678,
"status":"sent",
"statusDatetime":"2016-05-03T14:26:57+00:00"
}
]
}
}

Handle a status report

Status reports are HTTP GET requests that are sent to your platform. The requests hold information about the status of a message that you have sent through our API. Status reports are only provided for SMS messages that have a reference defined when sending the message, and a status report URL is set: as reportUrl when sending the message, or configured in their account as status report url.

Attributes

Notification icon

Note: New attributes can be added to the status report HTTP callbacks. Consider this for the validation of received from MessageBird status reports. We will never remove attributes.

AttributeTypeDescription
idstringA unique random ID which is created on the MessageBird platform and is returned upon creation of the object.
referencestringA reference, given by customer when sending the message to the MessageBird platform.
recipientstringThe recipient where this status report applies to.
statusstringThe status of the message sent to the recipient. Possible values: scheduled, sent, buffered, delivered, expired, and delivery_failed.
statusReasonstringThe details about the message status. Possible values: successfully delivered, pending DLR, DLR not received, unknown subscriber, unavailable subscriber, expired, opted out, received network error, insufficient balance, carrier rejected, capacity limit reached and generic delivery failure. Read more about status reasons.
statusErrorCodeintegerExtra error code that describes the failure in more detail (optional, only given if available).
statusDatetimedatetimeThe date and time of this status in RFC3339 format (Y-m-d\TH:i:sP).
mccmncintegerThe code of the operator of the message recipient number.
portedbooleanIndicates if the recipient number was ported from another operator.
messageLengthintegerThe length of the message in characters. Depends on the message datacoding.
messagePartCountintegerThe count of total messages sent.
datacodingstringThe encoding of the message. Possible values: plain, unicode.
price.amountfloat | nullThe price the message was billed with. It could have a null value if the message isn’t billed yet.
price.currencystring | nullThe alphabetic code of the price currency, in ISO 4217 format. Possible values are also CRE, TRC for internal (free) credits currency. It could have a null value if the message isn’t billed yet.

Response

Your platform should respond with a 200 OK HTTP header. When our platform doesn't receive a 200 OK header, we will try to deliver the receipt again (up to 10 times).

Example request

GET http://your-own.url/script?id=efa6405d518d4c0c88cce11f7db775fb&reference=the-customers-reference&recipient=31612345678&status=delivered&statusReason=successfully%20delivered&statusDatetime=2017-09-01T10:00:05+00:00&datacoding=plain&mccmnc=20409&messageLength=44&messagePartCount=1&ported=0&price[amount]=0.75&price[currency]=EUR

Example response

200 OK

Receive and handle inbound SMS

On a virtual mobile number (VMN)

Inbound SMS messages from a Virtual Mobile Number are received through a callback URL that can be configured manually by using the Forward to URL step in Flow Builder, or by contacting our support team. The message attributes are sent through a POST request by default but the method can be configured per VMN.

Attributes

AttributeTypeDescription
idstringA unique random ID which is created on the MessageBird platform.
recipientstringThe recipient of the message (the VMN).
originatorstringThe sender of the message.
bodystringThe body of the SMS message.
createdDatetimedatetimeThe date and time of the creation of the message in RFC3339 format (Y-m-d\TH:i:sP)

Response

Your platform should respond with a 200 OK HTTP header. When our platform doesn't receive a 200 OK header, we will try to deliver the message again (up to 10 times).

Example Request

GET http://your-own.url/script?id=e8077d803532c0b5937c639b60216938&recipient=31642500190&originator=31612345678&body=This+is+an+incoming+message&createdDatetime=2016-05-03T14%3A26%3A57%2B00%3A00

Example Response

200 OK

On a shortcode

Inbound SMS messages from an end user to - a (sub)keyword at - a shortcode are received through a configured callback URL (configurable per keyword/shortcode). The message attributes are sent through a GET request by default but the method can be configured per keyword. Please contact our support team to set this up for you.

Attributes

AttributeTypeDescription
midintegerA unique random ID which is created on the MessageBird platform.
shortcodestringThe shortcode that received the message.
keywordstringThe keyword that matched the message.
originatorstringThe sender of the message (end user).
operatorintegerThe operator of the sender of the message (MCCMNC)
messagestringThe body of the SMS message, including the (sub)keyword.
receive_datetimestringThe date and time when the message was received at shortcode in format: YmdHis

Response

Your platform should respond with a 200 OK HTTP header and a plain text OK as body. When our platform doesn't receive a OK response body, we will try to deliver the message again (up to 10 times).

Example Request

GET http://your-own.url/script?mid=123456789&shortcode=1008&keyword=MESSAGEBIRD&originator=31612345678&operator=20401&message=This+is+an+incoming+message&receive_datetime=20160503142657

Example Response

200 OK

View an SMS

You can use MessageBird's SMS API to retrieve information of an existing inbound or outbound SMS message.

You only need to supply the unique message id that was returned upon creation or receiving.

Required parameters

ParameterTypeDescription
idstringA unique random ID which is created on the MessageBird platform and is returned upon creation of the object. Required

Definition

GET https://rest.messagebird.com/messages/{messageId}

Example Request

curl -X GET https://rest.messagebird.com/messages/211e6280453ba746e8eeff7b12582146 \
-H 'Authorization: AccessKey test_gshuPaZoeEG6ovbc8M79w0QyM'

Response

This will return a message object if the request was successful.

If the request failed, an error object will be returned.

Example Response

{
"id":"e8077d803532c0b5937c639b60216938",
"href":"https://rest.messagebird.com/messages/e8077d803532c0b5937c639b60216938",
"direction":"mt",
"type":"sms",
"originator":"YourName",
"body":"This is a test message",
"reference":null,
"validity":null,
"gateway":null,
"typeDetails":{},
"datacoding":"plain",
"mclass":1,
"scheduledDatetime":null,
"createdDatetime":"2016-05-03T14:26:57+00:00",
"recipients":{
"totalCount":1,
"totalSentCount":1,
"totalDeliveredCount":0,
"totalDeliveryFailedCount":0,
"items":[
{
"recipient":31612345678,
"status":"sent",
"statusReason":"successfully delivered",
"statusErrorCode":null,
"statusDatetime":"2016-05-03T14:26:57+00:00",
"recipientCountry":"Netherlands",
"recipientCountryPrefix":31,
"recipientOperator":"KPN",
"mccmnc":"20408",
"mcc":"204",
"mnc":"08",
"messageLength":22,
"messagePartCount":1,
"price":{
"amount":0.75,
"currency":"EUR"
}
}
]
}
}

List messages

To list all inbound and outbound SMS messages, you can do a GET request on the /messages endpoint.

Messages are identified by a unique random ID. You can use this ID to check the status of the SMS message through the provided endpoint.

API Endpoint

https://rest.messagebird.com/messages?status=scheduled

Example Request

curl -X GET https://rest.messagebird.com/messages \
-H 'Authorization: AccessKey test_gshuPaZoeEG6ovbc8M79w0QyM'

Example Response

{
"offset": 0,
"limit": 20,
"count": 4,
"totalCount": 4,
"links": {
"first": "https://rest.messagebird.com/messages/?offset=0",
"previous": null,
"next": null,
"last": "https://rest.messagebird.com/messages/?offset=0"
},
"items": [
{
"id": "436d780b854749b4beca51623d9e2674",
"href": "https://rest.messagebird.com/messages/436d780b854749b4beca51623d9e2674",
"direction": "mt",
"type": "sms",
"originator": "YourName",
"body": "This is a test message",
"reference": null,
"validity": null,
"gateway": 10,
"typeDetails": {},
"datacoding": "plain",
"mclass": 1,
"scheduledDatetime": null,
"createdDatetime": "2020-02-04T19:01:12+00:00",
"recipients": {
"totalCount": 1,
"totalSentCount": 1,
"totalDeliveredCount": 1,
"totalDeliveryFailedCount": 0,
"items": [
{
"recipient": 31612345678,
"originator": null,
"status": "delivered",
"statusReason": "successfully delivered",
"statusErrorCode": null,
"statusDatetime": "2020-02-04T19:01:12+00:00",
"recipientCountry": "Netherlands",
"recipientCountryPrefix": 31,
"recipientOperator": "KPN",
"mccmnc": "20408",
"mcc": "204",
"mnc": "08",
"messageLength": 22,
"messagePartCount": 1,
"price": {
"amount": 0.075,
"currency": "EUR"
}
}
]
}
}
]
}

Filters

Besides listing all SMS messages, the MessageBird SMS API also provides some filters that can be used as query parameters:

FilterTypeDescription
originatorstringDisplay messages by the specified originator.
recipientstringDisplay messages for the specified recipient.
directionstringDisplay either mt (sent) or mo (received) messages.
limitintLimit the amount of messages listed.
offsetintSkip first n results.
searchtermstringDisplay messages including the specified searchterm in recipient and originator
typestringDisplay messages of type sms, binary, or flash
contact_idintDisplay messages by contact_id. See Contacts API for more info.
statusstringDisplay messages with status scheduled, sent, buffered, delivered, expired, or delivery_failed.
fromdatetimeDisplay messages starting from the specified date in RFC3339 format (Y-m-d\TH:i:sP).
untildatetimeDisplay messages until the specified date in RFC3339 format (Y-m-d\TH:i:sP).

List scheduled messages

You can also list all scheduled SMS messages using the endpoint on the right.

API Endpoint

https://rest.messagebird.com/messages?status=scheduled

Example request

curl -X GET https://rest.messagebird.com/messages?status=scheduled \
-H 'Authorization: AccessKey test_gshuPaZoeEG6ovbc8M79w0QyM'

Example Response

{
"offset":0,
"limit":20,
"count":1,
"totalCount":1,
"links":{
"first":"https://rest.messagebird.com/messages/?offset=0&status=scheduled",
"previous":null,
"next":null,
"last":"https://rest.messagebird.com/messages/?offset=0&status=scheduled"
},
"items":[
{
"id":"",
"href":"https://rest.messagebird.com/messages/",
"direction":"mt",
"type":"sms",
"originator":"Test",
"body":"test mesage",
"reference":null,
"validity":null,
"gateway":10,
"typeDetails":{},
"datacoding":"plain",
"mclass":1,
"scheduledDatetime":"2020-04-04T13:14:00+00:00",
"createdDatetime":"2020-03-04T13:06:20+00:00",
"recipients":{
"totalCount":0,
"totalSentCount":0,
"totalDeliveredCount":0,
"totalDeliveryFailedCount":0,
"items":[]
}
}
]
}

SMS Statuses

MessageBird provides three levels of information describing the status of an SMS: Status, Status Reason, and Error Code. These levels are complementary and should be analyzed together to get the full picture of an SMS delivery.

Via HTTP

The Status, Status Reason and Error Code are reported back as respectively status, statusReason and statusErrorCode variables in the HTTP status report callback. The Error Code is only given when the data is available.

Via SMPP

When connected via SMPP, the Error Code is given back as value of the network_error_code TLV and in the err parameter in a DLR’s short_message value. It contains the code that references a specific error.

SMS Status Information Hierarchy

SMS Error Codes are grouped in Status Reasons, that in turn provide additional details to an SMS Status. To read more about the relationship between Statuses, Status Reasons, and Error Codes you can check our support article. The error codes descriptions can be found in the table below.

  • sent: The message has been sent, and it has left the MessageBird platform (this is a temporary status).
    • pending DLR: The message has been sent to a downstream mobile operator and provider and we are waiting for Delivery Report to be returned.
  • delivered: The message has been delivered to the intended receiver.
    • successfully delivered
  • buffered: The message has been queued pending to be delivered. This could be as part of a retry scheme for temporary unavailable (i.e. Unreachable) receiver.
    • pending DLR: The message has been sent to a downstream mobile operator and provider and we are waiting for Delivery Report to be returned.
  • expired: The message couldn't be delivered before the expiration of its validity period. MessageBird has a retry policy designed to maximize the chance of successfully delivery, but retries will stop once the validity period you've set expires.
    • unavailable subscriber: The receiver wasn't available due a temporary issue (example it is out of coverage),the retry pattern couldn't complete a successfully delivered it before the expiration of the validity period.
    • DLR not received: The SMS was sent to a mobile operator or downstream provider however no DLR has been returned before the end of the message validity period. This usually indicate the receiving network has a longer retry pattern then the validity period or it is experiencing an issue processing DLR.
    • expired: The SMS was expired before we were able to send the message to a mobile operator or downstream provider.
  • delivery_failed: The message couldn't be delivered and a negative DLR has been received. More detail can be found in the reason, or when present in the error code.
    • unknown subscriber: The receiver number is not associated with an active line.
      • 1: EC_UNKNOWN_SUBSCRIBER
      • 2: EC_UNKNOWN_BASE_STATION
      • 3: EC_UNKOWN_MSC
      • 5: EC_UNIDENTIFIED_SUBSCRIBER
      • 9: EC_ILLEGAL_SUBSCRIBER
      • 10: EC_BEARERSERVICE_NOT_PROVISIONED
      • 11: EC_TELESERVICE_NOT_PROVISIONED
      • 12: EC_CALL_BARRED
    • insufficient balance: The cost of the SMS is higher than the remaining balance available on your account.
    • generic delivery failure: No detailed information has been received by the downstream supplier and no additional information is available about the reason of the failure.
    • unavailable subscriber: The receiver number the SMS is temporarily unavailable, the number is valid and shall be kept in your database however the retry.
      • 8: EC_ROAMING_NOT_ALLOWED
      • 26: EC_SUBSEQUENT_HANDOVER_FAILURE
      • 31: EC_SUBSCRIBER_BUSY_FOR_MT_SMS
      • 27: EC_ABSENT_SUBSCRIBER
      • 28: EC_ABSENT_SUBSCRIBER_NO_PAGE
      • 29: EC_ABSENT_SUBSCRIBER_IMSI_DETACHED
      • 33: EC_MESSAGE_WAITING_LIST_FULL
    • received network error: the receiver's network is experiencing some issue, those are temporary preventing SMS delivery however the receiver number used is both valid and correct.
      • 7: EC_UNKNOWN_EQUIPMENT
      • 12: EC_ILLEGAL_EQUIPMENT
      • 21: EC_FACILITY_NOT_SUPPORTED
      • 30: EC_CONTROLLING_MSC_FAILURE
      • 34: EC_SYSTEM_FAILURE
      • 35: EC_DATA_MISSING
      • 36: EC_UNEXPECTED_DATA_VALUE
      • 39: EC_NO_ROAMING_NUMBER_AVAILABLE
      • 40: EC_MEMORY_CAPACITY_EXCEEDED
      • 71: EC_UNKNOWN_ALPHABET
    • opted out: The receiver revoked his/her consent to receive further SMS from the customer/originating number.
      • 103: EC_SUBSCRIBER_OPTEDOUT
    • carrier rejected: The receiver's carrier or mobile operator is blocking the SMS, this is most likely caused by the lack of a mandatory registration for the SMS originator or its content and/or the locally applicable definition of forbidden / unlawful traffic
      • 104: EC_SENDER_UNREGISTERED
      • 105: EC_CONTENT_UNREGISTERED
      • 110: EC_MESSAGE_FILTERED
    • capacity limit reached: The receiver's carrier or mobile operator is blocking the SMS due to limitation of SMS per second per day (e.g. as part of USA's campaign throttling regulation), or on the time of the day you are authorised to send SMS (e.g. as part of India's Do-Not-Disturb policy). Applicable for countries that require registered campaigns.
      • 106: EC_CAMPAIGN_VOLUME_EXCEEDED
      • 107: EC_CAMPAIGN_THROUGHPUT_EXCEEDED
  • scheduled: The message is scheduled by the customer to be sent at a later time (API only).

Some Statuses, Reasons and Error Codes are related to country restrictions. You can find more information about countries restrictions at our help pages.

SMS Error Codes

CodeNameDescription
0EC_NO_ERROR-
1EC_UNKNOWN_SUBSCRIBERPermanent; The receiver number is not associated with an active line.
2EC_UNKNOWN_BASE_STATIONPermanent; The receiver number is currently attached to an equipment unknown to the receiving network.
3EC_UNKOWN_MSCIntermediate; The receiver number is currently attached to an equipment unknown to the receiving network.
5EC_UNIDENTIFIED_SUBSCRIBERIntermediate; The receiver number is not associated with an active line.
7EC_UNKNOWN_EQUIPMENTIntermediate; The receiver number is valid but its handset is not able to connect to the mobile network.
8EC_ROAMING_NOT_ALLOWEDIntermediate; The receiver is currently outside of its network of origin and it is not authorised to roam. The issue will resolve once it returns.
9EC_ILLEGAL_SUBSCRIBERPermanent; The receiver failed to authenticate when connecting to the mobile network.
10EC_BEARERSERVICE_NOT_PROVISIONEDIntermediate; The receiver number bearer is not provisioned for SMS. This could be because the subscriber have 2 active numbers (dual numbering) and the one used as receiver is not SMS enable (but the other is).
11EC_TELESERVICE_NOT_PROVISIONEDIntermediate; The receiver is not provisioned for SMS this could be because the number is a not a mobile (i.e. is a IoT number) and/or the subscriber plan do not allow SMS.
12EC_ILLEGAL_EQUIPMENTIntermediate; The receiver number is valid but its handset is blacklisted as stolen/lost.
13EC_CALL_BARREDIntermediate; The SMS services have been blocked by the receiver operator. This is usually linked to an unpaid bill or lack of credit.
21EC_FACILITY_NOT_SUPPORTEDIntermediate; The SMS is failing due to the receiving network not supporting SMS.
26EC_SUBSEQUENT_HANDOVER_FAILUREIntermediate; The receiver is currently moving between different areas of its network and the SMS couldn't be delivered.
27EC_ABSENT_SUBSCRIBERIntermediate; The receiver couldn't be located on the receiver network.
28EC_ABSENT_SUBSCRIBER_NO_PAGEIntermediate; The receiver is out of coverage.
29EC_ABSENT_SUBSCRIBER_IMSI_DETACHEDIntermediate; The receiver switched its handset off.
30EC_CONTROLLING_MSC_FAILUREIntermediate; The network equipment the receiver is attached to is experiencing a temporary failure and/or planned maintenance.
31EC_SUBSCRIBER_BUSY_FOR_MT_SMSIntermediate; The receiver is currently busy (example performing USSD) and the SMS could not be delivered.
32EC_SM_DELIVERY_FAILUREIntermediate
33EC_MESSAGE_WAITING_LIST_FULLIntermediate; The receiver has received more SMS then then local network nodes can store for a single user.
34EC_SYSTEM_FAILUREIntermediate; A generic issue with the receiver network.
35EC_DATA_MISSINGIntermediate; A mandatory (by the receiver network) field was empty.
36EC_UNEXPECTED_DATA_VALUEIntermediate; Value in one the SMS fields was wrong (i.e. the charset used for coding the SMS).
39EC_NO_ROAMING_NUMBER_AVAILABLEIntermediate; The receiver is roaming and a temporary roaming redirecting number was not available to be assigned to reroute the SMS to the correct country/destination.
40EC_MEMORY_CAPACITY_EXCEEDEDIntermediate; An unspecified equipment on the receiving network has no memory left to handle incoming SMS traffic.
71EC_UNKNOWN_ALPHABETPermanent; The SMS is written in an alphabet/charset that is not supported by the receiving network.
72EC_USSD_BUSYIntermediate
101EC_SUBSCRIBER_INSUFFICIENT_BALANCEIntermediate
103EC_SUBSCRIBER_OPTEDOUTPermanent; The receiver opted out from receiving SMS all future SMS will be blocked. This error can only be solved by the subscriber sending an opt-in keyword like 'START'.
104EC_SENDER_UNREGISTEREDPermanent; The originator used in sending the SMS is not allowed by the receiving mobile operator, this is usually caused by a lack of registration. Please consult our countries restrictions list for more information on how to register it.
105EC_CONTENT_UNREGISTEREDPermanent; The content of the SMS is not allowed by the receiving mobile operator, this is usually caused by a lack of registration. Please consult our countries restrictions list for more information on how to register it.
106EC_CAMPAIGN_VOLUME_EXCEEDEDIntermediate; The volume cap associated to the campaign of the SMS (via used originator) is reached at the receiving operator, and further SMS will be blocked until the volume cap resets. SMS to other operators are unaffected. You can find more information at our countries restrictions list.
107EC_CAMPAIGN_THROUGHPUT_EXCEEDEDIntermediate; The maximum SMS rate associated to the campaign of the SMS (via used originator) is reached at the receiving operator, and excess SMS are being blocked. You can find more information at our countries restrictions list.
110EC_MESSAGE_FILTEREDPermanent; The SMS originator or content is not allowed by the receiving mobile operator. Please consult our countries restrictions list for more information on applicable regulations and forbidden content or originators.

SMPP

The SMPP documentation describes everything you need to know about the MessageBird SMPP server. Keep in mind that it's important for you to already have a basic understanding of the SMPP protocol and to know how to set up your own SMPP client software.

The SMPP servers

Server list

MessageBird has multiple SMPP servers for you to connect to. Each SMPP server offers the ability to connect to it via the regular (plaintext) method, a TLS v1.2, or better connection.

Here is an overview of the available servers:

HostnamePortTLS port
smpp01.messagebird.com27752776
smpp02.messagebird.com27752776
smpp03.messagebird.com27752776

Username and password

Your account manager at MessageBird will give you a username (system_id) and password. If you haven’t received them yet or you still need to make the request, simply send us an email to support@messagebird.com; we'll be happy to help you out.

Bindings and throughput

Whenever an SMPP account has been set up for you, you’ll receive the maximum amount of binds and throughput. In most cases, these values will be something like 3 binds and 50 messages per second.

It might be interesting to note that these values are enforced on a per-server basis. That means that given the above example, you can set up 9 binds in total with a throughput of 150 messages per second when you connect to all servers.

Keep in mind that for maintenance purposes we only guarantee either that one server is up at any given time, so we advise you to connect to all of them.

Bindings and relaying

MessageBird’s message relaying system is connection and server agnostic, so when you send an MT via a submit_sm PDU on connection A, you might receive the matching DLR in the form of a deliver_sm on connection B if both connections are bound with the same username.

This is even true for connections made to different servers, so this scenario is also possible if connection A is made to the smpp01 server and connection B to the smpp02 server.

Security

If you connect to either server via a TLS connection, make sure to select TCP port 2776. Also be aware that the servers only accept an SSLv3 handshake method, so the old (legacy) SSLv2 handshake won’t work, even though your crypto stick plans to negotiate to use TLS1.0 or better.

Supported PDUs

The MessageBird SMPP servers support the following list of PDU types:

PDU namecommand_id
bind_receiver0x00000001
bind_transceiver0x00000009
bind_transmitter0x00000002
deliver_sm_resp0x80000005
enquire_link0x00000015
generic_nack0x80000000
submit_sm0x00000004
unbind0x00000006
unbind_resp0x80000006

bind PDU

An SMPP bind_receiver, bind_transceiver, or bind_transmitter PDU request has a fixed set of fields. Most fields are irrelevant to us; actually, we only read the system_id, password, and interface_version fields and the rest is ignored.

Field nameDescription
system_idThe username
passwordThe password
system_typeIGNORED
interface_versionThe SMPP protocol version you want to talk
addr_tonIGNORED
addr_npiIGNORED
address_rangeIGNORED

interface_version

The MessageBird SMPP server supports SMPP protocol version 3.3, 3.4, and 5.0. Keep in mind that if you set your SMPP client to talk version 3.3 you are missing out on some features, most notably TLV information in the deliver_sm PDUs you receive.

submit_sm PDU

You can use the submit_sm PDU to send us your MT messages. Like a bind request, the submit_sm PDU request also has a couple of fields that are unused by our platform and can safely be ignored.

service_typeIGNORED
source_addr_tonType of number for source_addr
source_addr_npiNumbering plan indicator for source_addr
source_addrAddress of message origin
dest_addr_tonType of number for destination_addr
dest_addr_npiNumbering plan indicator for destination_addr
destination_addrAddress of message destination
esm_classMessage mode and type
protocol_idIGNORED
priority_flagIGNORED
schedule_delivery_timeIGNORED
validity_periodThe validity period of this message
registered_deliveryThe type if DLRs you want to receive
replace_if_present_flagIGNORED
data_codingThe coding of the short_message field
sm_default_msg_idIGNORED
sm_lengthThe length of short_message field
short_messageThe contents of the MT

data_coding

The values for the data_coding field are not solidly declared in the SMPP spec, so each SMPP server is more or less required to give its own definition. Below is a list of data codings that we accept as input. Keep in mind that only the values of 0, 2 and 8 are used as-is, other values will be converted to the most appropriate encoding out of 0, 2 and 8 to ensure acceptance of your messages by the operators.

ValueEncoding
0GSM7
1ASCII
28BIT
3ISO-8859-15 West European languages (Latin-9)
6ISO-8859-5 Latin/Cyrillic
7ISO-8859-8 Latin/Hebrew
8UTF-16BE (UCS2)

deliver_sm PDU

MOs and DLRs will be sent to you via a deliver_sm PDU. The fields are exactly the same as a submit_sm PDU, but there will be differences in which fields you are free to ignore, and which you are not.

FieldName Description
service_typeIGNORED
source_addr_tonType of number for source_addr
source_addr_npiNumbering plan indicator for source_addr
source_addrAddress of message origin
dest_addr_tonType of number for destination_addr
dest_addr_npiNumbering plan indicator for destination_addr
destination_addrAddress of message destination
esm_classMessage mode and type
protocol_idIGNORED
priority_flagIGNORED
schedule_delivery_timeIGNORED
validity_periodThe validity period of this message
registered_deliveryIGNORED
replace_if_present_flagIGNORED
data_codingThe coding of the short_message field
sm_default_msg_idIGNORED
sm_lengthThe length of short_message field
short_messageThe contents of the MT

data_coding

The values here are the same as in section submit_sm.

tlvs

DLR messages which are sent to you as a deliver_sm may contain TLVs that you might be interested in. The following TLVs are supported as of the writing of this document:

NameTag IDDescription
receipted_message_id0x001EThe message_id referencing the same message_id that was returned in the submit_sm_resp of the MT (SMPP v5.0 spec: 4.8.4.47)
message_state0x0427The final message state for a delivery receipt (SMPP v5.0 spec: 4.7.15 and 4.8.4.37)
network_error_code0x0423The actual network error code (SMPP v5.0 spec: 4.8.4.42)
network_mccmnc *0x1560Operator MCCMNC of recipient MSISDN of related SMS; given when available.

TLVs marked with * are custom MessageBird SMPP tags.

short_message

In the case of MO messages, the short_message field will contain the contents of the message that was sent. In the case of DLR messages, it will contain report information in the following format:

The id parameter references the message_id that was returned in the submit_sm_resp of your submit_sm and it has the same value as the receipted_message_id TLV.

The state parameter references the message_state TLV, although the message_state contains a number pointing to a state where the state parameter in the short_message is described by a word.

The err parameter references error codes in section 3.3.4 and is the same as the network_error_code TLV.

Examples

id:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx sub:001 dlvrd:NNN submit date:YYMMDDHHMMSS done date:YYMMDDHHMMSS stat:STATUS err:NNN text:
id:fecf8e26-eb1d-46e7-5bdf-e509c058f7b7 sub:001 dlvrd:001 submit date:141029064451 done date:141029064502 stat:DELIVRD err:000 text:

Questions?

We’re always happy to help with code or other doubts you might have! Check out our Quickstarts, API Reference, Tutorials, SDKs, or contact our Support team.

Cookie Settings