> For the complete documentation index, see [llms.txt](https://api.bind.hr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.bind.hr/messaging-api/send-templated-message.md).

# Send templated message

## Send an SMS using a template

> Provide the destination number \`to\`, and optional \`callback\_url\`,\
> plus all template parameters under \`params\` as additional JSON fields (all string values).\
> Check the Templates API for fetching the template \`id\`.\
> \
> \## Callback request example (DLR - delivery notification)\
> \
> \### POST /\<callback\_url>\
> \
> \`\`\`json\
> {\
> &#x20; "error": "000",\
> &#x20; "from": "18888112345",\
> &#x20; "message\_id": "8bd71f49-6f42-4729-bf5e-ecf857747633",\
> &#x20; "status": "DELIVERED",\
> &#x20; "to": "16197012345",\
> &#x20; "type": "DLR"\
> }\
> \`\`\`\
> \
> Each request contains the following information:\
> \
> \* \`message\_id\` - the id of the message which has been returned following \`/send\`  request\
> \* \`from\` - the source address the message was sent from\
> \* \`to\` - the destination address which has received the message\
> \* \`status\`- the status of the message\
> &#x20; \* \`DELIVERED\` - Message has been delivered\
> &#x20; \* \`EXPIRED\` - Message wasn't delivered within the 48 hour period\
> &#x20; \* \`UNDELIVERABLE\` - Message wasn't delivered (check the \`error\`)\
> &#x20; \* \`UNKNOWN\` - Message wasn't delivered due to a unknown reason\
> &#x20; \* \`REJECTED\` - Message was rejected by the supplier (check the \`error\`)\
> \* \`type\`- type of the callback, either \`DLR\` for delivery notification or \`MO\` for mobile originated message\
> \* \`error\` - The error code returned by the supplier (check the table below for possible values)\
> \
> \| EC   | ERROR DESCRIPTION                                                                                  |\
> \| ---- | -------------------------------------------------------------------------------------------------- |\
> \| 0    | DELIVERED                                                                                          |\
> \| 1    | UNKNOWN\_SUBSCRIBER                                                                                 |\
> \| 5    | UNIDENTIFIED\_SUBSCRIBER                                                                            |\
> \| 9    | ILLEGAL\_SUBSCRIBER                                                                                 |\
> \| 11   | TELESERVICE\_NOT\_PROVISIONED                                                                        |\
> \| 13   | CALL\_BARRED                                                                                        |\
> \| 21   | FACILITY\_NOT\_SUPPORTED                                                                             |\
> \| 27   | ABSENT\_SUBSCRIBER                                                                                  |\
> \| 31   | SUBSCRIBER\_BUSY\_FOR\_MT\_SMS                                                                         |\
> \| 32   | DELIVERY\_FAILURE                                                                                   |\
> \| 34   | SYSTEM\_FAILURE                                                                                     |\
> \| 36   | UNEXPECTED\_DATA\_VALUE                                                                              |\
> \| 37   | MEMORY\_CAPACITY\_EXCEEDED                                                                           |\
> \| 38   | PREFIX\_NOT\_RESOLVED                                                                                |\
> \| 39   | IMSI\_BLACKLISTED                                                                                   |\
> \| 40   | DEST\_ADDRESS\_BLACKLISTED                                                                           |\
> \| 41   | TIME\_OUT                                                                                           |\
> \| 43   | INVALID\_ORIGINATOR\_ADDRESS                                                                         |\
> \| 100  | GENERAL\_ERROR                                                                                      |\
> \| 200  | EQUIPMENT\_PROTOCOL\_ERROR                                                                           |\
> \| 201  | UNKNOWN\_MSC                                                                                        |\
> \| 202  | CONGESTION\_ERROR                                                                                   |\
> \| 203  | PARAMETER\_MISSMATCH                                                                                |\
> \| 204  | INITIATING\_RELEASE                                                                                 |\
> \| 205  | POTENTIAL\_VERSION\_INCOMPATIBILITY                                                                  |\
> \| 206  | REMOTE\_NODE\_NOT\_REACHABLE                                                                          |\
> \| 207  | MTP\_FAILURE                                                                                        |\
> \| 346  | CLIENT\_NETWORK\_FORBIDDEN (In a case of MNP being performed)                                        |\
> \| 351  | INVALID\_PREFIX\_OR\_DESTINATION                                                                      |\
> \| 4100 | EXPIRED\_ON\_FORCE\_RETRY (When the time to live has been configured for delivery and it has expired) |\
> \
> \## Callback request example (MO - mobile originated message)\
> \
> \### POST /\<callback\_url>\
> \
> \`\`\`json\
> {\
> &#x20; "from": "16197012345",\
> &#x20; "message\_id": "2d7114a6-bd45-4022-98ab-15d36cc2b9bd",\
> &#x20; "text": "STOP",\
> &#x20; "to": "18888112345",\
> &#x20; "type": "MO"\
> }\
> \`\`\`\
> \
> Each request contains the following information:\
> \
> \* \`message\_id\` - the id of the mobile originated message\
> \* \`from\` - the mobile number the message has been sent from\
> \* \`to\` - the mobile number which has received the message\
> \* \`type\`- type of the callback, either \`DLR\` for delivery notification or \`MO\` for mobile originated message\
> \* \`text\` - the text of the message which has been sent \`from\` to \`to\` number<br>

````json
{"openapi":"3.0.3","info":{"title":"SMS Template API","version":"1.0.0"},"servers":[{"url":"https://messaging-api.bind.hr","description":"Production"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY","description":"API key header."}},"schemas":{"SendRequest":{"type":"object","properties":{"to":{"type":"string","description":"Destination MSISDN in international format (e.g., 44...)"},"callback_url":{"type":"string","format":"uri","nullable":true},"params":{"type":"object","description":"Dynamic template parameters.","additionalProperties":{"type":"string"}}}},"SendResponse":{"type":"object","properties":{"status":{"type":"string","enum":["ACCEPTED","REJECTED"]},"message_id":{"type":"string","description":"Message id (UUID)"},"error_message":{"type":"string"},"cost":{"type":"number","description":"Cost of the message"},"count":{"type":"integer","description":"Number of messages sent"}},"required":["status","error_message","cost","count"]},"SendError":{"type":"object","properties":{"status":{"type":"string","enum":["REJECTED"]},"error_message":{"type":"string"}},"required":["status","error_message"]}}},"paths":{"/v1.0/sms/template/{id}/send":{"post":{"tags":["Send templated message"],"summary":"Send an SMS using a template","description":"Provide the destination number `to`, and optional `callback_url`,\nplus all template parameters under `params` as additional JSON fields (all string values).\nCheck the Templates API for fetching the template `id`.\n\n## Callback request example (DLR - delivery notification)\n\n### POST /<callback_url>\n\n```json\n{\n  \"error\": \"000\",\n  \"from\": \"18888112345\",\n  \"message_id\": \"8bd71f49-6f42-4729-bf5e-ecf857747633\",\n  \"status\": \"DELIVERED\",\n  \"to\": \"16197012345\",\n  \"type\": \"DLR\"\n}\n```\n\nEach request contains the following information:\n\n* `message_id` - the id of the message which has been returned following `/send`  request\n* `from` - the source address the message was sent from\n* `to` - the destination address which has received the message\n* `status`- the status of the message\n  * `DELIVERED` - Message has been delivered\n  * `EXPIRED` - Message wasn't delivered within the 48 hour period\n  * `UNDELIVERABLE` - Message wasn't delivered (check the `error`)\n  * `UNKNOWN` - Message wasn't delivered due to a unknown reason\n  * `REJECTED` - Message was rejected by the supplier (check the `error`)\n* `type`- type of the callback, either `DLR` for delivery notification or `MO` for mobile originated message\n* `error` - The error code returned by the supplier (check the table below for possible values)\n\n| EC   | ERROR DESCRIPTION                                                                                  |\n| ---- | -------------------------------------------------------------------------------------------------- |\n| 0    | DELIVERED                                                                                          |\n| 1    | UNKNOWN_SUBSCRIBER                                                                                 |\n| 5    | UNIDENTIFIED_SUBSCRIBER                                                                            |\n| 9    | ILLEGAL_SUBSCRIBER                                                                                 |\n| 11   | TELESERVICE_NOT_PROVISIONED                                                                        |\n| 13   | CALL_BARRED                                                                                        |\n| 21   | FACILITY_NOT_SUPPORTED                                                                             |\n| 27   | ABSENT_SUBSCRIBER                                                                                  |\n| 31   | SUBSCRIBER_BUSY_FOR_MT_SMS                                                                         |\n| 32   | DELIVERY_FAILURE                                                                                   |\n| 34   | SYSTEM_FAILURE                                                                                     |\n| 36   | UNEXPECTED_DATA_VALUE                                                                              |\n| 37   | MEMORY_CAPACITY_EXCEEDED                                                                           |\n| 38   | PREFIX_NOT_RESOLVED                                                                                |\n| 39   | IMSI_BLACKLISTED                                                                                   |\n| 40   | DEST_ADDRESS_BLACKLISTED                                                                           |\n| 41   | TIME_OUT                                                                                           |\n| 43   | INVALID_ORIGINATOR_ADDRESS                                                                         |\n| 100  | GENERAL_ERROR                                                                                      |\n| 200  | EQUIPMENT_PROTOCOL_ERROR                                                                           |\n| 201  | UNKNOWN_MSC                                                                                        |\n| 202  | CONGESTION_ERROR                                                                                   |\n| 203  | PARAMETER_MISSMATCH                                                                                |\n| 204  | INITIATING_RELEASE                                                                                 |\n| 205  | POTENTIAL_VERSION_INCOMPATIBILITY                                                                  |\n| 206  | REMOTE_NODE_NOT_REACHABLE                                                                          |\n| 207  | MTP_FAILURE                                                                                        |\n| 346  | CLIENT_NETWORK_FORBIDDEN (In a case of MNP being performed)                                        |\n| 351  | INVALID_PREFIX_OR_DESTINATION                                                                      |\n| 4100 | EXPIRED_ON_FORCE_RETRY (When the time to live has been configured for delivery and it has expired) |\n\n## Callback request example (MO - mobile originated message)\n\n### POST /<callback_url>\n\n```json\n{\n  \"from\": \"16197012345\",\n  \"message_id\": \"2d7114a6-bd45-4022-98ab-15d36cc2b9bd\",\n  \"text\": \"STOP\",\n  \"to\": \"18888112345\",\n  \"type\": \"MO\"\n}\n```\n\nEach request contains the following information:\n\n* `message_id` - the id of the mobile originated message\n* `from` - the mobile number the message has been sent from\n* `to` - the mobile number which has received the message\n* `type`- type of the callback, either `DLR` for delivery notification or `MO` for mobile originated message\n* `text` - the text of the message which has been sent `from` to `to` number\n","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string","format":"uuid"},"description":"Template id"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendRequest"}}}},"responses":{"200":{"description":"Accepted or rejected by business validation","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendResponse"}}}},"400":{"description":"Request invalid (e.g. missing uuid or template parameter validation failure)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendError"}}}},"401":{"description":"Unauthorized (missing/invalid API key)"},"404":{"description":"Template not found"},"500":{"description":"Failed to send"}}}}}}
````


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://api.bind.hr/messaging-api/send-templated-message.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
