Send a message

Send one SMS to a Moroccan mobile number. The cost is taken from your balance when the message is accepted; a failed message is refunded.

POSThttps://api.keryk.io/v1/messages

curl https://api.keryk.io/v1/messages \
  -H "Authorization: Bearer $KERYK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+212612345678",
    "text": "Votre code Keryk : 482913. Il expire dans 5 minutes.",
    "reference": "login-7781"
  }'

Body parameters

NameTypeDescription
to requiredstringMobile number in E.164 format, for example +212612345678.
text requiredstringMessage body. Latin text fits 160 characters per SMS; Arabic script 70. See encoding and segments.
referencestringYour own ID, returned in webhooks.
callback_urlstringReceives delivered, failed and reply events.

Response

{
  "id": "msg_8f2k1q",
  "status": "queued",
  "segments": 1,
  "encoding": "GSM-7",
  "cost": { "amount": "[0.00]", "currency": "MAD" },
  "balance": { "amount": "[0.00]", "currency": "MAD" }
}

Messages are sent from a Moroccan mobile number. Start every message with your brand name so recipients know who it is from. Custom sender IDs are on the roadmap.

Errors

StatusWhen
400to is not a Moroccan mobile number, or text is empty.
401The API key is missing or revoked.
402Your balance is too low for this message.
429Too many requests for this key or this number. Retry after the Retry-After header.

[ERROR BODY FORMAT]

On this page