Reference

Templates

Templates are reusable texts with {{variable}} placeholders, stored per session. Send one with send-template. These are your own text snippets, not pre-approved WhatsApp Business templates.

Tusk WhatsApp API: Templates

Create a template

POST/v1/whatsapp/sessions/{sessionId}/templates

Creates a template.

Body
NameTypeDescription
sessionIdrequiredpathThe session id from the sessions endpoints.
namerequiredstringA name, unique within the session. Up to 100 characters.
bodyrequiredstringThe text, up to 4096 characters, with {{variable}} placeholders.
headerstringOptional text added before the body. Up to 1024 characters.
footerstringOptional text added after the body. Up to 1024 characters.
curl -X POST "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/templates" \
  -H "X-API-Key: $TUSK_WA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "order-confirmation",
  "body": "Hi {{customer}}, your order {{orderId}} has shipped.",
  "footer": "Reply STOP to opt out."
}'
201 Created
{
  "id": "b1c2d3e4-f5a6-7890-bcde-f01234567890",
  "sessionId": "9c1f6a4e-2b7d-4e0a-8f53-6d2a1b7c9e10",
  "name": "order-confirmation",
  "body": "Hi {{customer}}, your order {{orderId}} has shipped.",
  "footer": "Reply STOP to opt out.",
  "createdAt": "2026-01-15T09:40:00Z",
  "updatedAt": "2026-01-15T09:40:00Z"
}

List templates

GET/v1/whatsapp/sessions/{sessionId}/templates

Returns the session's templates.

Parameters
NameTypeDescription
sessionIdrequiredpathThe session id from the sessions endpoints.
curl "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/templates" \
  -H "X-API-Key: $TUSK_WA_KEY"
200 OK
[
  {
    "id": "b1c2d3e4-f5a6-7890-bcde-f01234567890",
    "sessionId": "9c1f6a4e-2b7d-4e0a-8f53-6d2a1b7c9e10",
    "name": "order-confirmation",
    "body": "Hi {{customer}}, your order {{orderId}} has shipped.",
    "footer": "Reply STOP to opt out.",
    "createdAt": "2026-01-15T09:40:00Z",
    "updatedAt": "2026-01-15T09:40:00Z"
  }
]

Get a template

GET/v1/whatsapp/sessions/{sessionId}/templates/{id}

Returns one template.

Parameters
NameTypeDescription
sessionIdrequiredpathThe session id from the sessions endpoints.
idrequiredpathThe template id.
curl "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/templates/5b0e9c3a-7d1f-4a62-9c1e-2f8a6d4b7e31" \
  -H "X-API-Key: $TUSK_WA_KEY"
200 OK
{
  "id": "b1c2d3e4-f5a6-7890-bcde-f01234567890",
  "sessionId": "9c1f6a4e-2b7d-4e0a-8f53-6d2a1b7c9e10",
  "name": "order-confirmation",
  "body": "Hi {{customer}}, your order {{orderId}} has shipped.",
  "footer": "Reply STOP to opt out.",
  "createdAt": "2026-01-15T09:40:00Z",
  "updatedAt": "2026-01-15T09:40:00Z"
}

Update a template

PUT/v1/whatsapp/sessions/{sessionId}/templates/{id}

Changes a template. Send only the fields to change.

Parameters
NameTypeDescription
sessionIdrequiredpathThe session id from the sessions endpoints.
idrequiredpathThe template id.
namestringA name, unique within the session. Up to 100 characters.
bodystringThe text, up to 4096 characters, with {{variable}} placeholders.
headerstringOptional text added before the body. Up to 1024 characters.
footerstringOptional text added after the body. Up to 1024 characters.
curl -X PUT "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/templates/5b0e9c3a-7d1f-4a62-9c1e-2f8a6d4b7e31" \
  -H "X-API-Key: $TUSK_WA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "body": "Hi {{customer}}, order {{orderId}} is on its way."
}'
200 OK
{
  "id": "b1c2d3e4-f5a6-7890-bcde-f01234567890",
  "sessionId": "9c1f6a4e-2b7d-4e0a-8f53-6d2a1b7c9e10",
  "name": "order-confirmation",
  "body": "Hi {{customer}}, order {{orderId}} is on its way.",
  "footer": "Reply STOP to opt out.",
  "createdAt": "2026-01-15T09:40:00Z",
  "updatedAt": "2026-01-15T09:40:00Z"
}

Delete a template

DELETE/v1/whatsapp/sessions/{sessionId}/templates/{id}

Deletes a template.

Parameters
NameTypeDescription
sessionIdrequiredpathThe session id from the sessions endpoints.
idrequiredpathThe template id.
curl -X DELETE "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/templates/5b0e9c3a-7d1f-4a62-9c1e-2f8a6d4b7e31" \
  -H "X-API-Key: $TUSK_WA_KEY"
204 No Content
(empty body)