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.
How to read the result
Section titled “How to read the result”| 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.
Response example
Section titled “Response example”The first message was priced successfully. The second could not be priced because its content was missing.
HTTP/1.1 200 OKContent-Type: application/jsonX-Success-Count: 1X-Error-Count: 1[ { "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.
How to handle a batch
Section titled “How to handle a batch”- Check HTTP status and Content-Type. For HTTP 200 with
application/json, inspect every array item. - For
error: null, read the pricing result. For a stringerror, record the description and correct the message data. X-Success-Countcounts successful calculations, andX-Error-Countcounts unsuccessful calculations. Both describe individual results regardless of the whole response’s HTTP 200 status.- Retry pricing after checking the cause. The message rejection descriptions help interpret content, recipient, sender and limit failures.