API docs

Get an API key

Send messages from your own server.

Overview

Base URL
https://sms.rayenda.com/api/v1
Format
application/json
Authentication
Bearer API key
MethodAddressWhat it does
POST/api/v1/smsSend one message.
POST/api/v1/sms/bulkSend the same text to many numbers.
GET/api/v1/sms/{id}See what became of a message.
GET/api/v1/balanceSee your credits.
  • Times are UTC, in ISO 8601: 2026-10-06T09:15:02Z.
  • Credits are written as a decimal string: "0.35".
  • A request that is refused answers with an error; nothing is sent and nothing is charged.

Authentication

Send your API key with every request, in the Authorization header. Keys are made on the API keys page.

Header
Authorization: Bearer rs_live_YOUR_KEY
  • A key with a server IP works from that address only.
  • A revoked key is refused at once and cannot be brought back.

Keep keys on your server. Never put one in a web page or a mobile app.

Send an SMS

POST /api/v1/sms

The message is checked, charged and answered as queued; it goes to the network right after. Sending the same request twice sends two messages.

Request body

FieldTypeRequiredDescription
tostringYesThe number, with its country code: 8801712345678. See phone numbers.
messagestringYesThe text, in any language, up to 10 parts. See parts and cost.
sender_idstringNoOne of your approved sender IDs, in capitals or not. With it the message is masking: it shows this name and costs the masking rate. Without it the message is non-masking.
Request
curl -X POST https://sms.rayenda.com/api/v1/sms \
  -H "Authorization: Bearer rs_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "8801712345678",
    "message": "Your code is 4821"
  }'
Request
$curl = curl_init('https://sms.rayenda.com/api/v1/sms');

curl_setopt_array($curl, [
    CURLOPT_POST => true,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer rs_live_YOUR_KEY',
        'Content-Type: application/json',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'to' => '8801712345678',
        'message' => 'Your code is 4821',
    ]),
]);

$answer = json_decode(curl_exec($curl), true);
$status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);

if ($status === 201) {
    echo $answer['id'];               // SMS-7KQ2M9XB4TRW
} else {
    echo $answer['error']['code'];    // insufficient_credits, invalid_number, …
}
Request
const response = await fetch('https://sms.rayenda.com/api/v1/sms', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer rs_live_YOUR_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    to: '8801712345678',
    message: 'Your code is 4821',
  }),
});

const answer = await response.json();

if (response.status === 201) {
  console.log(answer.id);             // SMS-7KQ2M9XB4TRW
} else {
  console.log(answer.error.code);     // insufficient_credits, invalid_number, …
}
Response · 201
{
  "id": "SMS-7KQ2M9XB4TRW",
  "status": "queued",
  "to": "8801712345678",
  "sender_id": null,
  "message": "Your code is 4821",
  "encoding": "gsm",
  "parts": 1,
  "cost": "0.35",
  "refunded": false,
  "error": null,
  "created_at": "2026-10-06T09:15:02Z",
  "sent_at": null,
  "delivered_at": null,
  "failed_at": null
}

Keep the id: it is how you ask for the message later. The fields are explained there.

Send to many

POST /api/v1/sms/bulk

The same text to up to 1,000 numbers in one request. Every number becomes a message with its own ID.

Request body

FieldTypeRequiredDescription
tolist of stringsYesThe numbers, each with its country code. At most 1,000.
messagestringYesThe text every number gets.
sender_idstringNoAs in Send an SMS; it applies to all the numbers.
  • A number that cannot be sent to is left out and listed under rejected with its reason. The others are sent.
  • When there are not enough credits for all of them, the whole request is refused with insufficient_credits.
  • When no number can be sent to, the request is refused with no_valid_numbers.
Request
curl -X POST https://sms.rayenda.com/api/v1/sms/bulk \
  -H "Authorization: Bearer rs_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": ["8801712345678", "8801812345678", "01912345678"],
    "message": "We are open until 10 pm today.",
    "sender_id": "MyShop"
  }'
Response · 201
{
  "count": 2,
  "parts": 2,
  "cost": "1.10",
  "messages": [
    {
      "id": "SMS-4HXN8PQ2WK7D",
      "to": "8801712345678",
      "sender_id": "MyShop",
      "status": "queued",
      "parts": 1,
      "cost": "0.55"
    },
    {
      "id": "SMS-9TB3RZ6MCY5F",
      "to": "8801812345678",
      "sender_id": "MyShop",
      "status": "queued",
      "parts": 1,
      "cost": "0.55"
    }
  ],
  "rejected": [
    {
      "to": "01912345678",
      "code": "invalid_number",
      "message": "The number is not a valid phone number. Write it with its country code, for example 8801712345678."
    }
  ]
}
FieldDescription
countMessages that were accepted.
partsParts of all of them together.
costCredits charged for the request.
messagesOne entry for each accepted number, with the id to ask for it later.
rejectedThe numbers that were left out: to as you wrote it, an error code and a message. Empty when all went through.

Get a message

GET /api/v1/sms/{id}

What became of a message you sent, from the API or the panel. Delivery is not pushed to your server; ask with the ID.

