Send Template with Body Variables + Attachment
Send a template message with body variables and a media header attachment.
Authorization
ApiKeyAuth API key from your dashboard (Settings > API Keys)
In: header
Header Parameters
Optional. Attribute this send to a specific agent, overriding the agent bound to the API key. The agent must belong to your account and be active (role AGENT, parent = your account) — otherwise the request returns 400. Drives customer assignment, agent allotment limits, and the wallet ledger entry.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://loading/api/v1/messages/send#template-body-vars-attachment" \ -H "X-AGENT-ID: agt_abc123" \ -H "Content-Type: application/json" \ -d '{ "to": "919876543210", "message": { "message_type": "template", "template_name": "invoice_reminder", "template_language": "en_US", "body_variables": [ "John", "INV-2026-001", "₹15,000" ], "attachments": { "type": "document", "attachment": "https://example.com/invoice-2026-001.pdf", "file_name": "Invoice-2026-001.pdf" } } }'{
"success": true,
"data": {
"id": "clx9abc123def456"
}
}{
"success": false,
"message": "to field is required"
}{
"success": false,
"message": "user not authenticated"
}{
"success": false,
"message": "insufficient balance to send message"
}{
"success": false,
"message": "template not found"
}{
"success": false,
"message": "internal server error"
}Send Template with Body Variables POST
Send a template message with dynamic body variables. Variables are substituted into the template body in order (`{{1}}`, `{{2}}`, etc.).
Send Template with a Dynamic-Link Button POST
Send a template that has a dynamic-link URL button. Pass the button under `buttons` with `button_type: dynamic_url` and `button_payload` set to the full destination URL. The server proxies the URL through a tracked dynamic link and substitutes a per-recipient short slug into the template's dynamic-link button, so clicks are attributed to the recipient. Only valid for template messages. `button_index` must point at a dynamic-link button in the approved template; otherwise the request returns `400`.


