Forward several received SMS at once
POSThttps://{ourserver.com}/api/resellers/addMessages
Forwards several SMS in one request. Each SMS is handled as in addMessage, and the answer reports the result of each one. We recommend this method over addMessage: collect the SMS and send them in batches, for example every few seconds.
The answer is HTTP 200 even when no SMS was accepted: check response and results.
Parameters
header1
| Name | Type | Description |
|---|---|---|
Authorization* | string | see more here |
Request Body
Content-Type
application/jsonSchema
schemaobject
messagesobject[]RequiredThe SMS, at least one. A JSON string of the array is accepted too.minItems: 1
teststring
Test mode, for /api/resellers* requests only. It can be passed in the query string or in the request body.
test1— the request is executed and answered as usual, but its database changes are rolled back. Effects outside the database still happen: for example, an SMS accepted by addMessage is still delivered to the customer, andusedvalues are still kept.test2— the request is not executed: the answer is a debug dump (HTML, HTTP 200) of the request headers and body as our server received them.
test value does not confirm that your server is up.Enum:test1test2Example:test1Examples
twoSms
Two SMS
{
"messages": [
{
"number": "33712345678",
"from": "Telegram",
"message": "Code: 12345"
},
{
"number": "33712345679",
"from": "WhatsApp",
"message": "Code: 56789"
}
]
}Responses
200Result of every SMS
Content-Type
application/jsonSchema
schemaobject
responsestringRequired
1 if at least one SMS was accepted, otherwise 0Enum:01Example:1totalintegerRequired
Number of SMS in the requestExample:2successintegerRequired
Number of accepted SMSExample:1failedintegerRequired
Number of SMS that were not acceptedExample:1resultsobject[]RequiredResult of each SMS, in the order of the request
Examples
partlyAccepted21 lines
One SMS accepted, one without a matching operation
{
"response": "1",
"total": 2,
"success": 1,
"failed": 1,
"results": [
{
"index": 0,
"number": "33712345678",
"from": "Telegram",
"response": "1"
},
{
"index": 1,
"number": "33712345679",
"from": "WhatsApp",
"response": "0",
"error": "NO_OPERATION"
}
]
}400messages is missing, empty or not a list
Content-Type
application/jsonSchema
schemaobjectError answer: response and message hold the same error code.
responsestringRequired
Enum:ERROR_PARAMSmessagestringRequired
Example:ERROR_PARAMS401No API key, or the key does not exist. The body is the plain text Unauthorized.
A request with Accept: application/json gets HTTP 200 with {"response":"ERROR_WRONG_KEY"} instead.
Content-Type
text/htmlSchema
schemastring
Enum:Unauthorized.Example:Unauthorized.403Forbidden: the API key is valid, but the request is refused. Error codes:
ERROR_DISABLED — the partner account is not activated;
ERROR_BANNED — the partner account is blocked;
ERROR_IP — the request comes from an IP address that is not in the account's allowlist;
ERROR_RENT — rent is requested, but the account has no rent access (addNumber only).
ERROR_DISABLED — the partner account is not activated;ERROR_BANNED — the partner account is blocked;ERROR_IP — the request comes from an IP address that is not in the account's allowlist;ERROR_RENT — rent is requested, but the account has no rent access (addNumber only).Content-Type
application/jsonSchema
schemaobject
responsestringRequired
Error codeEnum:ERROR_DISABLEDERROR_BANNEDERROR_IPERROR_RENTmessagestringRequired
The same error codeExamples
ERROR_IP
Request from an IP address outside the allowlist
{
"response": "ERROR_IP",
"message": "ERROR_IP"
}Code Samples
Generating examples...