eSMS AfricaeSMS Africa
API ReferenceSMS API

Templates

GET/POST/PATCH/DELETE /api/templates - Save and reuse message templates.

Overview

Templates are named, reusable message bodies. Save the messages you send often and reference them in your own code or the composer. Template text can carry {{variable}} placeholders that bulk sends fill per recipient.

Authentication

Authorization: Bearer esms_live_your_api_key

List templates

GET https://sms.esmsafrica.io/api/templates
ParameterTypeDescription
limitintegerMax rows, up to 500 (default 200).
{
  "templates": [
    {
      "id": 12,
      "name": "OTP",
      "text": "Your code is {{code}}.",
      "created_at": "2026-08-14T12:00:00+00:00",
      "updated_at": "2026-08-14T12:00:00+00:00"
    }
  ]
}

Create a template

POST https://sms.esmsafrica.io/api/templates
{ "name": "OTP", "text": "Your code is {{code}}." }
FieldTypeRequiredDescription
namestringYes1-80 characters.
textstringYesMessage body (at least 1 character).

Returns 201 with the created template (including its id).

Update a template

PATCH https://sms.esmsafrica.io/api/templates/{id}

Same body as create; replaces both name and text. Returns the updated template, or 404 if it is not one of yours.

Delete a template

DELETE https://sms.esmsafrica.io/api/templates/{id}

Returns 204 No Content.

Example

curl -X POST https://sms.esmsafrica.io/api/templates \
  -H "Authorization: Bearer esms_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ "name": "OTP", "text": "Your code is {{code}}." }'

On this page