Sending SMS
Two methods: POST /messages for one recipient and POST /campaigns for a list of numbers. Both send right away.
Phone numbers
We accept numbers in any of these forms, spaces and dashes are ignored:
| Form | Sent to |
|---|---|
48500600700 | 48500600700 |
+48 500 600 700 | 48500600700 |
0048500600700 | 48500600700 |
500600700 | 48500600700 |
A number we find no network for is rejected. In POST /campaigns such numbers are skipped; if none is left you get 422 no_chargeable_recipients.
Length and SMS parts
You pay per part. How many characters fit depends on the encoding: GSM-7 text fits more, and a single Polish letter (ą, ę, ł, ś, ż…) switches the whole message to Unicode.
| Encoding | 1 part | Each part of a long message |
|---|---|---|
| GSM-7 | 160 | 153 |
| Unicode (UCS-2) | 70 | 67 |
In GSM-7 the characters ^ { } \ [ ~ ] | € count double.
Sender name (source)
- Active names:
GET /sources. The default one comes first. - Without source we use the account's default name.
- A name not on the account, or one that has not passed moderation, gives 422 with an error on source. We never swap it silently.
- You apply for a new name in the panel: Sender name.
Options
ttl | Validity in minutes, 1–1440. A value outside the range is a 422 error; we do not clamp it. |
flash | true: the SMS pops up at once and is not stored in the inbox. |
Cost
The amount is reserved from the balance when the message is accepted and returned as cost (for all parts). Without enough funds you get 402 insufficient_funds and nothing is sent. Check the price for a number beforehand with GET /price.
Retrying without duplicates
When a connection drops mid-request you do not know whether the SMS went out. Add an Idempotency-Key header with an id from your system (e.g. the order number): a repeat with the same key within 24 hours returns the first response with Idempotency-Replayed: true and does not send again.
curl -X POST https://panel.esmsy.pl/api/v1/messages \
-H "X-Api-Key: $ESMSY_API_KEY" \
-H "Idempotency-Key: order-2026-000123" \
-H "Content-Type: application/json" \
-d '{"phone": "48500600700", "text": "Order 2026-000123 shipped"}'Only successful (2xx) responses are remembered. After a 4xx error you can fix the data and resend with the same key.
Sending to many recipients
POST /campaigns sends the same text to a list of numbers in one request and returns the send with the message count (deliveriesTotal) and total cost. Per-number statuses of such a send are visible in the panel, under Campaigns. If you need each number's status through the API, send with POST /messages.