Messages
Send an SMS
One call, one message. GetSMS picks a Moroccan number from the fleet, sends the SMS and reports its statuses back to you by webhook.
POST
/v1/messages/sendx-api-key · charged per segmentRequest
Section titled “Request”tostringrequiredRecipient number in international format, for example
+212612345678.contentstringrequiredMessage text, up to 2,048 characters. One SMS holds 160 characters (70 with special accents or Arabic); longer text is split and each part is charged.
fromstringSending number, from your numbers. Without it, GetSMS picks a number from the fleet, always the same one for a given recipient.
request_idstringYour own identifier (up to 255 characters), returned in the message and its events. Useful to link an SMS to an order or a case. It also prevents double sends: the same
request_id to the same recipient within 24 h returns the first message, neither sent nor charged again (409 if the text differs).send_atISO 8601 dateScheduled send, up to 20 days in the future.
sender_idstringsoonApproved sender name, up to 11 characters. See Sender name.
curl -X POST https://api.getsms.tech/v1/messages/send \ -H "x-api-key: $GETSMS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"to": "+212612345678", "content": "Your code is 482913"}'const res = await fetch("https://api.getsms.tech/v1/messages/send", { method: "POST", headers: { "x-api-key": process.env.GETSMS_API_KEY, "Content-Type": "application/json" }, body: JSON.stringify({ to: "+212612345678", content: "Your code is 482913" }),});const { data } = await res.json();import os, requests
res = requests.post( "https://api.getsms.tech/v1/messages/send", headers={"x-api-key": os.environ["GETSMS_API_KEY"]}, json={"to": "+212612345678", "content": "Your code is 482913"},)data = res.json()["data"]<?php$ch = curl_init("https://api.getsms.tech/v1/messages/send");curl_setopt_array($ch, [ CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => ["x-api-key: " . getenv("GETSMS_API_KEY"), "Content-Type: application/json"], CURLOPT_POSTFIELDS => json_encode(["to" => "+212612345678", "content" => "Your code is 482913"]),]);$data = json_decode(curl_exec($ch), true)["data"];Response
Section titled “Response”iduuidMessage ID. Keep it to retrieve the message.
statusstringpending on creation: the message is queued. See statuses.ownerstringThe fleet number that sends it.
contactstringThe recipient.
request_idstringYour identifier, if you provided one.
{ "status": "success", "message": "message added to queue", "data": { "id": "32343a19-da5e-4b1b-a767-3298a73703cb", "request_id": "commande-8841", "owner": "+212661234501", "contact": "+212612345678", "status": "pending", "send_attempt_count": 0, "max_send_attempts": 2, "request_received_at": "2026-11-10T09:12:03Z" }}{ "status": "error", "code": "insufficient_credit", "message": "crédit insuffisant : cet envoi coûte 0,36 DH HT et votre solde est de 0,12 DH ; achetez un pack dans Facturation", "data": { "balance": 120, "required": 360, "unit_price": 180 }}{ "status": "error", "message": "validation errors while sending message", "data": { "to": ["The to field must contain only digits and must be less than 14 characters"] }}The full response also includes the other timestamps (scheduled_at, sent_at, delivered_at, failed_at, expired_at). Amounts in the 402 response are in thousandths of a dirham, see Credits and billing.