Skip to content

Message pricing

Operation results / Pricing

POST /rest/messages/sms/price and POST /rest/messages/mms/price return a calculation result for each message. HTTP 200 confirms that the request was processed; check an item’s error field to determine whether its calculation succeeded.

Field / value Meaning
error: null The calculation succeeded; read price and parts.
error as a string Description of the unsuccessful calculation.
price Message price in PLN. Treat it as a successful calculation result only after checking error.
parts Number of message parts; it can be null when calculation fails.

For an unknown exception, pricing returns Unknown error in error. Do not classify the cause by comparing the exact message text.

The first message was priced successfully. The second could not be priced because its content was missing.

Response headers
HTTP/1.1 200 OK
Content-Type: application/json
X-Success-Count: 1
X-Error-Count: 1
Successful and unsuccessful pricing in one response
[
{
"error": null,
"cid": "order-123",
"type": 1,
"recipient": "+48500100200",
"sender": "STORE",
"parts": 1,
"unicode": false,
"flash": false,
"price": 0.16
},
{
"error": "Missing message content",
"cid": "order-124",
"type": 1,
"recipient": "+48500100201",
"sender": "STORE",
"parts": null,
"unicode": false,
"flash": false,
"price": 0
}
]

The example price is illustrative. The actual price depends on the message and the account’s price list.

  1. Check HTTP status and Content-Type. For HTTP 200 with application/json, inspect every array item.
  2. For error: null, read the pricing result. For a string error, record the description and correct the message data.
  3. X-Success-Count counts successful calculations, and X-Error-Count counts unsuccessful calculations. Both describe individual results regardless of the whole response’s HTTP 200 status.
  4. Retry pricing after checking the cause. The message rejection descriptions help interpret content, recipient, sender and limit failures.

Message sending and statuses · Cancellation and deletion