Skip to main content
Use the SMS API to send any text message — order updates, alerts, or your own one-time codes. For verification codes, Verify is usually simpler: it generates and checks the code for you.

Sender IDs

Every SMS is sent from an alphanumeric sender ID, such as Acme, that appears as the sender on your user’s phone. You need at least one approved sender ID before you can send. A sender ID has 3–11 letters and digits, with at least one letter. No spaces or symbols.
1

Request a sender ID

In the dashboard, open Messaging → SMS and click Add sender ID. Enter the sender ID and the website or app it’s for.
2

Wait for approval

The sender ID starts as pending. Once it’s approved, you can send from it.
3

Set a default (optional)

Pick a Default sender ID in SMS settings. Requests without from use it.
from is matched without regard to case, and the message goes out with the casing you registered.

Send an SMS

The API responds right away with 201 and status queued. Delivery happens in the background.

Message status

If the carrier call fails, OTPBay retries up to 5 times with exponential backoff. Follow the status with Get an SMS, or set a callback to receive a webhook on sent and failed.
sent means the carrier accepted the message. It doesn’t confirm the message reached the handset.

Segments and encoding

Carriers split long messages into segments, and each segment is billed. The segment size depends on the characters in body: A single emoji or accented letter switches the whole message to the smaller size. The response shows the count in sms_segments.

Pricing

SMS is priced per segment by destination network. OTPBay identifies the network from the phone number; if it can’t, it charges the highest price in that country. See the current prices in Billing → Pricing in the dashboard.
  • cost in the response is the quoted price: per-segment price × sms_segments.
  • Your balance must cover cost when you send, or the request fails with 402 INSUFFICIENT_BALANCE.
  • The charge is taken when the message is handed to the carrier. If delivery fails after all retries, it’s refunded.
  • A destination with no price fails with 422 DESTINATION_NOT_PRICED.

Common errors

See Errors for the full list.