SMS API for developers

Send SMS from code with one HTTPS request

NS SMS is an SMS gateway API that uses your own Android phone. Your app calls the REST SMS API, our server passes the message to your phone, and the phone sends it from its SIM card. You get the message ID, the delivery status and, on every plan, a signed webhook for every status change.

Your app → SMS API → Your Android phone → Recipient

Get your SMS API key in two minutes

No account, email or password. The phone registers itself and shows your API key in the app.

  1. Install NS SMS from Google Play and set it as the default SMS app.
  2. Open the API tab and turn on "Accept API requests".
  3. Copy your phone ID (device_id) and API key. Keep the key secret, like a password.
  4. Send your first SMS with one of the examples below.

SMS API endpoints

POST /v1/sms/send Send an SMS now, at a set time (send_at) or on a repeating schedule (repeat), to one number or to a list of up to 100.
GET /v1/sms List your messages, newest first, filtered by status or batch, with cursor paging.
GET /v1/sms/{id} Get the status of a message: accepted, received, sent, delivered, failed, cancelled or expired.
DELETE /v1/sms/{id} Cancel a message that has not been sent yet, including a repeating schedule.
GET /v1/devices/{device_id} Check whether your phone is online and has the API turned on.

Full OpenAPI reference →

SMS API examples

Endpoint: POST /v1/sms/send Rate limit: 30/min

Send an SMS · Send SMS from cURL

send.sh
curl -X POST https://sms-api.n-soft.pl/v1/sms/send \
  -H "Authorization: Bearer $NS_SMS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"device_id":"'"$NS_SMS_DEVICE_ID"'","to":"+14155550123","text":"Your code is 4821"}'

# 202 Accepted
# {"id":"01JDX4K8Q2M3N4P5R6S7T8V9W0","status":"accepted"}

# Delivery status
curl https://sms-api.n-soft.pl/v1/sms/01JDX4K8Q2M3N4P5R6S7T8V9W0 \
  -H "Authorization: Bearer $NS_SMS_API_KEY"

Verify a webhook

webhook
# $BODY is the raw request body, $SIGNATURE the X-Signature header
EXPECTED="sha256=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$NS_SMS_WEBHOOK_SECRET" | sed 's/^.* //')"
[ "$EXPECTED" = "$SIGNATURE" ] && echo "valid" || echo "invalid"

Scheduled and repeating SMS

Add send_at (ISO 8601 with a time zone) to send later, and repeat to send daily, weekly or monthly until a date or a number of runs. The phone keeps the schedule, so the text goes out on time even without internet.

Webhooks for delivery status

On every plan, set a webhook address in the app (API tab). Every status change is POSTed to it as JSON, plus alerts when the phone goes offline and when 80% of the monthly quota is used. Each request is signed: X-NS-Signature carries a timestamp and an HMAC-SHA256, so old requests cannot be replayed. Answer with any 2xx code; failed deliveries are retried 8 times over about 20 hours.

Limits that protect your SIM card

Carriers block SIM cards that send too many texts too fast. Each plan has a daily cap (50, 500 or 1,000 SMS a day) on top of the monthly volume, and the API answers 429 when a cap is reached. For transactional texts such as reminders, notifications and codes this is plenty; for bulk marketing use a classic SMS provider.

SMS API error codes

When an SMS fails, the status shows error_code plus error.message and error.docs_url pointing here.

no_service The phone had no mobile signal when sending. Check coverage or move the phone, then send again.
radio_off The mobile radio was off (airplane mode). Turn airplane mode off.
limit_exceeded Android refused to send more texts for now (its own sending limit). Slow down or wait a few minutes.
generic_failure The carrier or the SIM card rejected the message. Check the recipient number, the SIM balance and whether the SIM can send SMS.
short_code_not_allowed Android blocked a text to a short code (premium number). Allow it in the phone settings or use a regular number.
null_pdu The message could not be encoded. Remove unusual characters and try again.
send_error The app could not hand the message to Android. Make sure NS SMS is the default SMS app.
no_permission NS SMS is not the default SMS app or lacks the SMS permission. Open the app and follow the prompts.
daily_limit The phone reached the daily limit of your plan. The counter resets at midnight.
stale The order reached the phone too late (more than 24 hours after it was sent) and was dropped.
missed The scheduled time passed while the phone was off or asleep for too long, so the message was skipped.
not_received The phone did not pick up the order within 24 hours (offline or the API is turned off), so it expired.
unknown An unexpected error reported by the phone. Contact us with the message id if it repeats.

Step-by-step SMS API guides

SMS API pricing →

Send SMS from the tools you already use

Every integration below is a plain HTTPS request to the NS SMS API, so it works without a plugin or an extra account. The text goes out from your own Android phone and SIM card. Pick your tool and copy the configuration.

Integrations → Use cases →