API-Referenz

Version 1.0.0, erzeugt aus der OpenAPI-Beschreibung. Maschinenlesbar unter /api/openapi.json

Öffentliche API von curl-sms. Authentifizierung per Authorization: Bearer <key>. Live-Keys beginnen mit cs_live_, Test-Keys mit cs_test_. Test-Keys durchlaufen alle Prüfungen, erreichen aber nie das Modem; ihr Status wechselt simuliert (sent, dann delivered), und es wird nichts berechnet.

Fehler haben immer die Form {"error":{"code":"…","message":"…"}}. Der Text folgt Accept-Language (de oder en, Standard de).

SMS senden, abfragen und stornieren.

POST /api/sms/send

SMS senden

Sendet eine SMS (receiver) oder denselben Text an bis zu 100 Empfänger (receivers). Nummern ohne Ländervorwahl gelten als deutsche Nummern. Erlaubt sind nur Mobilnummern. Mit send_at wird die SMS geplant (höchstens ein Jahr im Voraus). Wiederholst du eine Anfrage innerhalb von 24 Stunden mit demselben Idempotency-Key, bekommst du dieselbe Antwort, und es wird nicht erneut gesendet.

Parameter

NameTypBeschreibung
Idempotency-Keyheader

Printable ASCII, 1–255 characters. Same key and same request within 24 h returns the stored response.

Accept-Languageheader

Language of error messages (de or en, default de).

Felder im Body

NameTypBeschreibung
receiverstring

Mobile number, ideally E.164 (+49…). Without country code it is read as German.

receiversarray<string>
body*string

Text, UTF-8. GSM-7 parts have 160 characters (153 when split), Unicode parts 70 (67). At most 10 parts.

send_atstring

RFC 3339. Later than now and at most one year ahead.

Beispiel

{
  "receiver": "+4915123456789",
  "body": "Hallo"
}

Antworten

202

Accepted. The SMS is queued or scheduled.

{
  "id": "01JDQ8M3V6R1T5ZK2X9N4C7B0A",
  "mode": "live",
  "receiver": "+4915123456789",
  "status": "queued",
  "segments": 1,
  "encoding": "gsm7",
  "price": "0.00",
  "error_code": null,
  "created_at": "2026-11-23T10:15:00.000Z",
  "send_at": null,
  "sent_at": null,
  "delivered_at": null,
  "refunded": false
}
401

API key missing or invalid (unauthorized).

{
  "error": {
    "code": "unauthorized",
    "message": "API key missing or invalid."
  }
}
402

Balance and included SMS used up (insufficient_balance) or monthly spend limit reached (spend_limit). Nothing is charged afterwards.

{
  "error": {
    "code": "insufficient_balance",
    "message": "Balance and included SMS are used up."
  }
}
403

Destination not allowed (destination_blocked, free_zone_only, stop_listed) or account suspended (suspended).

409

Idempotent request still running (idempotency_in_progress) or SMS no longer cancelable (not_cancelable).

413

Request larger than 1 MiB (payload_too_large).

422

Invalid input, for example invalid_receiver, body_empty, body_too_long. With receivers, index names the failing entry.

{
  "error": {
    "code": "invalid_receiver",
    "message": "Invalid receiver number.",
    "index": 1
  }
}
429

Rate limit per key (rate_limited, see Retry-After) or daily limit (daily_limit).

500

Internal error. Quote error_id when you contact support.

{
  "error": {
    "code": "internal",
    "message": "Internal error.",
    "error_id": "01JDQ8R0A1B2C3D4E5F6G7H8J9"
  }
}

POST /api/sms/estimate

Teile, Kodierung und Preis berechnen

Berechnet Kodierung, Anzahl der Teile und Preis, ohne zu senden. Mit receiver sagt die Antwort zusätzlich, ob die SMS jetzt erlaubt wäre, und falls nicht, warum (code).

Parameter

NameTypBeschreibung
Accept-Languageheader

Language of error messages (de or en, default de).

Felder im Body

NameTypBeschreibung
receiverstring

Optional receiver for the price and permission check.

body*string

SMS text (UTF-8, at most 10 parts).

Beispiel

{
  "receiver": "+4915123456789",
  "body": "Grüße aus Brühl 👋"
}

Antworten

200

Estimate.

{
  "encoding": "ucs2",
  "segments": 1,
  "price": "0.00",
  "allowed": true
}
401

