← Back to docs

SMS API Reference

Language: EN | EN | SV

SMS API Reference

Base URL

https://tools.tornevall.net/api/sms

Authentication

All SMS endpoints require API key OR web session.

API key (recommended for integrations):

  • Stored in toolsApi.api_keys
  • provider = 'provider_sms_mail'
  • is_global = 1
  • is_active = 1

API Key Usage

Header:

X-Api-Key: YOUR_SECRET_KEY

Query parameter (legacy support):

?apikey=YOUR_SECRET_KEY

POST /send

Queue an SMS for sending (writes to GSMv2.pduout).

Request

POST /api/sms/send
Content-Type: application/json
X-Api-Key: YOUR_SECRET_KEY
{
  "destination": "+46701234567",
  "message": "Hello from API",
  "class": "-1",
  "central": ""
}

Fields

Field Required Type Notes
destination Yes string Phone number
message Yes string Max 512 chars
class No string SMS class; use 0 for flash if your gateway supports it
central No string SMS central name

Response

{
  "success": true,
  "pduid": 4106,
  "message": "SMS queued for sending"
}

Errors

  • 401 Unauthorized if no valid API key or web session
  • 500 on DB/queue errors

GET /{pduid}/status

Get status of an outgoing SMS.

Request

GET /api/sms/{pduid}/status
X-Api-Key: YOUR_SECRET_KEY

Response

{
  "pduid": 4106,
  "recipient": "+46701234567",
  "message": "Hello from API",
  "status": "queued",
  "tries": 0,
  "created_at": 1709035200
}

Flash SMS Support

Flash SMS depends on your SMS gateway. The API supports it through class.

How it works

  1. Send with class = "0" (flash class) via /api/sms/send
  2. sender-stream.sh passes class to gateway if configured
  3. If gateway expects a flash flag, configure env variables:
# In sender-stream service env
FLASH_CLASS=0
SMSGATE_CLASS_PARAM=messageClass
SMSGATE_FLASH_PARAM=isFlash
SMSGATE_FLASH_VALUE=true

Notes

  • If your gateway ignores these fields, flash won’t work.
  • If you know the exact field name expected by your SMS gateway, set it in SMSGATE_FLASH_PARAM.

Related

  • docs/SMS_PREFIX_CALLBACK_RESPONSES.md (callback reply behavior)
  • docs/NOTIFY_MAIL_SMS_UPGRADE.md (mail notification sender)