Skip to content

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:

FormSent to
4850060070048500600700
+48 500 600 70048500600700
004850060070048500600700
50060070048500600700

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.

Encoding1 partEach part of a long message
GSM-7160153
Unicode (UCS-2)7067

In GSM-7 the characters ^ { } \ [ ~ ] | € count double.

Sender name (source)

Options

ttlValidity in minutes, 1–1440. A value outside the range is a 422 error; we do not clamp it.
flashtrue: 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.