> ## 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

#### Body

<ParamField body="senderId" type="string" placeholder="Enter Sender name" required>
  The registered and approved Sender name to be used for the message.
</ParamField>

<ParamField body="route" type="string" placeholder="Enter message route" required>
  Type of connectivity for the message, such as promotional, transactional, or
  OTP.
</ParamField>

<ParamField body="number" type="string" placeholder="Enter phone number" required>
  The phone number with a country prefix to which the message will be sent.
</ParamField>

<ParamField body="message" type="string" placeholder="Enter message content" required>
  The content of the message that you want to send.
</ParamField>

<ParamField body="isFlash" 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.
</ParamField>

<ParamField body="dltTemplateId" type="string" placeholder="Enter template ID">
  (Optional) Only applicable for India. If you want to pass a template ID
  directly via the API, you can do so with this parameter.
</ParamField>

<ParamField body="dltEntityId" type="string" placeholder="Enter entity ID">
  (Optional) Only applicable for India. If you want to pass an entity ID
  directly via the API, you can do so with this parameter.
</ParamField>

<ParamField body="reportURL" type="string" placeholder="Enter report URL">
  (Optional) Specify the URL where the user's report and deliveries should be
  delivered.
</ParamField>

<ParamField body="submissionStatus" type="boolean" placeholder="Enter true or false">
  (Optional) When a user wants to wait for submission status from the API, they
  must set this key to true. It is false by default.
</ParamField>

#### Response

<ResponseField name="status" type="boolean">
  Indicates whether the call was successful. true if successful, false if not.
</ResponseField>

<ResponseField name="message" type="string">
  success or error response message
</ResponseField>

#### Reports & Deliveries

In order to get delivery reports directly into your system you need to take care of few simple things.

1. Please make sure that, the URL passed in the field reportUrl, must accept HTTP POST request with JSON request body.

