Quickstart
You need your AccountSid and AuthToken from the console, and a line on your account. The examples use the made-up numbers +61491570156 (your line) and +61491570157 (the person you're texting or calling).
Before you start
- The base URL is
https://api.dongleswithwings.com/2010-04-01. Every path in these docs is relative to it. - Credentials: your AccountSid and AuthToken, or an API key, as HTTP Basic auth (see Authentication).
Fromis always your line's own number. Any other number is 21606.- One call at a time: your line is one SIM in one dongle. A second call while one is up is refused with 700001 at once, never queued.
- Answer incoming calls within 8 seconds, or the call rings on into the SIM's voicemail. Answer with TwiML first, and do any slow work after.
- Texts end at
sentfor now: don't wait fordelivered(see How a dongle line behaves).
Send a text
curl -X POST "https://api.dongleswithwings.com/2010-04-01/Accounts/$ACCOUNT_SID/Messages.json" \
--data-urlencode "To=+61491570157" \
--data-urlencode "From=+61491570156" \
--data-urlencode "Body=Hello from my own SIM" \
-u "$ACCOUNT_SID:$AUTH_TOKEN"
const sid = process.env.ACCOUNT_SID, token = process.env.AUTH_TOKEN;
const res = await fetch(`https://api.dongleswithwings.com/2010-04-01/Accounts/${sid}/Messages.json`, {
method: "POST",
headers: { Authorization: "Basic " + Buffer.from(`${sid}:${token}`).toString("base64") },
body: new URLSearchParams({ To: "+61491570157", From: "+61491570156", Body: "Hello from my own SIM" }),
});
console.log(res.status, await res.json());
import os, requests
sid, token = os.environ["ACCOUNT_SID"], os.environ["AUTH_TOKEN"]
r = requests.post(f"https://api.dongleswithwings.com/2010-04-01/Accounts/{sid}/Messages.json",
data={"To": "+61491570157", "From": "+61491570156", "Body": "Hello from my own SIM"},
auth=(sid, token), timeout=30)
print(r.status_code, r.json())
The answer is 201 with the Message, status queued. From must be your line's own number, or the answer is
21606.
Place a call
curl -X POST "https://api.dongleswithwings.com/2010-04-01/Accounts/$ACCOUNT_SID/Calls.json" \
--data-urlencode "To=+61491570157" \
--data-urlencode "From=+61491570156" \
--data-urlencode "Twiml=<Response><Play>https://example.com/hello.mp3</Play></Response>" \
-u "$ACCOUNT_SID:$AUTH_TOKEN"
The answer is 201 with the Call, status queued. Its TwiML runs once the call is answered.
Receive calls and texts
Set your line's VoiceUrl and SmsUrl (see Phone numbers). We POST each incoming call
or text there; your answer is TwiML. See Webhooks, and check every request's signature.