> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zixflow.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Send SMS Template

> Send an SMS using a predefined template

#### Description

This endpoint allows you to send an SMS using a predefined template. Templates can include variables that are replaced with actual values when the SMS is sent. Either `template_name` or `template_id` must be provided to identify the template.

#### Headers

<ParamField header="x-api-key" type="string" required placeholder="Enter your API key">
  Your API key for authentication.
</ParamField>

<ParamField header="x-workspace-id" type="string" required placeholder="Enter your workspace ID">
  Your workspace ID for authentication.
</ParamField>

#### Body

<ParamField body="recipient" type="string" required placeholder="Enter recipient phone number">
  The phone number with a country prefix to which the message will be sent. **Required.** Must be in international format without the leading plus sign (+) or any spaces, dashes, or other special characters. Format: country code followed by the phone number. Example: `919876543210` (India: country code `91` + number `9876543210`).
</ParamField>

<ParamField body="route" type="string" required placeholder="Enter route">
  Type of connectivity for the message. Supported routes: `promotional`, `transactional`, or `otp`.
</ParamField>

<ParamField body="sender_id" type="string" required placeholder="Enter sender ID">
  The registered and approved sender name to be used for the message. You can add and manage sender IDs in [Zixflow SMS Settings](https://ai.zixflow.com/settings/channels/sms).
</ParamField>

<ParamField body="template_name" type="string" placeholder="Enter template name" required>
  The name of the SMS template to use. You can add and manage SMS templates in [Zixflow SMS Content](https://ai.zixflow.com/content/sms).
</ParamField>

<ParamField body="variables" type="object" placeholder="Enter template variables" required>
  Key-value pairs for template variables. Keys should match the variable names in the template, and values will replace the placeholders.
</ParamField>

<ParamField body="is_flash" type="boolean" placeholder="Enter true or false">
  Optional. Set this parameter to `true` if you want to send a flash SMS via the API; otherwise, set it to `false`. Flash SMS appears directly on the screen. Default: `false`.
</ParamField>

<ParamField body="post_back_url" type="string" placeholder="Enter post-back URL">
  (Optional) To receive post-back notifications about the sent message as it is delivered or failed. When a message status changes (delivered, failed, etc.), a notification will be sent to this URL. See [Postback Notifications](/api-reference/zixflow-ai/postback-notifications) for the payload format and field descriptions.
</ParamField>

<ParamField body="post_back_data" type="string" placeholder="Enter post-back data">
  (Optional) The data that will be sent back on the post\_back\_url with the notification. This can be used as an identifier for the sent message if the client wants to track or correlate messages with their own system. See [Postback Notifications](/api-reference/zixflow-ai/postback-notifications) for how it appears in the notification.
</ParamField>

#### Response

<ResponseField name="success" type="boolean">
  Indicates whether the request was successful. true if the request was accepted and queued, false otherwise.
</ResponseField>

<ResponseField name="message" type="string">
  Success message when the request succeeded, or error message when it failed.
</ResponseField>

<ResponseField name="request_id" type="string">
  Present only when success is true. Unique identifier for this request; use it for tracking and for correlating with postback notifications.
</ResponseField>

<ResponseExample>
  ```json 200-Success theme={null}
  {
    "success": true,
    "message": "SMS request queued successfully",
    "request_id": "f8df74d1-11fa-4485-b164-b9a65358f4fc"
  }
  ```

  ```json 400-Bad Request theme={null}
  {
    "success": false,
    "message": "Invalid template or missing variables"
  }
  ```

  ```json 401-Unauthorised theme={null}
  {
    "success": false,
    "message": "Unauthorised"
  }
  ```
</ResponseExample>
