Send SMS

Required: sender_id, plus to or recipients (1–100 numbers), plus message or template_id. Optional: scheduled_at, variables, client_reference, callback_url, metadata. sender_id is 3–11 characters. Use GET /v1/lookup?to= for a prefix network estimate (not HLR).

POST /v1/messages
POST /v1/messages
Authorization: Bearer sms_test_...
Idempotency-Key: 8f14e45f-ceea-467c-9daa-6e4d999bac48
Content-Type: application/json

{
  "to": "+233200000001",
  "sender_id": "TAYSEND",
  "message": "Your verification code is 482193",
  "type": "otp"
}
@taysend/sdk
import { SmsClient, isBulkSend } from "@taysend/sdk";

const sms = new SmsClient({ apiKey: process.env.TAYSEND_KEY!, baseUrl: process.env.API_URL });

await sms.messages.send({
  recipients: ["+233244000001", "+233201234567"],
  senderId: "TAYSEND",
  templateId: "tpl_01...",
  variables: { order_id: "TS-18429" },
});

const check = await sms.lookup("+233244123456");
// check.estimated_network is a prefix guess, not HLR

Same Idempotency-Key + same body replays the original response. Same key + different body returns 409 IDEMPOTENCY_CONFLICT. Batch send is POST /v1/messages/batch.