Utility Templates
Utility templates let you send WhatsApp messages such as order updates, delivery notifications, appointment reminders and account alerts. You create and manage them yourself from the dashboard, and each template must be approved by WhatsApp before it can be used.
Utility messages are billed like OTP messages and share the same sending safeguards — balance checks, per-number cooldown and idempotency.
Sending utility messages
Steps
- Create a utility template from the "Utility Templates" section of your dashboard, defining its header, body and any {{1}} variables.
- Wait for WhatsApp to approve it — you can follow the status in the templates table.
- Once the status is Approved, call the endpoint below with the template's id and the values for its variables.
Template limits
The number of utility templates you can keep active depends on your plan. If you have more than one active subscription, your limit is the highest among them.
If your limit drops, for example when a subscription ends, all your templates keep sending for 7 days. During that time you can deactivate or delete the extra ones, or upgrade your plan. After 7 days, the extra templates are deactivated automatically, starting with the ones you've used least recently.
Deactivated templates aren't deleted: they come back automatically when your limit allows it. Sending one returns TemplateIsDeactivated.
Endpoint
Endpoint
| Property | Value |
|---|---|
| Method | POST |
| Path | /SendUtilityMessage |
| Content-Type | application/json |
| Authentication | X-Api-Key header |
| Success status | 200 OK |
Authentication
Every request must include your API key in the X-Api-Key header. Create and manage API keys from the "API Keys" section of your dashboard.
Keep your API key secret. Never expose it in client-side code or public repositories — treat it like a password.
Headers
| Header | Required | Description |
|---|---|---|
X-Api-Key | Yes | Your API key. |
Content-Type | Yes | Must be application/json. |
Accept-Language | No | Language for error messages (en or ar). |
Body
JSON body
{
"templateId": "f5b2d2e9-2c1f-4f1d-9c89-2c41f3d9a4e2",
"toPhoneE164": "+966551234567",
"headerParameter": "Ahmad",
"bodyParameters": ["#4021", "March 5"],
"idempotencyKey": "a3f1c2e4-9b27-4d6a-8e5f-1c2b3d4e5f60"
}| Field | Type | Required | Description |
|---|---|---|---|
templateId | string (uuid) | Yes | The id of your approved utility template. |
toPhoneE164 | string | Yes | Recipient phone number in E.164 format, e.g. +966551234567. |
headerParameter | string | Conditional | Required only when the template header contains a variable; omit it otherwise. |
bodyParameters | string[] | Conditional | One value per body variable, in order. Must match the number of variables in the template body. |
idempotencyKey | string (uuid) | No | A unique key to safely retry a request without sending the message twice. |
Variables & parameters
Templates can contain numbered variables such as {{1}} and {{2}}. You supply their values when sending:
- headerParameter fills the single variable a header may contain. Send it only when the header actually has a variable, otherwise the request is rejected.
- bodyParameters is an ordered array: the first item replaces {{1}}, the second replaces {{2}}, and so on. Its length must exactly match the number of body variables.
Success response — 200 OK
200 OK
{
"id": "f5b2d2e9-2c1f-4f1d-9c89-2c41f3d9a4e2",
"messageStatus": "Sent"
}| Field | Type | Description |
|---|---|---|
id | string (uuid) | The id of the created message. Use it to check the delivery status. |
messageStatus | string | The initial status of the message. |
Message status
| Status | Meaning |
|---|---|
Pending | Accepted and queued for sending. |
Sent | Handed off to WhatsApp. |
Delivered | Delivered to the recipient's device. |
Read | Opened by the recipient. |
Failed | Could not be delivered. |
Errors
Errors are returned with the matching HTTP status and a machine-readable code in the response body.
Error shape
{
"errorMessage": "BodyParameterCountMismatch"
}Error codes
| Code | HTTP | Meaning |
|---|---|---|
ApiKeyIsRequired | 400 | The X-Api-Key header is missing. |
ApiKeyNotFound | 404 | No API key matches the provided value. |
ApiKeyExpired | 400 | The API key has expired. |
TemplateIdIsRequired | 400 | templateId was not provided. |
DestinationPhoneNumberIsRequired | 400 | toPhoneE164 was not provided. |
TemplateNotFound | 404 | No template matches the provided templateId. |
ThisTemplateIsForAnotherClient | 400 | The template does not belong to your account. |
TemplateIsDeactivated | 400 | The template is deactivated. Reactivate it from your dashboard to send it again. |
TemplateIsNotUtility | 400 | The template is not a utility template. |
TemplateIsRejected | 400 | The template was rejected by WhatsApp and can't be used. |
TemplateIsNotApproved | 400 | The template isn't approved yet (pending, paused or disabled). |
HeaderParameterIsRequired | 400 | The template header has a variable but no headerParameter was provided. |
HeaderParameterNotAllowed | 400 | A headerParameter was provided but the template header has no variable. |
BodyParameterCountMismatch | 400 | The number of bodyParameters doesn't match the template's variables. |
InsufficientBalance | 400 | Your subscription doesn't have enough credit to send the message. |
SenderNumberNotFound | 404 | No sender number is assigned to your account. Contact LightOTP support to get a sender number assigned. |
Cooldown message | 400 | You tried to message the same number again too soon; wait for the cooldown to pass. |
Billing & credits
Utility messages consume credit exactly like OTP messages:
- Each message costs points based on the destination country's pricing.
- Failed sends are not billed.
- Your subscription is marked expired once its balance reaches zero.
- A low-balance warning email is sent as your credit runs low.
Example (cURL)
cURL
curl -X POST "https://api.lightotp.com/SendUtilityMessage" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Accept-Language: en" \
-d '{
"templateId": "f5b2d2e9-2c1f-4f1d-9c89-2c41f3d9a4e2",
"toPhoneE164": "+966551234567",
"headerParameter": "Ahmad",
"bodyParameters": ["#4021", "March 5"],
"idempotencyKey": "a3f1c2e4-9b27-4d6a-8e5f-1c2b3d4e5f60"
}'