A REST API built for simplicity.
Send a single message, run a campaign, check balance, or hook inbound replies into your stack — all over HTTPS with HTTP Basic auth. Server-side libraries available in PHP, Node.js, Python, Java, C#, Go, Ruby and PowerShell.
Six lines of code. Any language.
Pick a tab. Each example sends a single SMS to a South African number using your API key + secret over HTTP Basic auth.
# Send your first SMS in one curl call curl -X POST https://api.nextgensms.co.za/v1/messages \ -u "$NEXTGENSMS_API_KEY:$NEXTGENSMS_API_SECRET" \ -H "Content-Type: application/json" \ -d '{ "to": "+27721234567", "from": "NextGenSMS", "message": "Hi {FirstName}, your appointment is tomorrow at 09:00." }'
<?php // Send your first SMS in 6 lines of PHP $ch = curl_init("https://api.nextgensms.co.za/v1/messages"); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: Basic " . base64_encode("$apiKey:$apiSecret"), "Content-Type: application/json", ]); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ "to" => "+27721234567", "message" => "Hi {FirstName}, your appointment is tomorrow at 09:00.", ])); $response = curl_exec($ch);
// Send your first SMS in 8 lines of Node.js const auth = Buffer.from(`${process.env.API_KEY}:${process.env.API_SECRET}`).toString("base64"); const res = await fetch("https://api.nextgensms.co.za/v1/messages", { method: "POST", headers: { "Authorization": `Basic ${auth}`, "Content-Type": "application/json" }, body: JSON.stringify({ to: "+27721234567", from: "NextGenSMS", message: "Hi {FirstName}, your appointment is tomorrow at 09:00.", }), }); const json = await res.json(); console.log(json);
# Send your first SMS in 7 lines of Python import os, base64, requests auth = base64.b64encode(f"{os.environ['API_KEY']}:{os.environ['API_SECRET']}".encode()).decode() res = requests.post( "https://api.nextgensms.co.za/v1/messages", headers={"Authorization": f"Basic {auth}"}, json={"to": "+27721234567", "from": "NextGenSMS", "message": "Hi {FirstName}, your appointment is tomorrow at 09:00."}, ) print(res.json())
// Send your first SMS in C# (HttpClient) var auth = Convert.ToBase64String(Encoding.UTF8.GetBytes($"{apiKey}:{apiSecret}")); using var http = new HttpClient(); http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", auth); var body = new { to = "+27721234567", from = "NextGenSMS", message = "Hi {FirstName}, your appointment is tomorrow at 09:00." }; var json = new StringContent(JsonSerializer.Serialize(body), Encoding.UTF8, "application/json"); var res = await http.PostAsync("https://api.nextgensms.co.za/v1/messages", json); var resp = await res.Content.ReadAsStringAsync();
// Send your first SMS in Go (net/http) func sendSMS(apiKey, apiSecret, to string) (error) { payload := strings.NewReader(`{"to":"` + to + `","from":"NextGenSMS","message":"Hi {FirstName}, your appointment is tomorrow at 09:00."}`) req, _ := http.NewRequest("POST", "https://api.nextgensms.co.za/v1/messages", payload) req.Header.Set("Authorization", "Basic "+base64.StdEncoding.EncodeToString([]byte(apiKey+":"+apiSecret))) req.Header.Set("Content-Type", "application/json") res, err := http.DefaultClient.Do(req) if err != nil { return err } defer res.Body.Close() return nil }
Everything you need for production SMS.
Stable, versioned REST endpoints. Authentication via HTTP Basic with your API key and secret.
Three steps to your first send.
Most teams are sending in under an hour.
Register & get a key
Free account in under 90 seconds. We email you an API key + secret under Settings → API.
Top up with credits
Buy credits in-app or via the API itself. Pay with Netcash (EFT, card, debit order, QR, voucher, Payflex, retail).
Send & verify
Run the cURL snippet above against your sandbox key. Switch to a live key when you're ready for real traffic.
Read the full reference.
Every endpoint, every parameter, with copy-pasteable examples and SDKs.