LanguageGuide · official SDK soon

Send SMS in Tunisia from Python with the Sendimo API.

With the requests library, one HTTP call sends an SMS from your scripts or your Django, Flask or FastAPI apps. The official Python SDK is on its way; the code below works today.

What it does

  • OTP codes, order confirmations and alerts.
  • Bulk sending, up to 10,000 SMS per call with POST /messages/bulk.
  • sk_test_ test key: realistic responses, nothing is sent or charged.
  • Idempotency-Key header to retry without ever sending twice.

Setup

  1. 1Install requests: pip install requests
  2. 2Create an API key in your Sendimo workspace and export it as SENDIMO_API_KEY.
  3. 3POST to /v1/messages: the 202 response contains the message ID.
  4. 4Receive the final status (delivered, failed…) by webhook.
Send an SMSPython
import os
import requests

response = requests.post(
    "https://api.sendimo.tn/v1/messages",
    headers={
        "Authorization": f"Bearer {os.environ['SENDIMO_API_KEY']}",
        "Idempotency-Key": "order-4821-otp",
    },
    json={
        "to": "+21620123456",
        "from": "SENDIMO",
        "text": "Your code is 482913. It expires in 5 minutes.",
        "reference": "order-4821",
    },
    timeout=10,
)
response.raise_for_status()  # 4xx/5xx → exception, see error.code

message = response.json()
print(message["id"], message["status"])  # msg_01HF8Z3K9QX2 queued
Response 202 AcceptedJSON
{
  "id": "msg_01HF8Z3K9QX2",
  "status": "queued",
  "to": "+21620123456",
  "from": "SENDIMO",
  "text": "Your code is 482913. It expires in 5 minutes.",
  "encoding": "GSM-7",
  "segments": 1,
  "network": "ooredoo",
  "cost": { "amount": "0.140", "currency": "TND" },
  "reference": "order-4821",
  "scheduled_at": null,
  "created_at": "2026-10-30T09:15:00Z"
}

Next steps

Other integrations

Ready to send your SMS?

Launching soon in Tunisia. Join early access.