Developers
Quickstart
About five minutes from sign-up to your first SMS and your first webhook. You need an Android phone with a SIM that can send SMS, and a terminal. Want to try the API before you have a phone at hand? Use a test key in step 3: nothing reaches a phone, and you still get the same responses and webhooks.
Step 1: Create an account
about 1 minuteSign up with your email, then enter the code we email you to confirm the address. The free plan is enough for everything on this page.
Step 2: Connect a phone
about 2 minutesOn the Android phone, install the SMSNET Gateway app from Google Play (the link is on Get the app). A phone without Google Play can use the signed APK on the same page; Android then asks you to allow installs from that source once.
Open the app and sign in with the same email and password you used in step 1. There is no code to scan: the phone attaches itself to your account, and its SIM appears under Numbers in the dashboard within a few seconds. Allow the SMS permission and keep the app running. On a dual SIM phone both lines show up.
Step 3: Create an API key
about 30 secondsIn the dashboard open Developers, then New key. Give it the send and read scopes for this guide (add manage if you will create the webhook endpoint from code in step 5). The full key is shown once; copy it and keep it out of browser code and out of version control.
sn_live_...sends real SMS through your phone.sn_test_...never reaches a phone. Its messages move todeliveredin about two seconds, fire the same webhooks and do not count against your plan. Good for CI and for trying this page first.
export SMSNET_API_KEY="sn_live_..."Step 4: Send an SMS
about 30 secondsPut your own mobile number in to (E.164, with the country code). The Idempotency-Key header makes a retry safe: the same key with the same body never sends twice.
curl -X POST https://smsnet.net/api/v1/messages/send \
-H "X-API-Key: $SMSNET_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: quickstart-1" \
-d '{"to":"+972501234567","body":"Hello from SMSNET"}'// Node 18+, no package needed
const res = await fetch("https://smsnet.net/api/v1/messages/send", {
method: "POST",
headers: {
"X-API-Key": process.env.SMSNET_API_KEY,
"Content-Type": "application/json",
"Idempotency-Key": "quickstart-1",
},
body: JSON.stringify({ to: "+972501234567", body: "Hello from SMSNET" }),
});
const data = await res.json();
if (!res.ok) throw new Error(`${data.code}: ${data.message} (${data.docs_url})`);
console.log(data.message_id, data.status);# Python 3.8+, standard library only
import json, os, urllib.request
req = urllib.request.Request(
"https://smsnet.net/api/v1/messages/send",
data=json.dumps({"to": "+972501234567", "body": "Hello from SMSNET"}).encode(),
headers={
"X-API-Key": os.environ["SMSNET_API_KEY"],
"Content-Type": "application/json",
"Idempotency-Key": "quickstart-1",
},
method="POST",
)
with urllib.request.urlopen(req) as r:
print(json.load(r)["message_id"])The answer has a message_id and status: "pending". The phone picks the message up and sends it; new lines warm up gradually, so the first sends are paced. If something is wrong you get an error with a code, a human message and a docs_url that points at its entry in the error reference.
Official SDKs for JavaScript and Python wrap the same calls (sms.messages.send(...)) with retries and automatic idempotency keys. They are not on npm or PyPI yet, so the examples here use plain HTTP, which works today.
Step 5: Receive and verify a webhook
about 1 minuteA webhook endpoint is a public HTTPS URL that SMSNET POSTs events to: message.received for replies, message.status for sent, delivered and failed. For a local server, expose it with a tunnel such as cloudflared or ngrok.
Add the endpoint in Developers under Webhook endpoints, or from code with a manage key. Either way the answer shows its whsec_ signing secret once. Then send it a test event:
curl -X POST https://smsnet.net/api/v1/webhooks/endpoints \
-H "X-API-Key: $SMSNET_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com/smsnet","events":["message.received","message.status"]}'
# The answer holds "secret": "whsec_..." once. Store it now.
curl -X POST https://smsnet.net/api/v1/webhooks/endpoints/$ENDPOINT_ID/test \
-H "X-API-Key: $SMSNET_API_KEY"Every delivery is signed with Standard Webhooks headers: webhook-id, webhook-timestamp (seconds) and webhook-signature (v1, plus the base64 HMAC-SHA256 of id.timestamp.body). The HMAC key is the base64-decoded part of the secret after whsec_. Check it before you trust the body:
// Express. Keep the raw body: re-serialised JSON will not match the signature.
import crypto from "node:crypto";
import express from "express";
const secret = process.env.SMSNET_WEBHOOK_SECRET; // "whsec_..."
const key = Buffer.from(secret.slice("whsec_".length), "base64");
const app = express();
app.post("/smsnet", express.raw({ type: "application/json" }), (req, res) => {
const id = req.header("webhook-id");
const ts = req.header("webhook-timestamp");
if (!id || Math.abs(Date.now() / 1000 - Number(ts)) > 300) return res.sendStatus(400);
const expected = crypto.createHmac("sha256", key)
.update(`${id}.${ts}.${req.body}`).digest("base64");
// Up to two signatures ("v1,<new> v1,<old>") for 24 hours after a rotation.
const ok = (req.header("webhook-signature") || "").split(" ").some((s) => {
const sig = Buffer.from(s.split(",")[1] || "");
return sig.length === expected.length && crypto.timingSafeEqual(sig, Buffer.from(expected));
});
if (!ok) return res.sendStatus(400);
const event = JSON.parse(req.body);
if (event.type === "message.received") console.log(event.data.from, event.data.body);
res.sendStatus(200);
});
app.listen(3000);# Flask. request.get_data() is the raw body.
import base64, hashlib, hmac, json, os, time
from flask import Flask, request
secret = os.environ["SMSNET_WEBHOOK_SECRET"] # "whsec_..."
key = base64.b64decode(secret[len("whsec_"):])
app = Flask(__name__)
@app.post("/smsnet")
def smsnet():
msg_id = request.headers.get("webhook-id", "")
ts = request.headers.get("webhook-timestamp", "0")
if not msg_id or abs(time.time() - int(ts)) > 300:
return "", 400
body = request.get_data()
expected = base64.b64encode(
hmac.new(key, f"{msg_id}.{ts}.".encode() + body, hashlib.sha256).digest()
).decode()
sigs = [s.split(",", 1)[-1] for s in request.headers.get("webhook-signature", "").split(" ")]
if not any(hmac.compare_digest(s, expected) for s in sigs):
return "", 400
event = json.loads(body)
if event["type"] == "message.received":
print(event["data"]["from"], event["data"]["body"])
return "", 200Answer with any 2xx within a few seconds. Anything else is retried for about three days (5 s, 5 m, 30 m, 2 h and so on), then marked failed and replayable from the dashboard. The standardwebhooks library accepts the whsec_ secret as it is, if you would rather not write the check yourself.
Now reply to your own SMS from your mobile. The reply arrives as message.received with data.from and data.body.
Next steps
- Error codes: every
codethe API returns, what it means and how to fix it. - MCP server: let an AI agent send and read SMS through your lines, with your approval.
- OpenAPI document (and llms-full.txt for LLMs): every endpoint, field and webhook payload, with curl, JavaScript and Python samples.
- Carrier limits and service status.