Auto
EN
POST/api/v2/templates

Create a template

Creates any supported template type. Official WhatsApp templates are submitted to Meta according to the approved sender. Name must be lowercase English with underscores. Attach header media in the same multipart request, or upload first via /api/v2/templates/media then pass headerAssetId.

When to use it. When your system must create templates programmatically and send them after approval.

Code example

Correct: Full WhatsApp template (image + variables + buttons)

curl --request POST 'https://raselsms.com/api/v2/templates' \--header 'X-API-Key: YOUR_API_KEY' \--header 'Content-Type: application/json' \--data '{"name":"order_ready_notice","category":"whatsapp","subType":"utility","language":"ar","headerType":"image","headerAssetId":"ASSET_ID_FROM_MEDIA_UPLOAD","body":"مرحباً {{1}}، طلبك رقم {{2}} جاهز للاستلام. الإجمالي {{3}} ل.س.","bodyParameters":[{"index":1,"label":"أحمد"},{"index":2,"label":"A-1042"},{"index":3,"label":"25000"}],"footer":"راسل","buttons":[{"type":"url","text":"تتبع الطلب","url":"https://example.com/orders/{{1}}","urlExample":"https://example.com/orders/A-1042"},{"type":"phone","text":"اتصل بنا","url":"+963911111111"}]}'

Response example

201 — Full WhatsApp template (image + variables + buttons)

{  "success": true,  "data": {    "template": {      "id": "6800tpl123def4567890aaaa",      "name": "order_ready_notice",      "category": "whatsapp",      "subType": "utility",      "language": "ar",      "status": "pending",      "headerType": "image",      "headerValue": null,      "headerAssetId": null,      "headerPreviewUrl": null,      "allowsHeaderMediaOverride": true,      "provider": "meta",      "officialSenderId": "platform",      "officialSender": {        "id": "platform",        "scope": "platform",        "isPlatform": true,        "isDefault": true,        "label": null,        "phoneNumber": null,        "displayName": "platform"      },      "isPlatformNumber": true,      "isDefault": false,      "createdAt": "2026-09-01T10:00:00.000Z"    }  }}

HTTP request

POST /api/v2/templates

Request Headers

HeaderTypeDescription
X-API-KeystringYour Rasel API key. Send it on every documented request except inbound webhooks. *

Request body

FieldTypeDescriptionExample
namestringDisplay name or lowercase template identifier, depending on the endpoint. *
categoryenumTemplate category: whatsapp, sms, message, or email. *
subTypeenumTemplate sub-type such as utility, otp, marketing, or free. *
languagestringMeta template language such as ar or en. Used for official WhatsApp templates.
bodystringWhatsApp template body with numbered placeholders. Pair with bodyParameters at create and variablesIndexed at send.
contentstringOn unified send: message content object (text, otpCode, or email subject). On templates: SMS or message body, or email HTML/text.
emailSubjectstringRequired when category is email.
headerTypeenumHeader kind: text, image, video, or document.
headerValuestringText header value when headerType is text.
headerAssetIdstringId from the media upload path. Not required when headerMedia, file, or headerMediaUrl is sent.
footerstringOptional WhatsApp footer. Not used on WhatsApp Web session templates.
buttonsjsonWhatsApp buttons configured on the template.
bodyParametersjsonExample values submitted to Meta for numbered body placeholders.
otpTypeenumOfficial WhatsApp OTP button type: copy_code, one_tap, or zero_tap.
addSecurityRecommendationbooleanWhen true, Meta adds the standard OTP security recommendation line.
codeExpirationMinutesintegerOTP validity in minutes (1-90) for official WhatsApp OTP templates.
otpButtonTextstringLabel on the official WhatsApp OTP copy-code button.
packageNamestringAndroid package name for one-tap or zero-tap OTP.
signatureHashstringAndroid app signature hash for one-tap or zero-tap OTP.
zeroTapTermsAcceptedbooleanMust be true when otpType is zero_tap.
providerenumTemplate provider filter or value: user_session, meta, or internal.
templateTargetenumSet to user_session to create a WhatsApp Web session template (same as provider=user_session).
officialSenderIdstringOfficial WhatsApp sender id from /api/v2/official-senders. Alias of sender.officialId. Use platform for the default Meta number when listing templates.
creationModeenumUse manual_external_id to bind an existing official WhatsApp template with providerTemplateId.
providerTemplateIdstringExisting official WhatsApp / Meta template id when binding manually.
manualVariableCountintegerNumber of body variables when binding an existing official template.

Response Fields