API key missing or invalid (unauthorized).

{
  "error": {
    "code": "unauthorized",
    "message": "API key missing or invalid."
  }
}
422

Invalid input, for example invalid_receiver, body_empty, body_too_long. With receivers, index names the failing entry.

{
  "error": {
    "code": "invalid_receiver",
    "message": "Invalid receiver number.",
    "index": 1
  }
}
429

Rate limit per key (rate_limited, see Retry-After) or daily limit (daily_limit).

GET /api/sms

SMS auflisten oder Änderungen seit einem Cursor

Listet die SMS im Modus des Keys (live oder test), sortiert nach letzter Änderung. Gib next_cursor aus der vorigen Antwort als since mit, um nur spätere Änderungen zu bekommen (Polling). Änderungen erscheinen mit bis zu 5 Sekunden Verzögerung.

Parameter

NameTypBeschreibung
sincequery

Cursor from next_cursor.

statusquery

Only SMS with this status.

limitquery

Page size (1–500, default 100).

Antworten

200

Page of SMS.

401

API key missing or invalid (unauthorized).

{
  "error": {
    "code": "unauthorized",
    "message": "API key missing or invalid."
  }
}
422

Invalid input, for example invalid_receiver, body_empty, body_too_long. With receivers, index names the failing entry.

{
  "error": {
    "code": "invalid_receiver",
    "message": "Invalid receiver number.",
    "index": 1
  }
}
429

Rate limit per key (rate_limited, see Retry-After) or daily limit (daily_limit).

GET /api/sms/{id}

Status einer SMS abfragen

Parameter

NameTypBeschreibung
id*path

ID of the SMS (from the send response).

Antworten

200

The SMS.

401

API key missing or invalid (unauthorized).

{
  "error": {
    "code": "unauthorized",
    "message": "API key missing or invalid."
  }
}
404

Not found (not_found).

429

Rate limit per key (rate_limited, see Retry-After) or daily limit (daily_limit).

DELETE /api/sms/{id}

Geplante SMS stornieren oder Text löschen

Eine geplante oder wartende SMS wird storniert und erstattet. Bei allen anderen wird nur der Text gelöscht, der Status bleibt. Eine SMS, die gerade an das Modem geht (dispatched), lässt sich nicht stornieren (409).

Parameter

NameTypBeschreibung
id*path

ID of the SMS (from the send response).

Antworten

200

The SMS after the change.

401

API key missing or invalid (unauthorized).

{
  "error": {
    "code": "unauthorized",
    "message": "API key missing or invalid."
  }
}
404

Not found (not_found).

409

Idempotent request still running (idempotency_in_progress) or SMS no longer cancelable (not_cancelable).

429

Rate limit per key (rate_limited, see Retry-After) or daily limit (daily_limit).

Tarif, Kontingent, Guthaben und Limits.

GET /api/account

Tarif, Kontingent, Guthaben und Limits

Antworten

200

Current account state.

{
  "plan": "paid",
  "mode": "live",
  "included_total": 300,
  "included_left": 287,
  "balance": "12.40",
  "spend_limit": "10.00",
  "spent": "0.18",
  "daily_limit": 500,
  "daily_left": 488
}
401

API key missing or invalid (unauthorized).

{
  "error": {
    "code": "unauthorized",
    "message": "API key missing or invalid."
  }
}
429

Rate limit per key (rate_limited, see Retry-After) or daily limit (daily_limit).

Lebenszeichen und diese Beschreibung.

GET /api/health

Lebenszeichen (ohne Anmeldung)

Antworten

200

The server is running.

503

The database is unreachable.

GET /api/openapi.json

Diese Beschreibung als JSON (ohne Anmeldung)

Antworten

200

OpenAPI 3.1 document.

Das Objekt Message

Felder

NameTypBeschreibung
id*string

ULID.

mode*string
receiver*string

E.164. Empty after account deletion.

status*string

scheduled → queued → dispatched → sent → delivered; also failed (refunded automatically), expired (no delivery report after 72 h, counts as sent; or error_code queue_timeout: waited 24 h for a gateway, not sent, refunded) and canceled.

segments*integer

Number of SMS parts.

encoding*string
price*string

Charged from the balance in euros ("0.00" for included SMS and test keys).

error_code*string | null

Reason if the SMS failed or expired; null otherwise.

