---
title: "Send sms messages using a template."
method: POST
path: "/v4/sms/outgoing/sendusingtemplate"
tags: ["Sms - Outgoing"]
---

# Send sms messages using a template.

`POST /v4/sms/outgoing/sendusingtemplate`

## Request

- Base URL: `https://api.inmobile.com`
- URL: `https://api.inmobile.com/v4/sms/outgoing/sendusingtemplate`
- Auth: one of:
  - HTTP basic
  - API key in query parameter `apikey`

## Request body

- SmsOutgoingTemplatePostRequest
  - `templateId` string, required: The id of the template to use.
  - `messages` SmsOutgoingTemplateApiCreateModel[], required: A list of the sms messages to be sent. Allowed to contain between 1 and 250 elements.
    - `to` string, required: The msisdn (country code and number) to send to. (Remember to include countrycode in all numbers, e.g. 4512345678).</br> If max length is exceeded, the entire api call will fail.
    - `countryHint` string: For optimal phone number validation, we encourage you to provide us with a country code.</br> This can be the numeric country code (like 44) or the two-letter ISO 3166-1 alpha-2 code (like GB).</br> If this field is empty it is important that you add the country code (e.g 44) in front of the phone number in “to”.
    - `messageId` string: An optional message id used to identify the message.</br> If no message id is provided, a new message id is generated and assigned to the message. This id must be unique across all messages created on the same account.</br> (In case a previous message has been deleted according to GDPR deletion rules setup on the specific account, the messageId is allowed to be reused)</br> If max length is exceeded, the entire api call will fail.
    - `respectBlacklist` boolean, nullable: If true, this message will be blocked from sending if the target number is on the account's blacklist. If false, the message will be sent no matter blacklist settings.</br> Default: true
    - `validityPeriodInSeconds` integer, nullable: The validity period in seconds. Minimum is 60 seconds and maximum is 172800 (48 hours).</br> If not specified, the messages is attempted to be delivered in 48 hours. A typical use of validityPeriod is for messages that makes no sense to delivery after a certain time frame, in the case the phone is turned off, e.g. two-factor codes.</br> Please note, that messages are still charged even though the operator is cancelling the delivery attempt due to an exceeded validity period.
    - `statusCallbackUrl` string: In case you would like a callback from us when the message is delivered, you can specify it here, and we will call it when we have new message statuses.</br> The callback payload will be an array of status objects.</br> Api calls sending messages with the same apikey will be subject to being bulked together.
    - `sendTime` string: If set, this defines to time in the future for the message to be sent. e.g. 2001-02-30T14:50:23Z (UTC time).
    - `msisdnCooldownInMinutes` integer, nullable: If set, the message will be cancelled if the same mobile number already has received an SMS or an RCS message within this specified time period.</br> Fx. used to prevent spamming a mobile number.</br> Minimum 60 minutes (1 hour) and maximum is 43200 minutes (30 days).
    - `placeholders` ApiDynamicKeyValueCollection
      - `LinkMsisdnOrNull` CountryCodeAndPhoneNumber
        - `countryCodeId` string, nullable
        - `phoneNumber` string, nullable
        - `msisdn` string

## Response `200`

- SmsOutgoingTemplatePostReply
  - `usedPlaceholderKeys` string[]: A list of used placeholder keys
  - `notUsedPlaceholderKeys` string[]: A list of not used placeholder keys
  - `results` SmsOutgoingApiCreateResultModel[]
    - `numberDetails` NumberDetails
      - `countryCode` string: The country code part of the msisdn, e.g. 45.
      - `phoneNumber` string: The phone number part of the msisdn, e.g. 12345678.
      - `rawMsisdn` string: The input msisdn in its unaltered format. This is the value provided when sending the text message.
      - `msisdn` string: The final cleaned msisdn.
      - `isValidMsisdn` boolean: True if the input msisdn was valid.
      - `countryHint` string: The country code hint if provided in the request.
    - `text` string: The text message.
    - `from` string: The sender.
    - `smsCount` integer: The number of sms messages this message will be split into when sent to the operator. Charging will also be done according to this number.
    - `messageId` string: An optional message id used to identify the message. If no message id is provided, a new message id is generated and assigned to the message. This id must be unique across all messages created on the same account. (In case a previous message has been deleted according to GDPR deletion rules setup on the specific account, the messageId is allowed to be reused)
    - `encoding` string: The encoding of the message. Can be either "gsm7" or "ucs2". In case the message was submitted with encoding "auto", this report will reveal the final encoding based on the characters in the message text. "gsm7" is the default alphabet for text messages and when using gsm7, a single sms message can contain 160 characters. If the length exceeds 160 characters, the message is actually split up into parts of 153 characters and charged according to this. Please note, that a few, specific characters fill up 2 bytes and count for 2 letters. Ref: https://en.wikipedia.org/wiki/GSM_03.38 "ucs2" allows for more non-roman characters to be used along with smileys. When using this encoding, a single message can consist of 70 characters. If the message exceeds 70 characters, the final message is actually split into parts of 67 characters.

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `409`: Conflict
- `500`: Internal server error

---

[API](https://skmtc.dev/inmobile/apis/inmobile-rest-api.md) · [All operations](https://skmtc.dev/inmobile/apis/inmobile-rest-api/llms.txt) · [OpenAPI document](https://skmtc.dev/inmobile/apis/inmobile-rest-api/revisions/197a90ad5f8f?raw)
