← 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):

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


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


Related