FieldTypeDescriptionExample
successbooleanTrue when the operation succeeded, or when at least one batch recipient succeeded.
dataobjectPrimary payload for list and snapshot endpoints.
data.templateobjectTemplate reference (id or key), language, variables, and optional per-send header media.
data.template.idstringResource identifier.
data.template.namestringDisplay name or lowercase template identifier, depending on the endpoint.
data.template.categoryenumTemplate category: whatsapp, sms, message, or email.
data.template.subTypeenumTemplate sub-type such as utility, otp, marketing, or free.
data.template.statusenumDelivery or record status. On send: sent, queued, or scheduled. On other resources it is the row status filter or value.
data.template.languagestringMeta template language such as ar or en. Used for official WhatsApp templates.
data.template.bodystringWhatsApp template body with numbered placeholders. Pair with bodyParameters at create and variablesIndexed at send.
data.template.bodyParametersjsonExample values submitted to Meta for numbered body placeholders.
data.template.headerTypeenumHeader kind: text, image, video, or document.
data.template.headerValuestringText header value when headerType is text.
data.template.headerAssetIdstringId from the media upload path. Not required when headerMedia, file, or headerMediaUrl is sent.
data.template.headerPreviewUrlstringPreview URL for stored header media.
data.template.allowsHeaderMediaOverridebooleanTrue when this official WhatsApp template accepts a per-send header file or URL.
data.template.footerstringOptional WhatsApp footer. Not used on WhatsApp Web session templates.
data.template.buttonsjsonWhatsApp buttons configured on the template.
data.template.urlButtonVariablesjsonValues for URL button suffixes on this template.
data.template.indexedPlaceholdersstring-listNumbered body placeholders, such as {{1}}.
data.template.contentstringOn unified send: message content object (text, otpCode, or email subject). On templates: SMS or message body, or email HTML/text.
data.template.parametersjsonExample or bound values for the template body placeholders.
data.template.providerstringTemplate provider filter or value: user_session, meta, or internal.
data.template.providerTemplateIdstringExisting official WhatsApp / Meta template id when binding manually.
data.template.manualProviderenumProvider recorded when this template was bound manually.
data.template.officialSenderIdstringOfficial WhatsApp sender id from /api/v2/official-senders. Alias of sender.officialId. Use platform for the default Meta number when listing templates.
data.template.officialSenderobjectOfficial WhatsApp number this template is bound to.
data.template.officialSender.idstringResource identifier.
data.template.officialSender.scopeenumplatform when the template uses the default number, otherwise a specific sender.
data.template.officialSender.isPlatformbooleanTrue when the template uses the platform default number.
data.template.officialSender.isDefaultbooleanTrue when this sender or template is the account default.
data.template.officialSender.labelstringReady-to-show sender label combining name and phone.
data.template.officialSender.phoneNumberstringVerified display number in E.164.
data.template.officialSender.displayNamestringName shown for this official sender.
data.template.isPlatformNumberbooleanTrue when the template is bound to the platform default official number.
data.template.isDefaultbooleanTrue when this sender or template is the account default.
data.template.createdAtstringCreation timestamp.
messagestringHuman-readable result message from create or upload.

Status Codes

StatusDescription
201Created.
400Invalid request, validation error, or the resource cannot be used in this state.
401Missing or invalid API key.
403Phone not verified, missing permission, or the account cannot perform this action.
409Conflict, such as an idempotency key reuse with a different body, or a session that is not ready.
429Rate limit exceeded, or the maximum number of verification attempts was reached.
503The provider is unavailable or timed out.
413Request body exceeds the size limit.

Try it

Parameters

Official WhatsApp sender id from /api/v2/official-senders. Alias of sender.officialId. Use platform for the default Meta number when listing templates.

Display name or lowercase template identifier, depending on the endpoint.

Template category: whatsapp, sms, message, or email.

Template sub-type such as utility, otp, marketing, or free.

Meta template language such as ar or en. Used for official WhatsApp templates.

WhatsApp template body with numbered placeholders. Pair with bodyParameters at create and variablesIndexed at send.

On unified send: message content object (text, otpCode, or email subject). On templates: SMS or message body, or email HTML/text.

Required when category is email.

Header kind: text, image, video, or document.

Text header value when headerType is text.

Id from the media upload path. Not required when headerMedia, file, or headerMediaUrl is sent.

Optional WhatsApp footer. Not used on WhatsApp Web session templates.

WhatsApp buttons configured on the template.

Example values submitted to Meta for numbered body placeholders.

Official WhatsApp OTP button type: copy_code, one_tap, or zero_tap.

When true, Meta adds the standard OTP security recommendation line.

OTP validity in minutes (1-90) for official WhatsApp OTP templates.

Label on the official WhatsApp OTP copy-code button.

Android package name for one-tap or zero-tap OTP.

Android app signature hash for one-tap or zero-tap OTP.

Must be true when otpType is zero_tap.

Template provider filter or value: user_session, meta, or internal.

Set to user_session to create a WhatsApp Web session template (same as provider=user_session).

Use manual_external_id to bind an existing official WhatsApp template with providerTemplateId.

Existing official WhatsApp / Meta template id when binding manually.

Number of body variables when binding an existing official template.

Request

{  "name": "order_ready_notice",  "category": "whatsapp",  "subType": "utility",  "language": "ar",  "headerType": "image",  "headerAssetId": "ASSET_ID_FROM_MEDIA_UPLOAD",  "body": "مرحباً {{1}}، طلبك رقم {{2}} جاهز للاستلام. الإجمالي {{3}} ل.س.",  "bodyParameters": [    {      "index": 1,      "label": "أحمد"    },    {      "index": 2,      "label": "A-1042"    },    {      "index": 3,      "label": "25000"    }  ],  "footer": "راسل",  "buttons": [    {      "type": "url",      "text": "تتبع الطلب",      "url": "https://example.com/orders/{{1}}",      "urlExample": "https://example.com/orders/A-1042"    },    {      "type": "phone",      "text": "اتصل بنا",      "url": "+963911111111"    }  ]}

Response

Example response

{  "success": true,  "data": {    "template": {      "id": "6800tpl123def4567890aaaa",      "name": "order_ready_notice",      "category": "whatsapp",      "subType": "utility",      "language": "ar",      "status": "pending",      "headerType": "image",      "headerValue": null,      "headerAssetId": null,      "headerPreviewUrl": null,      "allowsHeaderMediaOverride": true,      "provider": "meta",      "officialSenderId": "platform",      "officialSender": {        "id": "platform",        "scope": "platform",        "isPlatform": true,        "isDefault": true,        "label": null,        "phoneNumber": null,        "displayName": "platform"      },      "isPlatformNumber": true,      "isDefault": false,      "createdAt": "2026-09-01T10:00:00.000Z"    }  }}