Skip to content

Send SMS from your own code in five minutes

A short example of sending SMS through a REST API with curl, Python or PHP.

All you need is an API key and one HTTP call. Create a free account, make a key under API keys, and send:

curl

curl -X POST https://jasms.dk/api/v1/send \
  -H "X-Api-Key: PUBLIC:SECRET" -H "Content-Type: application/json" \
  -d '{"to": "+4512345678", "body": "Your code is 482913", "sender": "MyApp"}'

Python

import httpx
r = httpx.post("https://jasms.dk/api/v1/send",
    headers={"X-Api-Key": "PUBLIC:SECRET"},
    json={"to": "+4512345678", "body": "Hello from Python"})
print(r.json())

PHP

$ch = curl_init("https://jasms.dk/api/v1/send");
curl_setopt_array($ch, [CURLOPT_POST => true, CURLOPT_RETURNTRANSFER => true,
  CURLOPT_HTTPHEADER => ["X-Api-Key: PUBLIC:SECRET", "Content-Type: application/json"],
  CURLOPT_POSTFIELDS => json_encode(["to" => "+4512345678", "body" => "Hello from PHP"])]);
echo curl_exec($ch);

Next steps

  • Send an Idempotency-Key header so a retried call never sends twice.
  • Subscribe to webhooks for sms.delivered and sms.received.
  • For login codes use /api/v1/verify/start and /verify/check — we generate and check the code.
Ready to send your first SMS?
Create an account for free. You only pay when you send.

More guides