Request
curl https://sms.rayenda.com/api/v1/sms/SMS-7KQ2M9XB4TRW \
  -H "Authorization: Bearer rs_live_YOUR_KEY"
Response · 200
{
  "id": "SMS-7KQ2M9XB4TRW",
  "status": "delivered",
  "to": "8801712345678",
  "sender_id": null,
  "message": "Your code is 4821",
  "encoding": "gsm",
  "parts": 1,
  "cost": "0.35",
  "refunded": false,
  "error": null,
  "created_at": "2026-10-06T09:15:02Z",
  "sent_at": "2026-10-06T09:15:03Z",
  "delivered_at": "2026-10-06T09:15:06Z",
  "failed_at": null
}
FieldTypeDescription
idstringThe ID of the message.
statusstringWhere the message is now. See statuses.
tostringThe number, in digits only.
sender_idstring or nullThe sender ID it went out under; null for a non-masking message.
messagestringThe text.
encodingstringgsm or unicode.
partsintegerParts the message was charged for.
coststringCredits charged.
refundedbooleanTrue when the message failed and its cost was given back.
errorstring or nullWhy the message failed.
created_atstringWhen the message was accepted.
sent_atstring or nullWhen the network took it.
delivered_atstring or nullWhen it arrived.
failed_atstring or nullWhen it failed.

Balance

GET /api/v1/balance
Request
curl https://sms.rayenda.com/api/v1/balance \
  -H "Authorization: Bearer rs_live_YOUR_KEY"
Response · 200
{
  "balance": "498.60",
  "expires_at": "2027-04-06T09:15:02Z",
  "package": "Standard"
}
FieldTypeDescription
balancestringCredits you can spend now.
expires_atstring or nullUntil when the credits are valid.
packagestring or nullThe package whose rates apply.

Phone numbers

  • Write every number with its country code, with or without the plus: 8801712345678 or +8801712345678. Spaces, dashes and brackets are fine.
  • A local number such as 01712345678 is refused with invalid_number. The country is never guessed.
  • You can send to the countries that are switched on under Countries. An open country you have not switched on is refused with country_not_enabled; a country we do not deliver to yet with country_not_available.

Parts and cost

A message is charged by the part. How much fits in a part depends on the characters in it.

EncodingUsed forOne partLonger messages
gsmEnglish letters, digits and common signs160 characters153 per part
unicodeBangla, Arabic, emoji and everything else70 characters67 per part

One character from outside the GSM alphabet makes the whole message unicode, and the limit drops from 160 to 70. An emoji does it, and so do the curly quotes (’ “ ”) and long dashes (–) that editors put in for you.

  • In a GSM message ^ { } [ ] ~ | \ € count as two characters; in a unicode message an emoji counts as two.
  • A line break counts as one character.
  • The longest message is 10 parts: 1,530 GSM or 670 unicode characters. A longer one is refused with message_too_long.
  • The cost is the parts times the rate of the number's country on your package; masking and non-masking have their own rates. The answer carries it in cost.
  • A message that fails gets its cost back, as long as your credits have not expired in the meantime; refunded says so.

Statuses

StatusMeaning
queuedAccepted and charged, on its way to the network.
sendingBeing handed to the network.
sentThe network took it; delivery is not confirmed yet.
deliveredIt arrived on the phone.
failedNot sent or not delivered. error has the reason.

Errors

Every error has the same shape. Let your program check the code, it never changes; the message is for the person reading the log.

Response · 402
{
  "error": {
    "code": "insufficient_credits",
    "message": "Not enough credits: this message costs 0.35."
  }
}
HTTPCodeWhen
401invalid_api_keyNo key was sent, or there is no such key.
401api_key_revokedThe key has been revoked.
403ip_not_allowedThe key is tied to a server IP and the request came from another address.
403account_suspendedThe account is suspended.
403account_not_verifiedThe account is not verified yet.
429rate_limitedMore than 600 requests in one minute with the same key.
422invalid_requestA field is missing or of the wrong type, or the message is empty.
403invalid_sender_idThe sender ID is not an approved one of your account.
422message_too_longThe message needs more than 10 parts.
422invalid_numberThe number is not a valid phone number with its country code.
422duplicate_numberBulk only: the number is in the list more than once.
403country_not_availableWe do not deliver to this country yet. The open countries are listed on the pricing page.
403country_not_enabledThe country is open, but not switched on for your account, or has no rate on your package.
422unsubscribedBulk only: the number asked you to stop and is on your unsubscribed list in Contacts. A single message through Send an SMS still goes.
422no_valid_numbersBulk only: none of the numbers can be sent to.
402insufficient_creditsNot enough credits for the whole request. Nothing is sent, nothing is charged.
404not_foundThere is no message with this ID, or no such address.
405method_not_allowedThe address does not take this method, a GET where a POST is needed for example.
403forbiddenThe request was refused for another reason; the message says why.
500server_errorSomething went wrong on our side. Try again in a moment; the message was not accepted.

Rate limit

Each key may make 600 requests a minute. Beyond that the answer is 429 with rate_limited, and the Retry-After header says how many seconds to wait. To reach many numbers, use Send to many: it is one request.