REST API Documentation
This document provides detailed information about the REST API, including authentication, endpoints, request/response formats, and code examples.
Authentication
The API uses either an API Key or HTTP Basic Authentication to authenticate requests. Credentials must be provided in the Authorization
header for every request.
Note: Different API Keys will be provided for each connection. Checking Balance endpoint is using Account API Key, which will also be provided.
API Key
Provide your API key as a Bearer token with the App
scheme.
Authorization: App <YOUR_API_KEY>
Basic Auth
Use your username
and password
with standard HTTP Basic Authentication.
Authorization: Basic <BASE64_ENCODED_USERNAME:PASSWORD>
Base URL
All API endpoints are relative to the following base URL:
https://rest.mrmessaging.net
Multipart Messages (Concatenation)
When you send a text message that is too long to fit into a single SMS, it is split into multiple parts. These parts are sent individually but are reassembled by the recipient's device to appear as a single, long message. This process is often called concatenation.
How It Works
- Character Limits: A standard GSM-7 encoded SMS can contain up to 160 characters. A Unicode (UCS-2) encoded SMS (for non-latin characters like emojis) can contain up to 70 characters.
- Splitting: When a message is split, a small portion of each part is used for a User Data Header (UDH) which tells the receiving handset how to reassemble the parts. This reduces the character limit per part to 153 for GSM-7 and 67 for Unicode.
Single Message ID
Our API simplifies tracking for you. Even if your message is split into multiple parts, the API will process it as a single submission and return only one messageId
. This messageId
represents the entire logical message, and any delivery reports you receive will be for this single ID.
Note on Billing: You are billed for each individual part sent. For example, a 200-character GSM message will be split into two parts (153 + 47) and you will be charged for two messages. You can use the
POST /messages/preview
endpoint to check how many parts a message will be before sending it.
Rate Limiting
The API enforces a rate limit on message submissions based on your account's configured throughput. If you exceed this limit, you will receive an HTTP 429 Too Many Requests
error.
Error Handling
Error Response Format
When an API call fails, the server returns a JSON object with a standard error structure.
Example Error Response:
{
"errorCode": 110,
"description": "The 'sender' field is required."
}
Field | Type | Description |
---|---|---|
errorCode |
Integer | A unique code for the specific error. |
description |
String | A human-readable description of the error. |
Error Codes
The API returns standard HTTP status codes to indicate the success or failure of a request. Codes in the 2xx range indicate success. Codes in the 4xx range indicate a client-side error (e.g., a problem with the request data). Codes in the 5xx range indicate a server-side error.
400 Bad Request
errorCode |
description |
---|---|
100 | Malformed JSON syntax. |
101 | Request contains an unrecognized field. |
102 | A field has an invalid value or format. |
103 | A query or form parameter is invalid. |
110 | The 'sender' field is required. |
111 | The 'sender' has an invalid length. |
120 | The 'receiver' field is required and cannot be empty. |
121 | A 'receiver' has an invalid length. |
122 | A 'receiver' must contain only numbers with an optional '+' prefix. |
123 | A recipient in the 'receiver' list cannot be null or empty. |
124 | 'receiver' list contains duplicate numbers. |
125 | The batch contains duplicate receivers across different messages. |
126 | The total number of receivers is over limit. |
130 | Either 'message' or 'hexMessage' must be provided. |
131 | Cannot provide both 'message' and 'hexMessage'. |
132 | The 'message' field cannot be longer than 1000 characters. |
133 | Message is too long (max 10 parts). |
134 | Message contains non-GSM characters. Use type='unicode'. |
135 | The 'hexMessage' field cannot be longer than 3000 characters. |
136 | 'hexMessage' must contain only hexadecimal characters. |
137 | 'hexMessage' must have an even number of characters. |
140 | 'dataCoding' can only be set when 'hexMessage' is provided. |
141 | 'esmClass' can only be set when 'hexMessage' is provided. |
142 | 'type' can only be set when 'message' is provided. |
143 | 'validityPeriod' is outside the allowed range. |
151 | The 'messages' field is required and it cannot be empty. |
200 | No route or pricing configured for the receiver number(s). |
401 Unauthorized
errorCode |
description |
---|---|
401 | Authentication failed. The provided API Key or credentials are not valid. |
402 Payment Required
errorCode |
description |
---|---|
402 | Your account has insufficient balance. |
403 Forbidden
errorCode |
description |
---|---|
403 | Permission denied. Your account is not authorized to perform this action. |
404 Not Found
errorCode |
description |
---|---|
404 | Endpoint not found. |
405 Method Not Allowed
errorCode |
description |
---|---|
405 | HTTP method not allowed for this endpoint. |
429 Too Many Requests
errorCode |
description |
---|---|
150 | Number of message in batch is over limit. |
429 | Message throughput exceeded. Please try again later. |
500 Internal Server Error
errorCode |
description |
---|---|
500 | An internal server error occurred. |
SMS
With this API you can send SMS messages in various ways: as a single message, a broadcast to multiple recipients, or a batch of different messages in one request.
Send SMS Message
Sends a single SMS to one recipient. This endpoint supports application/json
and application/x-www-form-urlencoded
content types.
POST /messages
Request Body (application/json
)
Field | Type | Required | Description |
---|---|---|---|
sender |
String | Yes | The sender ID (from number). Alphanumeric (max 11 chars) or Numeric (max 14 chars). |
receiver |
String | Yes | A single recipient number. Numbers must contain only digits with an optional + prefix. Max length 50. |
message |
String | Yes* | The text content of the message. Max 1000 characters. Cannot be used with hexMessage . |
hexMessage |
String | Yes* | The message content as a hexadecimal string. For multipart messages, this must include the User Data Header (UDH). Must be an even-length string of hex characters. Max 3000 characters. Cannot be used with message . |
type |
String | No | The message encoding. Can be AUTO , GSM , or UNICODE . Defaults to AUTO . Only applicable when using the message field. |
validityPeriod |
Integer | No | The message validity period in minutes. Must be between 1 and 4320 (72 hours). |
dataCoding |
Byte | No | The SMPP data_coding value. Only applicable when using hexMessage . |
esmClass |
Byte | No | The SMPP esm_class value. Only applicable when using hexMessage . |
reference |
String | No | A custom reference string that will be included in the response. |
callbackUrl |
String | No | A webhook URL to receive delivery reports for this message. If not provided, the default callback URL for your account will be used. |
* One of message
or hexMessage
is required.
Success Response (200
)
Returns a message response object on success.
Field | Type | Description |
---|---|---|
messageId |
String | A unique ID (UUID) for the submitted message. |
receiver |
String | The recipient's phone number. |
status |
String | The status of the submission. Will be "SENT" on success. |
reference |
String | The custom reference string that was passed in the request. |
messageCount |
Integer | The number of parts the message was split into. |
type |
String | The detected encoding of the message (GSM or UNICODE ). |
Request Example
{
"sender": "InfoSMS",
"receiver": "491700000001",
"message": "Hello from the API!"
}
curl -X POST 'https://rest.mrmessaging.net/messages' \
-H 'Authorization: App <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"sender": "InfoSMS",
"receiver": "491700000001",
"message": "Hello from the API!"
}'
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
$client = new Client();
$apiKey = '<YOUR_API_KEY>';
$url = 'https://rest.mrmessaging.net/messages';
try {
$response = $client->post($url, [
'headers' => [
'Authorization' => 'App ' . $apiKey,
'Content-Type' => 'application/json',
'Accept' => 'application/json',
],
'json' => [
'sender' => 'InfoSMS',
'receiver' => '491700000001',
'message' => 'Hello from the API!',
]
]);
echo $response->getBody();
} catch (RequestException $e) {
echo $e->getResponse()->getBody()->getContents();
}
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class SendSms {
public static void main(String[] args) throws Exception {
String apiKey = "<YOUR_API_KEY>";
String json = "{\n"
+ " \"sender\": \"InfoSMS\",\n"
+ " \"receiver\": \"491700000001\",\n"
+ " \"message\": \"Hello from the API!\"\n"
+ "}";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://rest.mrmessaging.net/messages"))
.header("Authorization", "App " + apiKey)
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.statusCode());
System.out.println(response.body());
}
}
import requests
import json
api_key = "<YOUR_API_KEY>"
url = "https://rest.mrmessaging.net/messages"
payload = {
"sender": "InfoSMS",
"receiver": "491700000001",
"message": "Hello from the API!"
}
headers = {
"Authorization": f"App {api_key}",
"Content-Type": "application/json"
}
response = requests.post(url, data=json.dumps(payload), headers=headers)
print(response.status_code)
print(response.json())
Response Example
{
"messageId": "a1b2c3d4-e5f6-7890-1234-567890abcdef",
"receiver": "491700000001",
"status": "SENT",
"messageCount": 1,
"type": "GSM"
}
{
"errorCode": 200,
"description": "No route or pricing configured for the receiver number(s)."
}
{
"errorCode": 401,
"description": "Authentication failed. The provided API Key or credentials are not valid."
}
{
"errorCode": 402,
"description": "Your account has insufficient balance."
}
{
"errorCode": 403,
"description": "Permission denied. Your account is not authorized to perform this action."
}
{
"errorCode": 429,
"description": "Message throughput exceeded. Please try again later."
}
SMS
With this API you can send SMS messages in various ways: as a single message, a broadcast to multiple recipients, or a batch of different messages in one request.
Send SMS Message to Multiple Recipients
Sends the same SMS to multiple recipients in a single API call. This is more efficient than making multiple individual requests for the same message content.
POST /messages
Request Body (application/json
)
The request body uses the same fields as sending to a single recipient, with the following modification:
- The
receiver
field must be an array of strings (e.g.,["491700000001", "491700000002"]
).
Success Response (200
)
Returns a JSON object containing a messages
array. Each object in the array is a Message Response Object, corresponding to one of the recipients. The array will contain a mix of success and failure objects if some messages could not be sent.
Field | Type | Description |
---|---|---|
messages |
[Message Response Object] |
An array of message response objects, one for each recipient. |
Message Response Object
Each object in the messages
array has the following structure. If a message to a specific recipient fails, the object for that recipient will contain error details instead of a messageId
.
Field | Type | Description |
---|---|---|
messageId |
String | A unique ID (UUID) for the submitted message. Only present if status is "SENT". |
receiver |
String | The recipient's phone number. |
status |
String | The status of the submission. Will be "SENT" on success or "FAILED" on failure. |
errorCode |
Integer | The error code if the submission failed. Only present if status is "FAILED". |
description |
String | A description of the error if the submission failed. Only present if status is "FAILED". |
reference |
String | The custom reference string that was passed in the request. |
messageCount |
Integer | The number of parts the message was split into. |
type |
String | The detected encoding of the message (GSM or UNICODE ). |
Request Example
{
"sender": "InfoSMS",
"receiver": ["491700000001", "491700000002", "491700000003"],
"message": "This is a broadcast message!",
"reference": "cust-ref-456"
}
curl -X POST 'https://rest.mrmessaging.net/messages' \
-H 'Authorization: App <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"sender": "InfoSMS",
"receiver": ["491700000001", "491700000002", "491700000003"],
"message": "This is a broadcast message!",
"reference": "cust-ref-456"
}'
Response Example
{
"messages": [
{
"messageId": "b1c2d3e4-f5g6-7890-1234-567890abcdef",
"receiver": "491700000001",
"status": "SENT",
"reference": "cust-ref-456",
"messageCount": 1,
"type": "GSM"
},
{
"receiver": "491700000002",
"status": "FAILED",
"errorCode": 200,
"description": "No route or pricing configured for the receiver number(s).",
"reference": "cust-ref-456"
},
{
"messageId": "c2d3e4f5-g6h7-8901-2345-678901bcdefa",
"receiver": "491700000003",
"status": "SENT",
"reference": "cust-ref-456",
"messageCount": 1,
"type": "GSM"
}
]
}
SMS
With this API you can send SMS messages in various ways: as a single message, a broadcast to multiple recipients, or a batch of different messages in one request.
Send SMS Message via GET
Sends a single SMS using query parameters. This is functionally identical to the POST version but is offered for convenience in scenarios where POST is not feasible.
GET /messages
Query Parameters
The query parameters are the same as the JSON fields for the POST /messages
endpoint. For multiple receivers, repeat the receiver
parameter (e.g., ?receiver=...&receiver=...
).
Success Response (200
)
The response format depends on the number of recipients. If one receiver is provided, a single Message Response Object is returned. If multiple receivers are provided, a JSON object containing a messages
array of Message Response Objects is returned.
Message Response Object
Each object in the response has the following structure. If a message to a specific recipient fails, the object for that recipient will contain error details instead of a messageId
.
Field | Type | Description |
---|---|---|
messageId |
String | A unique ID (UUID) for the submitted message. Only present if status is "SENT". |
receiver |
String | The recipient's phone number. |
status |
String | The status of the submission. Will be "SENT" on success or "FAILED" on failure. |
errorCode |
Integer | The error code if the submission failed. Only present if status is "FAILED". |
description |
String | A description of the error if the submission failed. Only present if status is "FAILED". |
reference |
String | The custom reference string that was passed in the request. |
messageCount |
Integer | The number of parts the message was split into. |
type |
String | The detected encoding of the message (GSM or UNICODE ). |
Request Example
curl -G 'https://rest.mrmessaging.net/messages' \
-H 'Authorization: App <YOUR_API_KEY>' \
--data-urlencode 'sender=InfoSMS' \
--data-urlencode 'receiver=491700000001' \
--data-urlencode 'receiver=491700000002' \
--data-urlencode 'message=Hello from the API!'
Response Example
{
"messages": [
{
"messageId": "b1c2d3e4-f5g6-7890-1234-567890abcdef",
"receiver": "491700000001",
"status": "SENT",
"messageCount": 1,
"type": "GSM"
},
{
"messageId": "c2d3e4f5-g6h7-8901-2345-678901bcdefa",
"receiver": "491700000002",
"status": "SENT",
"messageCount": 1,
"type": "GSM"
}
]
}
SMS
With this API you can send SMS messages in various ways: as a single message, a broadcast to multiple recipients, or a batch of different messages in one request.
Send SMS Messages in a Batch
Sends multiple, distinct SMS messages in a single API call. This is more efficient than making multiple individual requests.
POST /messages/batches
Request Body (application/json
)
Field | Type | Required | Description |
---|---|---|---|
messages |
[Message Request Object] |
Yes | An array of message request objects. |
Each object in the messages
array is a complete message request. It has the same fields as a single SMS request (e.g., sender
, message
, etc.). The receiver
field within each message object can be either a single number (string) or a list of numbers (array of strings).
Validation
- The number of messages in a batch cannot exceed your account's configured throughput.
- Each message in the batch is validated individually.
- Recipient numbers must be unique across the entire batch.
Success Response (200
)
Returns a JSON object containing a messages
array. Each object in the array is a Message Response Object, corresponding to each message sent to each recipient. The array will contain a mix of success and failure objects if some messages could not be sent.
Field | Type | Description |
---|---|---|
messages |
[Message Response Object] |
An array of message response objects, one for each message sent to each recipient. |
Message Response Object
Each object in the messages
array has the following structure. If a message to a specific recipient fails, the object for that recipient will contain error details instead of a messageId
.
Field | Type | Description |
---|---|---|
messageId |
String | A unique ID (UUID) for the submitted message. Only present if status is "SENT". |
receiver |
String | The recipient's phone number. |
status |
String | The status of the submission. Will be "SENT" on success or "FAILED" on failure. |
errorCode |
Integer | The error code if the submission failed. Only present if status is "FAILED". |
description |
String | A description of the error if the submission failed. Only present if status is "FAILED". |
reference |
String | The custom reference string that was passed in the request. |
messageCount |
Integer | The number of parts the message was split into. |
type |
String | The detected encoding of the message (GSM or UNICODE ). |
Request Example
{
"messages": [
{
"sender": "Promos",
"receiver": "491700000001",
"message": "First message in batch."
},
{
"sender": "Alerts",
"receiver": [
"491700000002",
"491700000003"
],
"message": "Second message to two people."
}
]
}
curl -X POST 'https://rest.mrmessaging.net/messages/batches' \
-H 'Authorization: App <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"messages": [
{
"sender": "Promos",
"receiver": "491700000001",
"message": "First message in batch."
},
{
"sender": "Alerts",
"receiver": ["491700000002", "491700000003"],
"message": "Second message to two people."
}
]
}'
Response Example
{
"messages": [
{
"messageId": "a1b2c3d4-e5f6-7890-1234-567890abcde1",
"receiver": "491700000001",
"status": "SENT",
"messageCount": 1,
"type": "GSM"
},
{
"messageId": "a1b2c3d4-e5f6-7890-1234-567890abcde2",
"receiver": "491700000002",
"status": "SENT",
"messageCount": 1,
"type": "GSM"
},
{
"messageId": "a1b2c3d4-e5f6-7890-1234-567890abcde3",
"receiver": "491700000003",
"status": "SENT",
"messageCount": 1,
"type": "GSM"
}
]
}
{
"errorCode": 125,
"description": "The batch contains duplicate receivers across different messages."
}
Message Preview
With this API you can analyze message content to see how it will be segmented and encoded before you send it. This is useful for calculating costs and ensuring message delivery.
Preview Single Message
Analyzes a message to determine how many parts it will be split into and what encoding will be used, without actually sending it.
POST /messages/preview
Request Body (application/json
)
To preview a single message, send a JSON object with a message
key.
Field | Type | Required | Description |
---|---|---|---|
message |
String | Yes | The message text to analyze. |
Success Response (200
)
The response will be a single Preview Response Object.
Preview Response Object
Field | Type | Description |
---|---|---|
messagePreview |
String | Preview of the message content as it will be shown on recipient device. |
messageCount |
Integer | The number of SMS parts the message will be split into. |
charactersRemaining |
Integer | The number of characters available in the final part of the message. |
encoding |
String | The encoding that will be used: GSM or UNICODE . |
nonGSMCharacters |
String | A string containing all non-GSM characters found in the message. This field is only present if the encoding is UNICODE . |
Request Example
{
"message": "This is a test message with a special character: €"
}
curl -X POST 'https://rest.mrmessaging.net/messages/preview' \
-H 'Authorization: App <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"message": "This is a test message with a special character: €"
}'
Response Example
{
"messagePreview": "This is a test message with a special character: €",
"messageCount": 1,
"charactersRemaining": 21,
"encoding": "UNICODE",
"nonGSMCharacters": "€"
}
Message Preview
With this API you can analyze message content to see how it will be segmented and encoded before you send it. This is useful for calculating costs and ensuring message delivery.
Preview Multiple Messages
Analyzes multiple messages to determine how many parts they will be split into and what encoding will be used, without actually sending them.
POST /messages/preview
Request Body (application/json
)
To preview multiple messages, send a JSON object with a message
key containing an array of strings.
Field | Type | Required | Description |
---|---|---|---|
message |
[String] |
Yes | An array of message strings to analyze. |
Success Response (200
)
The response will be a JSON object containing a previews
array, where each element is a Preview Response Object.
Preview Response Object
Field | Type | Description |
---|---|---|
messagePreview |
String | Preview of the message content as it will be shown on recipient device. |
messageCount |
Integer | The number of SMS parts the message will be split into. |
charactersRemaining |
Integer | The number of characters available in the final part of the message. |
encoding |
String | The encoding that will be used: GSM or UNICODE . |
nonGSMCharacters |
String | A string containing all non-GSM characters found in the message. This field is only present if the encoding is UNICODE . |
Request Example
{
"message": [
"Hello world!",
"This message has a Unicode character: é"
]
}
curl -X POST 'https://rest.mrmessaging.net/messages/preview' \
-H 'Authorization: App <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"message": [
"Hello world!",
"This message has a Unicode character: é"
]
}'
Response Example
{
"previews": [
{
"messagePreview": "Hello world!",
"messageCount": 1,
"charactersRemaining": 149,
"encoding": "GSM"
},
{
"messagePreview": "This message has a Unicode character: é",
"messageCount": 1,
"charactersRemaining": 29,
"encoding": "UNICODE",
"nonGSMCharacters": "é"
}
]
}
Number Lookup
With this API you can verify phone numbers to get information like network operator, validity, and roaming status. This helps improve delivery rates and clean your contact lists.
Single Number Lookup (async)
Performs a network lookup (e.g., HLR) on a single phone number to verify its status and network information.
POST /lookup
Request Body (application/json
)
Field | Type | Required | Description |
---|---|---|---|
to |
String | Yes | A single number to look up. |
reference |
String | No | A custom reference string that will be included in the response. |
callbackUrl |
String | No | A webhook URL to receive delivery reports for this message. If not provided, the default callback URL for your account will be used. |
Success Response (200
)
The API acknowledges the lookup request immediately and processes it asynchronously. The response indicates if the number was accepted for processing. The final lookup results will be delivered to a pre-configured webhook.
For a single number, the response is a single lookup result object.
Field | Type | Description |
---|---|---|
lookupId |
String | A unique ID (UUID) for the submitted lookup request. Present only on successful submission. |
to |
String | The phone number that was submitted for lookup. |
errorCode |
Integer | Present if the submission for this specific number was rejected. |
errorDescription |
String | A description of the error if the submission was rejected. |
Request Example
{
"to": "491700000001"
}
curl -X POST 'https://rest.mrmessaging.net/lookup' \
-H 'Authorization: App <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"to": "491700000001"
}'
Response Example
{
"lookupId": "d1e2f3a4-b5c6-7890-1234-567890abcdef",
"to": "491700000001"
}
Number Lookup
With this API you can verify phone numbers to get information like network operator, validity, and roaming status. This helps improve delivery rates and clean your contact lists.
Multiple Number Lookups (async)
Performs a network lookup (e.g., HLR) on multiple phone numbers to verify their status and network information in a single call.
POST /lookup
Request Body (application/json
)
Field | Type | Required | Description |
---|---|---|---|
to |
[String] |
Yes | An array of numbers to look up. |
reference |
String | No | A custom reference string that will be included in the response. |
callbackUrl |
String | No | A webhook URL to receive delivery reports for this message. If not provided, the default callback URL for your account will be used. |
Success Response (200
)
The API acknowledges the lookup request immediately and processes it asynchronously. The response indicates which numbers were accepted for processing. The final lookup results will be delivered to a pre-configured webhook.
For multiple numbers, the response is a JSON object containing a lookups
array. Each object in the array represents the submission status for one number.
Field | Type | Description |
---|---|---|
lookupId |
String | A unique ID (UUID) for the submitted lookup request. Present only on successful submission. |
to |
String | The phone number that was submitted for lookup. |
errorCode |
Integer | Present if the submission for this specific number was rejected. |
errorDescription |
String | A description of the error if the submission was rejected. |
Request Example
{
"to": ["491700000001", "491700000002"]
}
curl -X POST 'https://rest.mrmessaging.net/lookup' \
-H 'Authorization: App <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"to": ["491700000001", "491700000002"]
}'
Response Example
{
"lookups": [
{
"lookupId": "d1e2f3a4-b5c6-7890-1234-567890abcdef",
"to": "491700000001"
},
{
"to": "491700000002",
"errorCode": 122,
"errorDescription": "A 'to' must contain only numbers with an optional '+' prefix."
}
]
}
Number Lookup
With this API you can verify phone numbers to get information like network operator, validity, and roaming status. This helps improve delivery rates and clean your contact lists.
Number Lookup via GET (async)
Performs a network lookup using query parameters. You can look up a single number, or multiple numbers by repeating the to
parameter.
GET /lookup
Query Parameters
Parameter | Type | Required | Description |
---|---|---|---|
to |
String | Yes | A phone number to look up. Repeat for multiple. |
reference |
String | No | A custom reference string that will be included in the response. |
callbackUrl |
String | No | A webhook URL to receive delivery reports for this message. If not provided, the default callback URL for your account will be used. |
Success Response (200
)
The API acknowledges the lookup request immediately and processes it asynchronously. The response indicates which numbers were accepted for processing. The final lookup results will be delivered to a pre-configured webhook.
The response format depends on the number of recipients. If one number is provided, a single lookup result object is returned. If multiple numbers are provided, a JSON object containing a lookups
array is returned. Each object in the array has the following structure:
Field | Type | Description |
---|---|---|
lookupId |
String | A unique ID (UUID) for the submitted lookup request. Present only on successful submission. |
to |
String | The phone number that was submitted for lookup. |
errorCode |
Integer | Present if the submission for this specific number was rejected. |
errorDescription |
String | A description of the error if the submission was rejected. |
Request Example
curl -G 'https://rest.mrmessaging.net/lookup' \
-H 'Authorization: App <YOUR_API_KEY>' \
--data-urlencode 'to=491700000001' \
--data-urlencode 'to=491700000002'
Response Example
{
"lookups": [
{
"lookupId": "d1e2f3a4-b5c6-7890-1234-567890abcdef",
"to": "491700000001"
},
{
"lookupId": "d1e2f3a4-b5c6-7890-1234-567890abcdeg",
"to": "491700000002"
}
]
}
Check Balance
With this API you can retrieve your current account balance details. The balance returned is based on the login credentials provided: it can be for the whole account, or for a single connection if per-connection balance is enabled. The response includes details like account name, overdraft limits, and currency. Other API calls that incur a charge (e.g., sending an SMS) will return a 402 Your account has insufficient balance
error if your account's balance is too low for the transaction.
GET /balance
POST /balance
This endpoint can be accessed via GET
or POST
(with an empty body).
Success Response (200
)
Field | Type | Description |
---|---|---|
accountName |
String | Your account name. |
balance |
Double | The current available balance. |
overdraft |
Double | The standard overdraft limit. |
temporaryOverdraft |
Double | Temporary overdraft limit. Optional, only present if active. |
temporaryOverdraftExpireDate |
String | Expiration date for temporary overdraft, in ISO 8601 / RFC 3339 format (Y-m-d\TH:i:sP ). Optional, only present if active. |
balanceStatusDate |
String | The date and time when this balance information was generated, in ISO 8601 / RFC 3339 format (Y-m-d\TH:i:sP ). |
currency |
String | The currency of the balance (e.g., "EUR"). |
Request Example
curl -X GET 'https://rest.mrmessaging.net/balance' \
-H 'Authorization: App <YOUR_API_KEY>'
Response Example
{
"accountName": "My Test Account",
"balance": 123.45,
"overdraft": 10.0,
"balanceStatusDate": "2023-01-01T00:00:00+02:00",
"currency": "EUR"
}
Get Pricing
With this API you can retrieve the current pricing for sending messages. You can get the full price list for your account or filter by a specific country using its Mobile Country Code (MCC).
GET /pricing
POST /pricing
This endpoint can be accessed via GET
or POST
.
Query/Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
mcc |
String | No | A Mobile Country Code to filter the pricing list (e.g., "262" for Germany). |
Success Response (200
)
Returns an array of pricing objects.
Field | Type | Description |
---|---|---|
connection | String | The connection name the price applies to. |
mcc | String | The Mobile Country Code. |
mnc | String | The Mobile Network Code. |
price | String | The price per message. |
currency | String | The currency of the price. |
comment | String | Any comments associated with this price entry. Will show PER_DELIVERED if pricing is for per delivered message. |
activeSince | String | The date since when this price is active, in ISO 8601 / RFC 3339 format (Y-m-d\TH:i:sP ). |
Request Example
# Get all pricing
curl -X GET 'https://rest.mrmessaging.net/pricing' \
-H 'Authorization: App <YOUR_API_KEY>'
# Get pricing for a specific MCC
curl -G 'https://rest.mrmessaging.net/pricing' \
-H 'Authorization: App <YOUR_API_KEY>' \
--data-urlencode 'mcc=262'
curl -X POST 'https://rest.mrmessaging.net/pricing' \
-H 'Authorization: App <YOUR_API_KEY>' \
-H 'Content-Type: application/json' \
-d '{
"mcc": "262"
}'
Response Example
[
{
"connection": "MyConnection",
"mcc": "262",
"mnc": "01",
"price": "0.0500",
"currency": "EUR",
"comment": "PER_DELIVERED",
"activeSince": "2023-01-01T00:00:00+02:00"
},
{
"connection": "MyConnection",
"mcc": "262",
"mnc": "02",
"price": "0.0480",
"currency": "EUR",
"activeSince": "2023-01-01T00:00:00+02:00"
}
]
SMS DLR Callback Webhook
Receive real-time delivery status updates for your sent messages by providing a callback URL.
SMS Delivery Reports
To receive delivery reports (DLRs), you must have a default callback URL configured for your account. You can also override this on a per-message basis by providing a specific callbackUrl
in your API request. When a message's status changes, our system sends a GET
request to the appropriate URL (the one from the request if present, otherwise your account's default) with the delivery information appended as query parameters.
Retry Schedule
If your callback URL is unavailable or returns an error, our system will attempt to redeliver the DLR according to the following schedule. If all attempts fail, the delivery report will be lost.
Retry Attempt | Interval | Cumulative Time |
---|---|---|
1 | 1 min | 1 min |
2 | 3 min | 4 min |
3 | 5 min | 9 min |
4 | 10 min | 19 min |
5 | 15 min | 34 min |
Delivery Report Parameters
The following parameters will be sent to your webhook:
Parameter | Description |
---|---|
id | The unique messageId returned when the message was originally sent. |
status | The delivery status. Possible values are: DELIVRD , EXPIRED , DELETED , UNDELIV , ACCEPTD , UNKNOWN , REJECTD . |
submitdate | The time and date the message was submitted, in YYYY-MM-DD HH:MM:SS format (UTC). |
donedate | The time and date the message reached its final state, in YYYY-MM-DD HH:MM:SS format (UTC). |
submitted | The number of parts the message was split into. |
delivered | The number of parts that were successfully delivered. |
error | The network-specific error code for the delivery. 000 indicates no error. |
text | The first 20 characters of the original message text. |
Example DLR Callback Request
If your provided callbackUrl
was https://example.com/dlr-webhook
, the request our server sends to you would look like this:
Example GET Request to Webhook
GET /dlr-webhook?id=a1b2c3d4-e5f6-7890-1234-567890abcdef&status=DELIVRD&submitdate=2024-05-21%2010%3A00%3A00&donedate=2024-05-21%2010%3A00%3A05&submitted=1&delivered=1&error=000&text=This%20is%20the%20message... HTTP/1.1
Host: example.com
User-Agent: Our-DLR-Service/1.0
...
Decoded Parameters
Here are the parameters from the example above, decoded for clarity:
id | a1b2c3d4-e5f6-7890-1234-567890abcdef |
status | DELIVRD |
submitdate | 2024-05-21 10:00:00 |
donedate | 2024-05-21 10:00:05 |
submitted | 1 |
delivered | 1 |
error | 000 |
text | This is the message... |