Skip to main content

API Reference

Every method available on the SendLime client.

Messages

messages.send(params)

Send an SMS or WhatsApp message. Supports bulk recipients and scheduling.

ParameterTypeRequiredDescription
tostring \| string[]YesRecipient number(s). Bulk is SMS-only.
messagestringYesMessage body.
channel"sms" \| "whatsapp"NoDelivery channel. Default: "sms".
brand_idstringNoSender brand ID. Auto-resolved if omitted.
schedule_timestringNoISO 8601 datetime. SMS-only.

Returns: SendMessageResponse

const result = await sendlime.messages.send({
to: "+8801XXXXXXXXX",
message: "Hello!",
channel: "sms",
});
// result.gateway_id, result.messages, result.credits_remaining

messages.list(params?)

List messages with pagination.

ParameterTypeRequiredDescription
limitnumberNoResults per page.
pagenumberNoPage number.
fromstringNoFilter by sender.
tostringNoFilter by recipient.

Returns: { data: MessageListItem[], pagination: Pagination }

messages.get(id)

Get a single message by ID with delivery sync status.

Returns: { data: MessageDetail, delivery_sync: DeliverySync }


Batches

batches.get(id)

Get batch status with per-message breakdown.

Returns: BatchDetail with fields: batch_id, total, accepted, pending, delivered, failed, unknown, total_cost, messages.


Account

balance.get()

Returns current balance and currency.

const { balance, currency } = await sendlime.balance.get();
// { balance: 150.50, currency: "BDT" }

senders.list()

List all approved senders (SMS masking/non-masking and WhatsApp profiles).

Returns: Sender[] with fields: id, brand_id, channel, type, sender, label, is_default, is_usable, status, subscription.

pricing.get(params?)

Get per-channel pricing, optionally filtered by country.

ParameterTypeRequiredDescription
countrystringNoISO country code (e.g. "BD").

Returns: PricingEntry[] with fields: channel, country, price, currency, unit.


Verify

verify.sendCode(params)

Send an OTP verification code via SMS or WhatsApp.

ParameterTypeRequiredDescription
phone_numberstringYesRecipient phone number in E.164 format.
channel"sms" \| "whatsapp"NoDelivery channel. Default: "sms".
code_lengthnumberNoDigits in OTP code (4-10). Default: 6.
expirynumberNoSeconds until expiry (60-3600). Default: 300.
locale"en-us" \| "bn-bd"NoMessage language. Default: "en-us".
brand_idstringNoSender brand ID.

Returns: SendCodeResponse

const { request_id, expires_in } = await sendlime.verify.sendCode({
phone_number: "+8801XXXXXXXXX",
channel: "sms",
});

verify.checkCode(params)

Verify an OTP code against a pending request.

ParameterTypeRequiredDescription
request_idstringYesThe request ID from sendCode().
codestringYesThe code the user entered.

Returns: CheckCodeResponse

const result = await sendlime.verify.checkCode({
request_id: "vrf_abc123...",
code: "483921",
});
// result.status === "verified"

Webhooks

webhooks.listLogs(params?)

List webhook delivery logs.

ParameterTypeRequiredDescription
limitnumberNoResults per page.
pagenumberNoPage number.
statusstringNo"succeeded" or "failed".
message_idstringNoFilter by message ID.

Returns: { data: WebhookLog[], pagination: Pagination }

webhooks.retryLog(id)

Retry a failed webhook delivery.

Returns: RetryWebhookResponse