Sending an SMS from Python against a REST SMS API is a single authenticated POST request
using requests.
import requests
response = requests.post(
"https://your-domain.example/api/v1/messages",
headers={"Authorization": "Bearer swl_live_YOUR_API_KEY"},
json={
"recipient": "255700000000",
"sender_id": "YOURBRAND",
"body": "Your order has shipped.",
},
)
print(response.json())
The API key is a Bearer token created from your account. recipient is an
E.164-formatted phone number, and sender_id is either your registered sender ID or your account's default sender.
See SMS API Tanzania for the full endpoint reference, including bulk sending and delivery status.


