SMS YANU documentation home

Send an SMS

POST /v1/messages/send sends one SMS to a Malawi number. To send to many numbers, use send-bulk.

POST https://api.smsyanu.com/v1/messages/send
Authorization: Bearer yanu_live_YOUR_KEY
Content-Type: application/json

Request body

FieldTypeRequiredMeaning
tostringYesMalawi number, for example +265990000000.
textstringYesThe message. Long text is split into segments. See encoding.
sender_idstringNoSender name or number, up to 11 letters and digits. It must be approved on your account. Without it, the route default is used.
schedule_modestringNonow (default) or scheduled.
scheduled_atstringWhen scheduledISO 8601 time with a time zone. At least 5 minutes and at most 7 days ahead.
flashbooleanNoShow on the screen without saving on the phone. Same price.
validity_periodintegerNoMinutes (1 to 4320) the network keeps trying before the message expires.
{
  "to": "+265990000000",
  "text": "Your order 1042 is ready for collection.",
  "sender_id": "YANU"
}

Response

HTTP 200:

{
  "id": "6f1c2b9e-1d2a-4c55-9a0e-2b7f0c1d3e4f",
  "status": "submitted",
  "segments": 1,
  "encoding": "GSM-7",
  "recipients": 1,
  "price_per_sms": 20.0,
  "cost": 20.0,
  "cost_currency": "MWK",
  "balance_after": 4980.0,
  "scheduled_at": null
}
FieldMeaning
idMessage id. Use it to look up the message and to match webhooks.
statussubmitted (sent to the network), scheduled, or failed.
segmentsNumber of parts. You pay per segment.
encodingGSM-7 or UCS-2.
cost, cost_currencyWhat your balance was charged.
balance_afterYour balance after this message.

SMS to Malawi costs K20 per segment. Your dashboard shows the price for your account.

Send each message once

Network problems can make you retry a request. Add an Idempotency-Key header with a unique value per message, for example your order id:

Idempotency-Key: order-1042-ready

If you send the same key again, you get the first result back. You are not charged twice.

Message status

StatusMeaning
queuedAccepted, waiting to go out.
scheduledWaiting for its scheduled time.
submittedHanded to the network.
deliveredThe phone received it.
failedNot delivered. If it never left SMS YANU, the charge is refunded.
cancelledA scheduled message you cancelled.

Rules that apply

  • Malawi numbers only. Other countries get HTTP 422 code destination_not_allowed.
  • Your balance must cover the full message. If not, HTTP 402 code insufficient_balance.
  • A number that replied STOP to you is refused with HTTP 403 code recipient_opted_out.
  • The default rate limit is 20 requests per second per client. Above it, HTTP 429 code rate_limited.

Price before you send

POST /v1/messages/rate takes to and text and returns the encoding, segment count and total cost. Nothing is sent and nothing is charged.

To be confirmed

The send endpoint exists in the current code. The exact response fields, the encoding labels, the optional fields and the rate limit may change before launch. The destination_not_allowed rule is part of the agreed contract.

On this page