Skip to main content
The Hany SMS API gives you a simple, reliable way to send messages to any phone number — whether you’re triggering a single OTP from your backend or dispatching transactional alerts in real time. All requests authenticate with your Bearer API key and follow standard REST conventions.

Send a Single SMS

Make a POST request to /v1/sms/send with your recipient, Sender ID, and message body.
curl -X POST https://api.hany.tools/v1/sms/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": "+233XXXXXXXXX",
    "from": "YourBrand",
    "message": "Hello! Your order has been shipped."
  }'
Successful response:
{
  "status": "success",
  "message_id": "msg_abc123",
  "to": "+233XXXXXXXXX",
  "from": "YourBrand",
  "credits_used": 1,
  "credits_remaining": 4999
}

Request Parameters

to
string
required
The recipient’s phone number in E.164 format (e.g. +233XXXXXXXXX). Always include the country code prefixed with +. Do not use spaces, dashes, or parentheses.
from
string
required
Your registered and approved Sender ID (e.g. YourBrand). The Sender ID must exist in your account with approved status before use.
message
string
required
The text content of your SMS. Standard messages support up to 160 characters per segment. Messages longer than 160 characters are automatically split into multiple segments and charged accordingly.
callback_url
string
An optional HTTPS URL on your server where Hany will POST delivery status updates (webhooks). Use this to track whether a message was delivered, failed, or is still pending.

Message Length and Segments

Understanding segments helps you control costs and message formatting:
  • Standard SMS — Up to 160 characters per segment. A 160-character message uses 1 credit.
  • Long SMS — Messages over 160 characters are split into segments of up to 153 characters each (the remaining characters carry concatenation headers). A 300-character message uses 2 credits.
  • Unicode SMS — Messages containing Unicode characters (e.g. emojis, Arabic, Chinese) are limited to 70 characters per segment, or 67 characters per segment for multi-part Unicode messages.
  • Credits charged per segment — Each segment consumes 1 credit (GHS 0.02). Keep messages concise to stay efficient.
Always use E.164 format for phone numbers: a + sign followed by the country code and subscriber number with no spaces or separators. For Ghana, this looks like +233XXXXXXXXX.

Code Examples

const response = await fetch("https://api.hany.tools/v1/sms/send", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    to: "+233XXXXXXXXX",
    from: "YourBrand",
    message: "Hello! Your order has been shipped.",
  }),
});

const data = await response.json();
console.log(data);

Response Fields

status
string
The result of the request. "success" indicates the message was accepted and queued for delivery. On failure, this will be "error" and an error field will describe the issue.
message_id
string
A unique identifier for this message (e.g. msg_abc123). Use this ID to look up delivery status or reference the message in support queries.
to
string
The recipient phone number as provided in the request, in E.164 format.
from
string
The Sender ID used for this message, as provided in the request.
credits_used
integer
The number of credits deducted for this message. This equals the number of SMS segments the message was split into.
credits_remaining
integer
Your remaining credit balance after this message was sent. Monitor this field to avoid running low before a critical send.