> 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/push-notifications/create-notification-definition.md). Agents can also search and read this documentation through its [MCP server](https://user.netmera.com/netmera-developer-guide/~gitbook/mcp).

# Create Notification Definition

Creates a transactional notification definition. Send it later with `sendNotification`, using the returned `notificationKey`.

#### Capabilities

* **Interactive push** — Send `buttonSet`.
* **Email** — Send `from`.
* **SMS** — Send `smsHeader`.
* **Web push** — Include a web platform in `platforms`.
* **Live activity** — Send `contentState`.
* **Mobile push** — The default when none of the fields above is sent.

#### How it works

1. Create the definition once. Its type is chosen by the fields present, in the order listed above: the first match wins.
2. Store the returned `notificationKey`.
3. Call `sendNotification` with that key for each message.

<details>

<summary>Notes</summary>

* The push text is `message`; `text` is not read.
* Web platforms are Chrome, Firefox, Safari (macOS), Opera, Edge, Yandex and other web browsers. Mobile platforms are iOS and Android.
* A definition that mixes a web platform with iOS or Android returns HTTP 400 with the body `{"error": "You cannot select platforms which belong to different push types"}`.
* The Windows desktop platform belongs to neither group for this check.
* Live activity messages created through this endpoint are exempt from the application's user message limits. They are not filtered out when a user reaches the limit, and they do not increase the user's message count.
* Live activity definitions saved by an earlier API version still count towards the limits. Create a new definition instead of reusing such a key.

</details>

```json
{"openapi":"3.1.0","info":{"title":"Netmera REST API","version":"3.0"},"tags":[{"name":"Push Notifications","description":"Send push notifications to an audience or to individual users.\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 Bulk Notification</strong></td><td><code>POST</code> Send one message to an audience: tags, segments, profile attributes, a location or everyone.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/push-notifications/send-bulk-notification\">Send Bulk Notification</a></td></tr><tr><td><strong>Create Notification Definition</strong></td><td><code>POST</code> Create a reusable transactional message once; use its key for every personal send.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/push-notifications/create-notification-definition\">Create Notification Definition</a></td></tr><tr><td><strong>Send Transactional Notification</strong></td><td><code>POST</code> Send a personal message, such as an OTP or an order update, to one or more users.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/push-notifications/send-transactional-notification\">Send Transactional Notification</a></td></tr><tr><td><strong>Start, Update or End Live Activity</strong></td><td><code>POST</code> Start, update or end an iOS Live Activity for a group.</td><td><a href=\"https://user.netmera.com/netmera-developer-guide/api-documentation/api-reference/push-notifications/start-update-or-end-live-activity\">Start, Update or End Live Activity</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":{"NotificationDefinitionRequest":{"type":"object","description":"Transactional notification definition.","properties":{"title":{"type":"string","description":"Campaign name. Inside the iOS and Android blocks, `title` sets the notification title shown on\nthat platform.\n"},"message":{"description":"Default push notification text, sent to users when no personalized message is used.\n","type":"string"},"text":{"type":"string","description":"Not read by the server. The push text is taken from `message`.\n"},"personalizedMessage":{"type":"string","description":"Personalized message with `@{xxxx}` placeholders, filled from profile attributes or from values\nsent in a transactional message call.\n"},"personalizedTitle":{"type":"string","description":"Personalized title using a placeholder."},"personalizedSubText":{"type":"string","description":"Personalized subtext using a placeholder."},"inbox":{"type":"boolean","description":"Whether to display the push notification in the inbox."},"platforms":{"type":"array","description":"Platforms that can receive this notification.","items":{"$ref":"#/components/schemas/Platform"}},"categories":{"description":"Message categories. Either the category ID shown in the panel under\n**Settings > Message Categories** or the category name may be used, so values can be\nstrings or integers.\n","oneOf":[{"type":"string"},{"type":"array","items":{"oneOf":[{"type":"string"},{"type":"integer"}]}}]},"labels":{"description":"Label information added to the message. The label appears in the push report\ngenerated on the panel.\n","oneOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}]},"threadId":{"type":"string","description":"ID used to group notifications in the notification center."},"click":{"$ref":"#/components/schemas/ClickAction"},"buttonSet":{"$ref":"#/components/schemas/ButtonSet"},"ios":{"$ref":"#/components/schemas/IosOptions"},"android":{"$ref":"#/components/schemas/AndroidOptions"},"hook":{"$ref":"#/components/schemas/Hook"},"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"},"from":{"type":"string","description":"Sender email address, also used as the sender name. Its presence makes the definition an\nemail definition (unless `buttonSet` is sent).\n"},"subject":{"type":"string","description":"Email subject line of an email definition.\n"},"emailIysMessageType":{"type":"string","enum":["N","NOTIFICATION","C","CAMPAIGN","CAMPAIGN_ADVERTISEMENT"],"description":"IYS message type of an email definition, case-insensitive: `N` or `NOTIFICATION` for\nNotification, `C` or `CAMPAIGN` for Campaign, or `CAMPAIGN_ADVERTISEMENT`. An invalid value\nreturns HTTP 400, code `2004`; when omitted, no IYS message type is stored on the definition.\n"},"smsHeader":{"type":"string","description":"SMS header. Its presence makes the definition an SMS definition, unless `buttonSet` or\n`from` is also sent.\n"},"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"},"contentState":{"type":"object","description":"Dynamic content state of a live activity. Its presence (without `buttonSet`, `from`,\n`smsHeader` or a web platform) makes the definition a live activity definition.\n","additionalProperties":true},"liveActAttr":{"type":"object","description":"Static attributes of the live activity. Live activity definitions only.\n","additionalProperties":true},"liveActAttrType":{"type":"string","description":"Attribute type of the live activity as defined in the app. Required for live activity\ndefinitions (otherwise HTTP 400, code `2020`).\n"},"priority":{"type":"integer","description":"Delivery priority of the live activity, as a JSON integer. Live activity definitions only.\n"}},"additionalProperties":true},"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},"ButtonSet":{"type":"object","description":"Button set attached to the notification, created first in the panel under **Settings > Button\nSets**; the button name itself is not mandatory. Each additional key is a button name mapped to its\naction URL (`$buttonSetName: $actionUrl`).\n","properties":{"id":{"type":"integer","description":"Button set ID, visible in the panel under Settings > Button Sets.\n"},"buttonNames":{"type":"object","description":"Renames buttons by mapping each old button name to a new one. If this field is\nomitted, notifications are sent with the existing button names.\n","additionalProperties":{"type":"string"}},"setAttrOrTag":{"type":"object","description":"Maps a button name to the profile attribute or tag set when that button is clicked.\n","additionalProperties":{"$ref":"#/components/schemas/SetAttrOrTagEntry"}}},"additionalProperties":true},"SetAttrOrTagEntry":{"type":"object","description":"Profile attribute or tag set when a button is clicked. The button click action must be\nset to \"Open App\"; the operation is triggered after the push open event inside the\napplication module.\n","properties":{"setOnClick":{"type":"string","description":"`PROFILE_ATTR` for the profile attribute flow.\n"},"attrName":{"type":"string","description":"Profile attribute name."},"attrValue":{"type":"string","description":"Profile attribute value."},"tagName":{"type":"string","description":"Tag name applied on click."}},"additionalProperties":true},"IosOptions":{"type":"object","description":"Optional parameters specific to iOS.","properties":{"title":{"type":"string","description":"Title of the push notification on iOS."},"subtitle":{"type":"string"},"sound":{"type":"string","description":"Name of a sound defined in the panel under Developers > Sounds, per platform.\n"},"badge":{"type":"boolean","description":"Badge display. Badges are enabled only for iOS."},"mediaUrl":{"type":"string","description":"Rich media URL. On iOS an image, sound or video may be used."},"thumbnailUrl":{"type":"string"},"limit":{"type":"integer","description":"Maximum number of iOS users the notification is sent to."},"click":{"$ref":"#/components/schemas/ClickAction"},"carousel":{"type":"array","items":{"$ref":"#/components/schemas/CarouselItem"}},"slider":{"type":"array","items":{"$ref":"#/components/schemas/SliderItem"}},"icon":{"type":"string","description":"Name of the notification icon on iOS.\n"}},"additionalProperties":true},"CarouselItem":{"type":"object","description":"One item of a carousel push.","properties":{"title":{"type":"string"},"content":{"type":"string"},"itemImageUrl":{"type":"string"},"clickAction":{"$ref":"#/components/schemas/CarouselItemClickAction"}},"additionalProperties":true},"CarouselItemClickAction":{"type":"object","description":"Click action of a carousel or slider item.","properties":{"action":{"type":"string","description":"Action type, for example DEEP_LINK."},"url":{"type":"string"},"deeplinkType":{"type":"string","description":"Deeplink type, for example URL."},"deepLinkUrl":{"type":"string"}},"additionalProperties":true},"SliderItem":{"type":"object","description":"One item of a slider push.","properties":{"itemImageUrl":{"type":"string"},"clickAction":{"$ref":"#/components/schemas/CarouselItemClickAction"}},"additionalProperties":true},"AndroidOptions":{"type":"object","description":"Optional parameters specific to Android.","properties":{"title":{"type":"string","description":"Title of the push notification on Android."},"subtitle":{"type":"string"},"sound":{"type":"string","description":"Name of a sound defined in the panel under Developers > Sounds, per platform.\n"},"vibration":{"type":"boolean","description":"Android only. Enables or disables vibration when a device receives the push\nnotification.\n"},"bigText":{"type":"string"},"mediaUrl":{"type":"string","description":"Rich media URL. On Android an image may be used."},"thumbnailUrl":{"type":"string"},"limit":{"type":"integer","description":"Maximum number of Android users the notification is sent to."},"click":{"$ref":"#/components/schemas/ClickAction"},"carousel":{"type":"array","items":{"$ref":"#/components/schemas/CarouselItem"}},"slider":{"type":"array","items":{"$ref":"#/components/schemas/SliderItem"}},"channelName":{"type":"string","description":"Name of an existing Android notification channel of the app; when set, `sound` and `soundUrl`\nare ignored. Accepted by `sendBulkNotification` and `sendNotification`.\n"},"soundUrl":{"type":"string","description":"URL of a custom notification sound. Used only when `sound` is empty.\n"},"icon":{"type":"string","description":"Name of the small notification icon. As a per-call override in `sendNotification` it is\nnot applied.\n"},"iconDark":{"type":"string","description":"Name of the small notification icon used in dark mode. As a per-call override in\n`sendNotification` it is not applied.\n"}},"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."}}},"ProblemDetail":{"type":"object","description":"RFC 7807 error body returned by the framework instead of the Netmera error body when a\nrequired query parameter is missing or a parameter cannot be converted to its type.\n","properties":{"type":{"type":"string"},"title":{"type":"string"},"status":{"type":"integer"},"detail":{"type":"string"},"instance":{"type":"string"}}}},"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/createNotificationDefinition":{"post":{"operationId":"createNotificationDefinition","tags":["Push Notifications"],"summary":"Create Notification Definition","description":"Creates a transactional notification definition. Send it later with `sendNotification`, using the\nreturned `notificationKey`.\n\n### Capabilities\n\n- **Interactive push** — Send `buttonSet`.\n- **Email** — Send `from`.\n- **SMS** — Send `smsHeader`.\n- **Web push** — Include a web platform in `platforms`.\n- **Live activity** — Send `contentState`.\n- **Mobile push** — The default when none of the fields above is sent.\n\n### How it works\n\n1. Create the definition once. Its type is chosen by the fields present, in the order listed above:\n   the first match wins.\n2. Store the returned `notificationKey`.\n3. Call `sendNotification` with that key for each message.\n\n<details>\n\n<summary>Notes</summary>\n\n- The push text is `message`; `text` is not read.\n- Web platforms are Chrome, Firefox, Safari (macOS), Opera, Edge, Yandex and other web browsers.\n  Mobile platforms are iOS and Android.\n- A definition that mixes a web platform with iOS or Android returns HTTP 400 with the body\n  `{\"error\": \"You cannot select platforms which belong to different push types\"}`.\n- The Windows desktop platform belongs to neither group for this check.\n- Live activity messages created through this endpoint are exempt from the application's user\n  message limits. They are not filtered out when a user reaches the limit, and they do not increase\n  the user's message count.\n- Live activity definitions saved by an earlier API version still count towards the limits. Create a\n  new definition instead of reusing such a key.\n\n</details>\n","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationDefinitionRequest"}}}},"responses":{"200":{"description":"The definition was created. `notificationKey` is the identifier of the message\ndefinition, used in transactional message calls.\n","content":{"application/json":{"schema":{"type":"object","required":["notificationKey"],"properties":{"notificationKey":{"type":"integer","description":"Identifier of the created message definition."}}}}}},"400":{"description":"Error responses the API can return.","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/NetmeraError"},{"type":"object","description":"Error body without a Netmera code.","required":["error"],"properties":{"error":{"type":"string"}}}]}},"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetail"}}}},"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/push-notifications/create-notification-definition.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.
