Developers
A small, predictable SMS API.
JSON in, JSON out. Clear error codes, safe retries with idempotency keys, and signed webhooks for delivery updates. API keys are created from your dashboard once your account is active.
Send a message
Authenticate with your API key as a Bearer token. Numbers can be local Egyptian numbers or international format. Duplicates and invalid numbers are removed and reported back; blacklisted numbers are skipped and not charged.
Add an Idempotency-Key header (for example your order ID). If your request times out and you retry with the same key, we return the original result instead of sending again.
const res = await fetch("https://trasloeg.com/v1/sms/send", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.TARSLO_API_KEY}`,
"Content-Type": "application/json",
"Idempotency-Key": order.id, // safe to retry
},
body: JSON.stringify({
to: ["201001234567"],
sender_id: "MyBrand",
message: "Your code is 482913",
}),
});
const { success, data, error } = await res.json();{
"success": true,
"data": {
"campaignId": "8c1f…",
"accepted": 1,
"pending": 0,
"failed": 0,
"skipped": 0,
"segments": 1,
"encoding": "GSM7",
"unitsCharged": 1
}
}Endpoints
| POST | /v1/sms/send | Send one message to one or many numbers |
| GET | /v1/messages/:id | Status of a single message |
| GET | /v1/messages | List messages with filters and cursor pagination |
| GET | /v1/campaigns/:id | Campaign status with counts per status |
| GET | /v1/balance | Your remaining SMS units |
| GET | /v1/sender-ids | Sender IDs assigned to your account |
Error codes
Every error has the same shape: { success: false, error: { code, message } }.
- UNAUTHORIZED
- Missing or invalid API key
- ACCOUNT_PENDING
- Account not activated yet
- SENDER_ID_NOT_ALLOWED
- Sender ID is not assigned to you
- INVALID_PHONE
- No valid numbers in the request
- INSUFFICIENT_BALANCE
- Not enough SMS units
- DAILY_LIMIT_REACHED
- Daily sending limit reached
- CONTENT_BLOCKED
- Message contains blocked content
- RATE_LIMITED
- Too many requests, slow down
- UPSTREAM_ERROR
- Message could not be sent, try again
Delivery webhooks
Set a webhook URL in your settings and we will POST every status change: delivered, failed, expired and more. Each request carries an X-Traslo-Signature header, an HMAC-SHA256 of the raw body with your webhook secret.
import crypto from "node:crypto";
export function verify(rawBody, signature, secret) {
const expected = crypto.createHmac("sha256", secret).update(rawBody).digest("hex");
return crypto.timingSafeEqual(Buffer.from(expected), Buffer.from(signature));
}