Value Meaning
send_unknown Outcome unknown: possibly delivered, not to be resent automatically. Refunded.
send_failed:cms_<n> The mobile network rejected the SMS (<n> = network error).
send_failed The gateway could not send the SMS (no detail).
modem_error Error at the gateway modem.
encode_error The SMS could not be encoded (for example an invalid number).
delivery_failed:<n> The network reported non-delivery (<n> = delivery report status).
dispatch_timeout No gateway confirmed the SMS in three attempts.
no_body The text is missing.
parts_mismatch The part count does not match the text.
queue_timeout Status expired: waited more than 24 hours for a gateway, not sent. Refunded.
refunded*boolean

true if the price was credited back (failed, canceled, or expired with queue_timeout). price always stays the original amount.

created_at*string
send_at*string | null
sent_at*string | null
delivered_at*string | null

Mögliche Status: scheduled, queued, dispatched, sent, delivered, failed, expired, canceled

Webhook-Ereignisse

Jedes Ereignis kommt als signierter POST an deine URL. Wie du die Signatur prüfst: Webhooks prüfen

POST sms.status_changed

Status einer SMS hat sich geändert

Kommt bei jeder Statusänderung einer Live- oder Test-SMS. Die Zustellung ist at-least-once: dedupliziere über X-CurlSMS-Event-Id.

Parameter

NameTypBeschreibung
X-CurlSMS-Signature*header

t=<unix seconds>,v1=<hex>. v1 is HMAC-SHA256 over <t>.<raw body> with the endpoint secret (whsec_…). Reject old timestamps (replay).

X-CurlSMS-Event-Id*header

Event ID (same as id in the body). Delivery is at-least-once; deduplicate on it.

Beispiel

{
  "id": "evt_01JDQ8P2K9W3E6Y1M4T7Z0R5C8",
  "type": "sms.status_changed",
  "created": 1763892907,
  "data": {
    "id": "01JDQ8M3V6R1T5ZK2X9N4C7B0A",
    "status": "delivered",
    "at": "2026-11-23T10:15:07.123Z"
  }
}

Antworten

200

Any 2xx confirms receipt. Other answers or timeouts are retried (8 attempts over about 24 h).

POST billing.quota_warning

Inklusiv-SMS zu 50, 75 oder 100 % verbraucht

Parameter

NameTypBeschreibung
X-CurlSMS-Signature*header

t=<unix seconds>,v1=<hex>. v1 is HMAC-SHA256 over <t>.<raw body> with the endpoint secret (whsec_…). Reject old timestamps (replay).

X-CurlSMS-Event-Id*header

Event ID (same as id in the body). Delivery is at-least-once; deduplicate on it.

Antworten

200

Any 2xx confirms receipt. Other answers or timeouts are retried (8 attempts over about 24 h).

POST billing.spend_limit_reached

Monatliches Ausgabenlimit erreicht

Parameter

NameTypBeschreibung
X-CurlSMS-Signature*header

t=<unix seconds>,v1=<hex>. v1 is HMAC-SHA256 over <t>.<raw body> with the endpoint secret (whsec_…). Reject old timestamps (replay).

X-CurlSMS-Event-Id*header

Event ID (same as id in the body). Delivery is at-least-once; deduplicate on it.

Antworten

200

Any 2xx confirms receipt. Other answers or timeouts are retried (8 attempts over about 24 h).

POST billing.balance_low

Guthaben wird knapp

Parameter

NameTypBeschreibung
X-CurlSMS-Signature*header

t=<unix seconds>,v1=<hex>. v1 is HMAC-SHA256 over <t>.<raw body> with the endpoint secret (whsec_…). Reject old timestamps (replay).

X-CurlSMS-Event-Id*header

Event ID (same as id in the body). Delivery is at-least-once; deduplicate on it.

Antworten

200

Any 2xx confirms receipt. Other answers or timeouts are retried (8 attempts over about 24 h).

POST webhook.test

Testereignis aus dem Dashboard

Parameter

NameTypBeschreibung
X-CurlSMS-Signature*header

t=<unix seconds>,v1=<hex>. v1 is HMAC-SHA256 over <t>.<raw body> with the endpoint secret (whsec_…). Reject old timestamps (replay).

X-CurlSMS-Event-Id*header

Event ID (same as id in the body). Delivery is at-least-once; deduplicate on it.

Antworten

200

Any 2xx confirms receipt. Other answers or timeouts are retried (8 attempts over about 24 h).