<Note>
  If you are sending an SMS using a GET URL, it is necessary to encode the message using the URL Encoding method before sending it. However, if you are using a POST API, there is no need to encode the message.

  For example, if the message is "Hi User 1 & User 2, Welcome to zixflow," it needs to be encoded as "Hi%20User%201%20%26%20User%202%2C%20Welcome%20to%20zixflow" using URL Encoding.

  You can use a tool like [https://www.urlencoder.org/](https://www.urlencoder.org/) for reference on how to properly encode your message.
</Note>

<RequestExample>
  ```bash cUrl theme={null}
  curl --location --request POST 'https://api.zixflow.com/api/v1/campaign/sms/send' \
  --header 'Authorization: Bearer 56616641ee123b80a36b99fedc2bfa4f0d7f63072d97ddb1578c7a5aa970e7edde6618c7f750beb921aee3eebc9cc48899ee992fa4eb95a663d0e0b2eaa35b73f3b2344c' \
  --header 'Content-Type: application/json' \
  --data-raw '{
      "senderId": "IDENTY",
      "route": "transactional",
      "number": "919090909090",
      "message": "Your OTP is 0101",
      "isFlash": false,
      "dltTemplateId": "1234",
      "dltEntityId": "1234",
      "reportURL": "https://webhook.site/0a276bc5-f0e4-4235-9006-b58b7d224ad5",
      "submissionStatus": false
  }'
  ```

  ```js Nodejs theme={null}
  var axios = require("axios");
  var data = JSON.stringify({
    senderId: "IDENTY",
    route: "transactional",
    number: "919090909090",
    message: "Your OTP is 0101",
    isFlash: false,
    dltTemplateId: "1234",
    dltEntityId: "1234",
    reportURL: "https://webhook.site/0a276bc5-f0e4-4235-9006-b58b7d224ad5",
    submissionStatus: false,
  });

  var config = {
    method: "post",
    url: "https://api.zixflow.com/api/v1/campaign/sms/send",
    headers: {
      Authorization:
        "Bearer 56616641ee123b80a36b99fedc2bfa4f0d7f63072d97ddb1578c7a5aa970e7edde6618c7f750beb921aee3eebc9cc48899ee992fa4eb95a663d0e0b2eaa35b73f3b2344c",
      "Content-Type": "application/json",
    },
    data: data,
  };

  axios(config)
    .then(function (response) {
      console.log(JSON.stringify(response.data));
    })
    .catch(function (error) {
      console.log(error);
    });
  ```

  ```py Python theme={null}
  import requests
  import json

  url = "https://api.zixflow.com/api/v1/campaign/sms/send"

  payload = json.dumps({
    "senderId": "IDENTY",
    "route": "transactional",
    "number": "919090909090",
    "message": "Your OTP is 0101",
    "isFlash": False,
    "dltTemplateId": "1234",
    "dltEntityId": "1234",
    "reportURL": "https://webhook.site/0a276bc5-f0e4-4235-9006-b58b7d224ad5",
    "submissionStatus": False
  })
  headers = {
    'Authorization': 'Bearer 56616641ee123b80a36b99fedc2bfa4f0d7f63072d97ddb1578c7a5aa970e7edde6618c7f750beb921aee3eebc9cc48899ee992fa4eb95a663d0e0b2eaa35b73f3b2344c',
    'Content-Type': 'application/json'
  }

  response = requests.request("POST", url, headers=headers, data=payload)

  print(response.text)


  ```

  ```java JAVA theme={null}
  OkHttpClient client = new OkHttpClient().newBuilder()
    .build();
  MediaType mediaType = MediaType.parse("application/json");
  RequestBody body = RequestBody.create(mediaType, "{\n    \"senderId\": \"IDENTY\",\n    \"route\": \"transactional\",\n    \"number\": \"919090909090\",\n    \"message\": \"Your OTP is 0101\",\n    \"isFlash\": false,\n    \"dltTemplateId\": \"1234\",\n    \"dltEntityId\": \"1234\",\n    \"reportURL\": \"https://webhook.site/0a276bc5-f0e4-4235-9006-b58b7d224ad5\",\n    \"submissionStatus\": false\n}");
  Request request = new Request.Builder()
    .url("https://api.zixflow.com/api/v1/campaign/sms/send")
    .method("POST", body)
    .addHeader("Authorization", "Bearer 56616641ee123b80a36b99fedc2bfa4f0d7f63072d97ddb1578c7a5aa970e7edde6618c7f750beb921aee3eebc9cc48899ee992fa4eb95a663d0e0b2eaa35b73f3b2344c")
    .addHeader("Content-Type", "application/json")
    .build();
  Response response = client.newCall(request).execute();
  ```

  ```dart DART theme={null}
  var headers = {
    'Authorization': 'Bearer 56616641ee123b80a36b99fedc2bfa4f0d7f63072d97ddb1578c7a5aa970e7edde6618c7f750beb921aee3eebc9cc48899ee992fa4eb95a663d0e0b2eaa35b73f3b2344c',
    'Content-Type': 'application/json'
  };
  var request = http.Request('POST', Uri.parse('https://api.zixflow.com/api/v1/campaign/sms/send'));
  request.body = json.encode({
    "senderId": "IDENTY",
    "route": "transactional",
    "number": "919090909090",
    "message": "Your OTP is 0101",
    "isFlash": false,
    "dltTemplateId": "1234",
    "dltEntityId": "1234",
    "reportURL": "https://webhook.site/0a276bc5-f0e4-4235-9006-b58b7d224ad5",
    "submissionStatus": false
  });
  request.headers.addAll(headers);

  http.StreamedResponse response = await request.send();

  if (response.statusCode == 200) {
    print(await response.stream.bytesToString());
  }
  else {
    print(response.reasonPhrase);
  }

  ```
</RequestExample>

<ResponseExample>
  ```json 200-Success theme={null}
  {
    "status": true,
    "message": "SMS sent successfully"
  }
  ```

  ```json 400-Bad Request theme={null}
  {
    "status": false,
    "message": "Invalid data Provided"
  }
  ```

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