SMS API
one integration, five countries

Send SMS from your own app, website or backend with a plain REST API. One endpoint covers Malaysia, Singapore, Hong Kong, South Korea and Japan; you pay per segment from a prepaid balance, with no monthly fee and no contract.

What the API does

It is one REST endpoint for all five countries. Add country to the request (MY, SG, HK, KR or JP); leave it out and the message goes to Malaysia. Each request can carry up to 10,000 numbers, and send_at schedules it anywhere from 2 minutes to 30 days ahead.

We built it around the problems we kept seeing in SMS integrations. A request that times out can be repeated safely with the same Idempotency-Key, so nobody gets the message twice and you are not charged twice. Every number has its own status instead of a single "sent" total. Status changes can be pushed to your server by webhook, and money always comes back as whole cents, never as a floating-point ringgit amount.

The API itself is free. You pay per segment from a prepaid balance, at the same price as the web console.

Quick start

curl https://hantarsms.com/api/v1/messages \
  -H "X-API-Key: $HANTARSMS_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "country": "HK",
    "to": ["91234567"],
    "text": "Your order has shipped."
  }'

A successful send returns 201 Created with the message id, the segment count and the cost in cents.

Python, Node.js and PHP

import os, requests

r = requests.post(
    "https://hantarsms.com/api/v1/messages",
    headers={"X-API-Key": os.environ["HANTARSMS_KEY"],
             "Idempotency-Key": f"order-{order_id}"},
    json={"country": "SG", "to": ["91234567"],
          "text": f"Your order #{order_id} has shipped."},
    timeout=30,
)
print(r.status_code, r.json())
// Node 18+
const res = await fetch('https://hantarsms.com/api/v1/messages', {
  method: 'POST',
  headers: {
    'X-API-Key': process.env.HANTARSMS_KEY,
    'Content-Type': 'application/json',
    'Idempotency-Key': `order-${orderId}`,
  },
  body: JSON.stringify({ country: 'JP', to: ['09012345678'], text: 'Your order has shipped.' }),
});
console.log(res.status, await res.json());
$ch = curl_init('https://hantarsms.com/api/v1/messages');
curl_setopt_array($ch, [
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_POST => true,
  CURLOPT_HTTPHEADER => [
    'X-API-Key: ' . getenv('HANTARSMS_KEY'),
    'Content-Type: application/json',
    'Idempotency-Key: order-' . $orderId,
  ],
  CURLOPT_POSTFIELDS => json_encode([
    'to' => ['60123456789'], 'text' => 'Your order has shipped.',
  ]),
]);
$res = json_decode(curl_exec($ch), true);

Java, error handling and every field are in the full API documentation. Using WordPress? The free HantarSMS plugin needs no code.

Endpoints

Method and pathWhat it does
POST /api/v1/messagesSend or schedule a message to up to 10,000 numbers
GET /api/v1/messages/{id}Status and delivery counters of one send
GET /api/v1/messages/{id}/recipientsPer-number delivery status
GET /api/v1/messagesList your sends
GET /api/v1/countriesCountries, prices, sending hours and sender IDs for your account
GET /api/v1/balanceCurrent balance in cents

Countries and prices

CountrycountryNumber examplePrice per segment
MalaysiaMY (default)0123456789from RM0.20
SingaporeSG91234567RM0.45
Hong KongHK91234567RM0.38
South KoreaKR01012345678RM0.085
JapanJP09012345678RM0.365

About 0.05, 0.112, 0.095, 0.021 and 0.091 USDT respectively at 1 USDT = RM4.01. Numbers can also be sent with the country code. Hong Kong lets you pick a sender from a list; Singapore sends 10:00–19:00 (UTC+8) and holds later requests until the next morning. Details on international SMS.

What developers build with it

Webhooks and signatures

Set an HTTPS URL under API keys and we POST message.updated and message.completed events. Each request carries an X-HantarSMS-Signature header like t=1731315879,v1=…: compute HMAC-SHA256 of t + "." + raw body with your signing secret, compare it to v1 and reject anything older than 5 minutes. Reply 2xx within 8 seconds; failures are retried after 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours with the same event id.

