> For the complete documentation index, see [llms.txt](https://user.netmera.com/netmera-developer-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/email-and-sms/send-email-or-sms.md). Agents can also search and read this documentation through its [MCP server](https://user.netmera.com/netmera-developer-guide/~gitbook/mcp).

# Send Email or SMS

Sends an email or an SMS to a user, with the message content in the request instead of a template created in the panel. The same endpoint creates a template for sending email or SMS to a user.

{% hint style="danger" %}
**Requests sent from Test it are real.** Test it opens a request panel; pressing **Send** in that panel calls the live API with the key you enter. With a production API key the email or SMS goes to the recipients in `target`, and `sendToAll: true` reaches all users of the app. Use a test application's key or your own address or phone number.
{% endhint %}

#### Capabilities

* **Email** — Set `platforms` to `["EMAIL"]` and send the address in `target.email`.
* **SMS** — Set `platforms` to `["SMS"]` and send the number in `target.msisdn`.
* **Templates** — Create an email or SMS template for later sends to a user.

#### How it works

The channel is chosen by the fields that are present, not by `platforms`: `from` creates an email and `smsHeader` an SMS.

For email, `emailIysMessageType` decides how the user's email permission applies:

* **`C` or omitted** — Commercial content, such as a campaign or newsletter. The user receives the email only if their email permission is on.
* **`N`** — Informational content, such as an account or order notice. The user receives the email even if their email permission is off.

<details>

<summary>Notes</summary>

* Use `N` only for informational content. Commercial content must be sent with `C`.
* `emailIysMessageType` is optional. When it is omitted, the request is accepted and the email has no IYS message type, so it reaches only users with email permission, like a commercial email.
* For SMS, the IYS fields are `smsIysMessageType` and `smsIysRecipientType`. They are needed when the SMS provider requires IYS fields.
* The address format is not validated when the request is received. A request with an invalid `target.email` returns 200 with a `notificationKey`.
* `senderName` is ignored. The sender name is the `from` value.

</details>

```json
{"openapi":"3.1.0","info":{"title":"Netmera REST API","version":"3.0"},"tags":[{"name":"Email and SMS","description":"Send email and SMS messages.\n\n<table data-view=\"cards\"><thead><tr><th></th><th></th><th data-hidden data-card-target data-type=\"content-ref\"></th></tr></thead><tbody><tr><td><strong>Send Email or SMS</strong></td><td><code>POST</code> Send an email or an SMS to one user, with the content in the request or from a template.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/email-and-sms/send-email-or-sms\">Send Email or SMS</a></td></tr><tr><td><strong>Send Email with Attachment</strong></td><td><code>POST</code> Send a panel email to one user with files attached.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/email-and-sms/send-email-with-attachment\">Send Email with Attachment</a></td></tr><tr><td><strong>Send Bulk Email</strong></td><td><code>POST</code> Send a panel email template to an audience, filling its placeholders at send time.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/email-and-sms/send-bulk-email\">Send Bulk Email</a></td></tr></tbody></table>\n"}],"servers":[{"url":"https://restapi.netmera.com","description":"Netmera REST API"}],"security":[{"REST-API-key":[]}],"components":{"securitySchemes":{"REST-API-key":{"type":"apiKey","in":"header","name":"X-netmera-api-key","description":"REST API key. Available in the Netmera Panel under Developers > API.\n"}},"schemas":{"EmailSmsRequest":{"type":"object","description":"Email or SMS message sent with its content included in the request.","properties":{"target":{"$ref":"#/components/schemas/Target"},"platforms":{"type":"array","description":"`[\"EMAIL\"]` for email, `[\"SMS\"]` for SMS.","items":{"$ref":"#/components/schemas/Platform"}},"title":{"type":"string","description":"Campaign name."},"message":{"type":"string","description":"Message body. For email this is the HTML content; for SMS the plain text.\n"},"from":{"type":"string","description":"Sender email address."},"senderName":{"type":"string","description":"Not read by the server: the sender name is always set to the value of `from`.\n"},"subject":{"type":"string","description":"Email subject line."},"smsHeader":{"type":"string","description":"SMS header."},"smsIysMessageType":{"type":"string","enum":["N","C","NOTIFICATION","CAMPAIGN"],"description":"`\"N\"` (or `NOTIFICATION`) for Notification, `\"C\"` (or `CAMPAIGN`) for Campaign; case-sensitive.\nRequired only when the application's SMS provider requires IYS fields; otherwise defaults to\nCampaign.\n"},"smsIysRecipientType":{"type":"string","enum":["B","T"],"description":"`\"B\"` for Personal, `\"T\"` for Trader; case-sensitive. Required when the application's SMS\nprovider requires IYS fields and ignored otherwise; an invalid value returns HTTP 400, code\n`2001`.\n"},"personalizedTitle":{"type":"string","description":"Personalized title with `@{attribute}` placeholders.\n"},"personalizedMessage":{"type":"string","description":"Personalized message with `@{attribute}` placeholders.\n"},"sendIfParamIsNull":{"type":"boolean","default":false,"description":"When `true`, users missing a personalization parameter still receive the default\n(non-personalized) title and message; applies to push, interactive push, web push and SMS.\nDefaults to `false`.\n"},"categories":{"type":"array","description":"Message categories as a JSON array; a single string is ignored. A string item is a category name\nand an integer item a category ID, and every category must exist.\n","items":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"threadId":{"type":"string","description":"ID used to group notifications in the notification center.\n"},"click":{"$ref":"#/components/schemas/ClickAction","description":"Click behavior: `url` has priority over `deeplink`, which has priority over `doNothing`.\n"},"hook":{"$ref":"#/components/schemas/Hook","description":"Hook attached to the message.\n"},"emailIysMessageType":{"type":"string","enum":["N","NOTIFICATION","C","CAMPAIGN","CAMPAIGN_ADVERTISEMENT"],"description":"IYS message type of the email, case-insensitive: `C` or `CAMPAIGN` for Campaign (commercial\ncontent), `N` or `NOTIFICATION` for Notification (informational content), or\n`CAMPAIGN_ADVERTISEMENT`. An invalid value returns HTTP 400, code `2004`; when omitted, no IYS\nmessage type is stored.\n"}},"additionalProperties":true},"Target":{"type":"object","description":"Recipients of the notification. It cannot be empty, so set `sendToAll` to `true` to reach all users\nof the selected platforms; profile attribute codes are listed in the panel under **Developers >\nProfile Attributes > Code**, several attributes in one `profile` object are combined with AND, and\nvalues of one attribute with OR.\n","properties":{"sendToAll":{"type":"boolean","description":"When true, the notification is dispatched to all users selected for the specified\nplatforms.\n"},"tag":{"$ref":"#/components/schemas/TargetOperatorList"},"segment":{"$ref":"#/components/schemas/TargetOperatorList"},"profile":{"type":"object","description":"Profile attribute conditions: each key is a profile attribute code and each value a single\nvalue, an array of values, or an operator object such as `{\"$exists\": true}`. The operators\n`$or` and `$and` can also wrap a group of attribute conditions.\n","additionalProperties":true},"pa":{"type":"object","description":"Profile attribute targeting used by `sendNotification`. Each key is a profile\nattribute code and each value a single value or an array of values (OR).\n","additionalProperties":true},"location":{"$ref":"#/components/schemas/Location"},"extId":{"description":"External ID of the target user, or an array of external IDs.\n","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"deviceToken":{"description":"Device token of the target device, or an array of device tokens.\n","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"email":{"type":"string","description":"Target email address."},"msisdn":{"type":"string","description":"Target phone number."},"wpNumber":{"description":"WhatsApp number in E.164 format (for example `+90xxxxxxxxxx`) or an array of numbers, used by\n`sendNotification` and `sendEmailAndSms`; an invalid number returns HTTP 400, code `2009`, and\n`sendEmailAndSms` creates a user when no user has the number. Only one identifier type is used\nper request; when several are sent, the first in this order wins: `extId`, `deviceToken`,\n`msisdn`, `email`, `wpNumber`, `iid`, `pa`.\n","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"iid":{"description":"Installation ID of the target device, or an array of installation IDs, used by\n`sendNotification` and `sendEmailAndSms`. Only one identifier type is used per request; when\nseveral are sent, the first in this order wins: `extId`, `deviceToken`, `msisdn`, `email`,\n`wpNumber`, `iid`, `pa`.\n","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]}},"additionalProperties":true},"TargetOperatorList":{"description":"A single value, an array of values (OR), or an operator object using `$or`, `$and` or\n`$not`.\n","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}},{"type":"object","properties":{"$or":{"type":"array","items":{"type":"string"}},"$and":{"type":"array","items":{"type":"string"}},"$not":{"type":"array","items":{"type":"string"}}},"additionalProperties":true}]},"Location":{"type":"object","description":"Geographical area used to target users based on their location.","required":["latitude","longitude","radius"],"properties":{"latitude":{"type":"number","description":"The latitude of the center point."},"longitude":{"type":"number","description":"The longitude of the center point."},"radius":{"type":"number","description":"The radius value, in kilometers, from the center to search for users.\n"}}},"Platform":{"type":"string","description":"Target platform, for example `IOS`, `ANDROID`, `CHROME`, `FIREFOX`, `SAFARI`, `EDGE`,\n`OPERA`, `YANDEX`, `MACOS`, `EMAIL` or `SMS`. Push statistics responses also report `WP`.\n"},"ClickAction":{"type":"object","description":"Click behavior of the notification: `url` opens a web page in the default browser, and `deeplink`\nopens the app through a registered, correctly configured deeplink URI (both iOS and Android).\n`doNothing` (Android only) turns off automatic click handling, so the app must implement a custom\nclick handler.\n","properties":{"url":{"type":"string","description":"Web page opened in the device's default browser."},"deeplink":{"type":"string","description":"Registered deeplink URI that launches the app."},"doNothing":{"type":"boolean","description":"Android only. No action is triggered when the user taps the notification."},"deeplinkCustomMapParams":{"type":"object","description":"Custom parameters applied with `deeplink`, accepted by `sendNotification` and\n`createNotificationDefinition`; in `sendNotification` each entry's `queryMaps` holds at most\n1000 entries (otherwise HTTP 400, code `2004`). `sendBulkNotification` rejects it with HTTP 400,\ncode `2009`.\n","additionalProperties":true}},"additionalProperties":true},"Hook":{"type":"object","description":"Optional hook parameters. If no hook is to be attached, exclude the hook block from the\nrequest.\n","properties":{"name":{"type":"string","description":"Name of an existing hook, required when `hook` is sent. For `sendBulkNotification` the hook must\nbe defined for push messages.\n"},"params":{"type":"object","description":"Hook parameters. For `sendBulkNotification` it must contain every required push\nparameter of the hook and no keys the hook does not define.\n","additionalProperties":true}}},"NetmeraError":{"type":"object","description":"Standard Netmera error body.","required":["code","error"],"properties":{"code":{"type":"integer","description":"Netmera error code. See the error table in the API description."},"error":{"type":"string","description":"Human readable error message."}}}},"responses":{"InvalidApiKey":{"description":"The `X-netmera-api-key` header is missing or the key is not valid.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NetmeraError"}}}},"IpNotAllowed":{"description":"The application restricts REST calls to a list of allowed IP addresses and the caller's\nIP is not on it. The check runs after the API key is validated and before the request\nbody and parameters are validated, so a restricted application returns this error even\nfor a malformed request.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NetmeraError"}}}}}},"paths":{"/rest/3.0/sendEmailAndSms":{"post":{"operationId":"sendEmailAndSms","tags":["Email and SMS"],"summary":"Send Email or SMS","description":"Sends an email or an SMS to a user, with the message content in the request instead of a template\ncreated in the panel. The same endpoint creates a template for sending email or SMS to a user.\n\n{% hint style=\"danger\" %}\n**Requests sent from Test it are real.** Test it opens a request panel; pressing **Send** in\nthat panel calls the live API with the key you enter. With a production API key the email or\nSMS goes to the recipients in `target`, and `sendToAll: true` reaches all users of the app.\nUse a test application's key or your own address or phone number.\n{% endhint %}\n\n### Capabilities\n\n- **Email** — Set `platforms` to `[\"EMAIL\"]` and send the address in `target.email`.\n- **SMS** — Set `platforms` to `[\"SMS\"]` and send the number in `target.msisdn`.\n- **Templates** — Create an email or SMS template for later sends to a user.\n\n### How it works\n\nThe channel is chosen by the fields that are present, not by `platforms`: `from` creates an email\nand `smsHeader` an SMS.\n\nFor email, `emailIysMessageType` decides how the user's email permission applies:\n- **`C` or omitted** — Commercial content, such as a campaign or newsletter. The user receives the\n  email only if their email permission is on.\n- **`N`** — Informational content, such as an account or order notice. The user receives the email\n  even if their email permission is off.\n\n<details>\n\n<summary>Notes</summary>\n\n- Use `N` only for informational content. Commercial content must be sent with `C`.\n- `emailIysMessageType` is optional. When it is omitted, the request is accepted and the email has\n  no IYS message type, so it reaches only users with email permission, like a commercial email.\n- For SMS, the IYS fields are `smsIysMessageType` and `smsIysRecipientType`. They are needed when\n  the SMS provider requires IYS fields.\n- The address format is not validated when the request is received. A request with an invalid\n  `target.email` returns 200 with a `notificationKey`.\n- `senderName` is ignored. The sender name is the `from` value.\n\n</details>\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailSmsRequest"}}}},"responses":{"200":{"description":"The message was accepted. `notificationKey` identifies the created message.","content":{"application/json":{"schema":{"type":"object","properties":{"notificationKey":{"type":"integer"}}}}}},"400":{"description":"No platform or no target.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NetmeraError"}}}},"401":{"$ref":"#/components/responses/InvalidApiKey"},"403":{"$ref":"#/components/responses/IpNotAllowed"},"500":{"description":"Error responses the API can return.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NetmeraError"}}}}}}}}}
```


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/email-and-sms/send-email-or-sms.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
