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

  1. Create a utility template from the "Utility Templates" section of your dashboard, defining its header, body and any {{1}} variables.
  2. Wait for WhatsApp to approve it — you can follow the status in the templates table.
  3. 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

POSThttps://api.lightotp.com/SendUtilityMessage
PropertyValue
MethodPOST
Path/SendUtilityMessage
Content-Typeapplication/json
AuthenticationX-Api-Key header
Success status200 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

HeaderRequiredDescription
X-Api-KeyYesYour API key.
Content-TypeYesMust be application/json.
Accept-LanguageNoLanguage 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"
}
FieldTypeRequiredDescription
templateIdstring (uuid)YesThe id of your approved utility template.
toPhoneE164stringYesRecipient phone number in E.164 format, e.g. +966551234567.
headerParameterstringConditionalRequired only when the template header contains a variable; omit it otherwise.
bodyParametersstring[]ConditionalOne value per body variable, in order. Must match the number of variables in the template body.
idempotencyKeystring (uuid)NoA 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"
}
FieldTypeDescription
idstring (uuid)The id of the created message. Use it to check the delivery status.
messageStatusstringThe initial status of the message.

Message status

StatusMeaning
PendingAccepted and queued for sending.
SentHanded off to WhatsApp.
DeliveredDelivered to the recipient's device.
ReadOpened by the recipient.
FailedCould 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

CodeHTTPMeaning
ApiKeyIsRequired400The X-Api-Key header is missing.
ApiKeyNotFound404No API key matches the provided value.
ApiKeyExpired400The API key has expired.
TemplateIdIsRequired400templateId was not provided.
DestinationPhoneNumberIsRequired400toPhoneE164 was not provided.
TemplateNotFound404No template matches the provided templateId.
ThisTemplateIsForAnotherClient400The template does not belong to your account.
TemplateIsDeactivated400The template is deactivated. Reactivate it from your dashboard to send it again.
TemplateIsNotUtility400The template is not a utility template.
TemplateIsRejected400The template was rejected by WhatsApp and can't be used.
TemplateIsNotApproved400The template isn't approved yet (pending, paused or disabled).
HeaderParameterIsRequired400The template header has a variable but no headerParameter was provided.
HeaderParameterNotAllowed400A headerParameter was provided but the template header has no variable.
BodyParameterCountMismatch400The number of bodyParameters doesn't match the template's variables.
InsufficientBalance400Your subscription doesn't have enough credit to send the message.
SenderNumberNotFound404No sender number is assigned to your account. Contact LightOTP support to get a sender number assigned.
Cooldown message400You 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"
  }'