Errors to handle

HTTPCodeWhat to do
400invalid_parameter, missing_parameterFix the request; nothing was sent
401invalid_api_key, revoked_api_keyCheck the key
402insufficient_balanceTop up, then retry with the same Idempotency-Key
409idempotency_key_in_progressRetry in a few seconds
422no_valid_recipients, content_blocked, unsupported_countryFix numbers, text or country
429rate_limit_exceededWait for Retry-After, or batch more numbers per request

How we test a route before it goes live

We do not connect a route on the supplier's word. We put local SIM cards from the destination country into our own phones, send test traffic through the route and count the messages that actually show up on those phones. The supplier's delivery report is not part of that count.

In Malaysia we have sent well over 10,000 test messages this way. Singapore, Hong Kong, South Korea and Japan each received at least 1,000 before they opened in November 2026. A route goes live only if 90% or more of the test messages arrive. Some cheaper routes missed that mark and we turned them down, which is the main reason a few of our prices sit a little above the lowest quotes you will find.

If the delivery reports are wrong

If a route marks messages as delivered when they never arrived, or a large part of a send goes missing for a reason other than the carrier filtering your content, we refund the whole send. Send us the order ID and we will check it on our test phones and with the supplier.

We have done this before. A WhatsApp supplier we used to work with was reporting messages as delivered when they were not. By the time we caught it, one customer had spent about 1,300 USDT on those sends. We dropped the supplier that day and paid the customer back in full.

Which industries we accept

We decide by the message, not by the industry. Before your first large send, tell us what you plan to send, where the numbers came from and how people can opt out. If the content is legal and the people on your list agreed to hear from you, we take it, including many industries that other providers refuse outright.

Usually accepted after a quick checkNever accepted
Lending and instalmentsScams or anything meant to mislead
Forex and investmentImpersonating banks, government or other companies
CryptoBought, scraped or unknown lists
Supplements and beautyMarketing with no way to opt out
Debt collection, property, e-commerce, education

The same rule applies in all five countries, and most of our routes accept messages with links. Every send is logged with the number, content and time, and we answer requests from law enforcement.

Billing rules your code should know

Frequently asked questions

Do I need a company in Malaysia to use the API?

No. Anyone can sign up with an email address or a Google account and create an API key. Top up with USDT (TRC20) or a Visa/Mastercard card.

How much does the API cost?

The same as sending from the web console: Malaysia from RM0.20 per segment (lower with volume), Singapore RM0.45, Hong Kong RM0.38, South Korea RM0.085, Japan RM0.365. There is no fee for the API itself.

Is there a sandbox?

There is no separate sandbox. Send a real message to your own phone from a new account; it costs one segment at the normal price.

How many numbers can one request carry?

Up to 10,000 numbers per request, all for one country. Duplicates are removed and charged once, and invalid numbers are dropped and never charged.

How do I avoid double charges when retrying?

Send an Idempotency-Key header. Retrying the same request with the same key returns the original response and never sends or charges again. Keys are kept for 24 hours.

How do I get delivery status?

Poll GET /api/v1/messages/{id} or /recipients for per-number results, or set a webhook URL and we POST message.updated and message.completed events to you.

What are the rate limits?

60 send requests per minute per key by default, 300 per minute for reads. OTP traffic that cannot be batched can have its limit raised.

Can I use the API for OTP codes?

Yes. A request with three numbers or fewer and no schedule skips the batch queue and goes to the carrier straight away.

Which languages and frameworks are supported?

Any that can send an HTTPS request with JSON. The documentation has PHP, Python, Node.js and Java examples, and WordPress sites can use the free plugin.

How do I check my balance from code?

GET /api/v1/balance returns the balance in cents, your current rate and how many single-segment Malaysian SMS it covers.

Can I send to several countries in one request?

No. One request sends to one country; make one request per country.

Written by the HantarSMS team in Malaysia. Prices and facts checked on 13 November 2026.