---
title: "Create a notification definition"
method: POST
path: "/notifications/notification-definitions"
tags: ["Notifications"]
---

# Create a notification definition

`POST /notifications/notification-definitions`

Creates a notification definition. If a filter rule is specified, it will be evaluated to see if the notification definition is qualified to handle the incoming events during runtime. If the notification is qualified, it will send the email and invoke the callout if it has an email template or a callout.

This operation supports creating notification definitions for all event types:

- To create a notification definition for a standard event, you must specify the `eventCategory` field. For more information about standard event category codes, see <a href="https://docs.zuora.com?resourceId=platform-parent-and-event-category-code" target="_blank">Standard event category code for events and notifications</a>.
- To create a notification definition for a Zuora custom event, custom event, or custom scheduled event, you must specify the `eventTypeName` field. For more information, see <a href="https://docs.zuora.com?resourceId=platform-zuora-custom-event-overview" target="_blank">Zuora custom events</a>, [Custom event triggers](https://developer.zuora.com/api-references/api/tag/Custom-Event-Triggers/), and [Custom scheduled events](https://developer.zuora.com/api-references/api/tag/Custom-Scheduled-Events/).
  
You must specify either `eventCategory` or `eventTypeName`, but not both at the same time.

## Headers

- `Idempotency-Key` string
- `Accept-Encoding` string
- `Content-Encoding` string
- `Zuora-Track-Id` string
- `Zuora-Entity-Ids` string
- `Zuora-Org-Ids` string

## Request body

- POSTPublicNotificationDefinitionRequest
  - `active` boolean — The status of the notification definition. The default value is `true`.
  - `associatedAccount` string — The account on which the histories of this notification will be displayed. The associated account does not enforce where the merge fields come from. Available values are as follows: * `Account.Id`: ID of the primary customer account related to the notification. It is also the default value. * `ParentAccount.Id`: this option is available only if you have <a href="https://docs.zuora.com?resourceId=billing-overview-customer-accounts" target="_blank">Customer Hierarchy</a> enabled for your tenant. * `SubscriptionOwnerAccount.Id`: this option is available if the base object of the notification is Order Action. **Note:** before specifying this field, we recommend that you use [Data Source](https://docs.zuora.com?resourceId=platform-data-source-reference) to check the available types of accounts for the current notification.
  - `callout` union — If this field is specified, Zuora will create a new callout template when creating the notification definition and associate the template with the notification definition. You cannot specify the `calloutTemplateIds` and `callout` fields at the same time. For more information about callout templates, see <a href="https://docs.zuora.com?resourceId=platform-callout-template-overview" target="_blank">Manage callout templates</a>.
    - POSTPublicNotificationDefinitionCalloutCommon — Common information for callout notifications.
      - `active` boolean — The status of the callout. The default is `true`.
      - `calloutBaseurl` string, url, required — The callout URL. It must start with 'https://'. Zuora uses port 443 to send callout notifications by default. If you want to use other ports, submit a request at <a href="http://support.zuora.com/" target="_blank">Zuora Global Support</a>.
      - `calloutParams` CalloutMergeFields — A key-value map of merge fields of this callout.
      - `calloutRetry` boolean — Specified whether to retry the callout when the callout fails. The default value is `true`.
      - `description` string — Description for the callout.
      - `eventTypeName` string — The name of the event type. The value must be the same as the parent-level `eventTypeName` field.
      - `httpMethod` 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE', required — The HTTP method of the callout.
      - `name` string, required — The name of the callout template that will be created. It must be unique across all callout templates.
    - POSTPublicNotificationDefinitionCalloutBasicAuthentication — The Basic Authentication information for callout notifications.
      - `active` boolean — The status of the callout. The default is `true`.
      - `calloutBaseurl` string, url, required — The callout URL. It must start with 'https://'. Zuora uses port 443 to send callout notifications by default. If you want to use other ports, submit a request at <a href="http://support.zuora.com/" target="_blank">Zuora Global Support</a>.
      - `calloutParams` CalloutMergeFields — A key-value map of merge fields of this callout.
      - `calloutRetry` boolean — Specified whether to retry the callout when the callout fails. The default value is `true`.
      - `description` string — Description for the callout.
      - `eventTypeName` string — The name of the event type. The value must be the same as the parent-level `eventTypeName` field.
      - `httpMethod` 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE', required — The HTTP method of the callout.
      - `name` string, required — The name of the callout template that will be created. It must be unique across all callout templates.
      - `requiredAuth` boolean, required — Indicates whether Basic authentication is enabled for the callout. When creating callout notifications with Basic authentication enabled, you must set this field to `true` and specify the username and password in `calloutAuth`.
      - `calloutAuth` CalloutAuth, nullable — If `requiredAuth` is `true`, this object is required.
        - `domain` string — The domain of the callout auth.
        - `password` string — The field is required when `requiredAuth` is `true`.
        - `preemptive` boolean — Set this field to `true` if you want to enable the preemptive authentication.
        - `username` string — The field is required when `requiredAuth` is `true`.
    - POSTPublicNotificationDefinitionCalloutOauth2Authentication — The OAuth 2.0 Authentication information for callout notifications.
      - `active` boolean — The status of the callout. The default is `true`.
      - `calloutBaseurl` string, url, required — The callout URL. It must start with 'https://'. Zuora uses port 443 to send callout notifications by default. If you want to use other ports, submit a request at <a href="http://support.zuora.com/" target="_blank">Zuora Global Support</a>.
      - `calloutParams` CalloutMergeFields — A key-value map of merge fields of this callout.
      - `calloutRetry` boolean — Specified whether to retry the callout when the callout fails. The default value is `true`.
      - `description` string — Description for the callout.
      - `eventTypeName` string — The name of the event type. The value must be the same as the parent-level `eventTypeName` field.
      - `httpMethod` 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE', required — The HTTP method of the callout.
      - `name` string, required — The name of the callout template that will be created. It must be unique across all callout templates.
      - `requiredOauth2` boolean, required — Indicates whether OAuth 2.0 authentication is enabled for the callout. When creating callout notifications with OAuth 2.0 authentication enabled, you must set this field to `true` and specify the OAuth 2.0 provider ID in `oauth2ProviderId`.
      - `oauth2ProviderId` unknown
  - `calloutActive` boolean — The status of the callout action. The default value is `false`.
  - `calloutTemplateIds` string[] — List of callout template IDs that the notification definition is associated with. You cannot specify the `calloutTemplateIds` and `callout` fields at the same time. For more information about callout templates, see <a href="https://docs.zuora.com?resourceId=platform-callout-template-overview" target="_blank">Manage callout templates</a>.
  - `communicationProfileId` string — The ID of the communication profile that the notification definition is associated with. You can use the [Query Action](https://developer.zuora.com/api-references/api/operation/Action_POSTquery) to get the communication profile Id. See the following request sample: `{ "queryString": "select Id, ProfileName from CommunicationProfile" }` If you do not pass the communicationProfileId, notification service will be automatically added to the 'Default Profile'. If you want to associate the notification definition with multiple communication profiles, use the `communicationProfileIds` field, which overrides this field.
  - `communicationProfileIds` string[] — List of communication profile IDs that the notification definition is associated with. This field overrides the `communicationProfileId` field.
  - `description` string — The description of the notification definition.
  - `emailActive` boolean — The status of the email action. The default value is `false`.
  - `emailTemplateId` string, uuid — The ID of the email template. If `emailActive` is `true`, an email template is required. And EventType of the email template MUST be the same as the eventType.
  - `eventCategory` number — The event category code for a standard event, on which the notification definition is created. This field is required when creating notification definitions for standard events. For the list of supported standard event category codes, see <a href="https://docs.zuora.com?resourceId=platform-parent-and-event-category-code" target="_blank">Standard event category code for events and notifications</a>.
  - `eventTypeName` string — The name of the event that the notification definition is based on. This field is required when creating notification definitions for Zuora custom events, custom events, or custom scheduled events. If this field is provided, you can specify the event namespace in the `eventTypeNamespace` field.
  - `eventTypeNamespace` 'user.notification' | 'com.zuora.notification' — The namespace of the `eventTypeName` field. It indicates who created the event and which namespace the event is assigned to. Supported values are as follows: - `com.zuora.notification`: events that are created by Zuora. This value applies to Zuora custom events. - `user.notification`: events that are created by tenant users. This value applies to custom events and custom scheduled events. This is the default value. For example, if you want to create a notification definition on the `OrderActionProcessed` event, which is a Zuora custom event, you must specify `com.zuora.notification` for this field.
  - `filterRule` object
    - `condition` string, required — The filter rule conditions, written in [JEXL](http://commons.apache.org/proper/commons-jexl/). The rule might contain event context merge fields and data source merge fields. Data source merge fields must be from [the base object of the event or from the joined objects of the base object](https://docs.zuora.com?resourceId=platform-data-source-reference). Notifications with invalid merge fields will fail to evaluate, thus will not be invoked. For example, to filter an invoice posted notification to only invoices with an amount over 1000, you would define the following condition: ```Invoice.Amount > 1000.0``` There are conventions and keywords you need to be aware of. For example: * `Invoice.Amount` refers to the `Amount` field of the Zuora object `Invoice`. * Unlike Event Triggers, there is no access to variables with the `_old` suffix. Fields with the `_old` suffix are only available on Event Trigger conditions.
    - `description` string — The description of the filter rule.
    - `parameters` FilterRuleParameterDefinitions, required — The parameters of the filter rule and their name must match those in the filter rule. And all parameters must be defined in the event type payload. The name of parameters can't be duplicate. The following reserved keywords should not be used as a parameter name: `AttachmentList`, `RecipientList`, `RecipientType`, `Exceptions`, `OCP_OBJECT_TYPE`, `OCP_OBJECT_ID`, `OCP_TRIGGER_BY`
  - `filterRuleParams` FilterRuleParameterValues — The parameter values used to configure the filter rule.
  - `name` string, required — The name of the notification definition, unique per communication profile.

## Response `200`

OK

- GETPublicNotificationDefinitionResponse
  - `active` boolean — The status of the notification definition. The default value is `true`.
  - `associatedAccount` string, nullable — The account on which the histories of this notification will be displayed. The associated account does not enforce where the merge fields come from.
  - `callout` object, nullable
    - `active` boolean — The status of the callout. The default value is `true`.
    - `calloutAuth` CalloutAuth, nullable — If `requiredAuth` is `true`, this object is required.
      - `domain` string — The domain of the callout auth.
      - `password` string — The field is required when `requiredAuth` is `true`.
      - `preemptive` boolean — Set this field to `true` if you want to enable the preemptive authentication.
      - `username` string — The field is required when `requiredAuth` is `true`.
    - `calloutBaseurl` string, url — The callout URL. It must start with 'https://'
    - `calloutParams` CalloutMergeFields — A key-value map of merge fields of this callout.
    - `calloutRetry` boolean — Specified whether to retry the callout when the callout fails. The default value is `true`.
    - `description` string — Description for the callout.
    - `eventTypeName` string — The name of the custom event type.
    - `httpMethod` 'POST' | 'GET' | 'PUT' | 'PATCH' | 'DELETE' — The HTTP method of the callout.
    - `id` string, uuid — The ID of the callout. If `calloutActive` is `true`, a callout is required. The eventTypeName of the callout MUST be the same as the eventTypeName.
    - `name` string — The name of the created callout.
    - `oauth2ProviderId` string — The ID of the OAuth 2.0 provider in your tenant that provides access tokens for the callout.
    - `requiredAuth` boolean — Indicates whether Basic authentication is enabled for the callout.
    - `requiredOauth2` boolean — Indicates whether OAuth 2.0 authentication is enabled for the callout.
  - `calloutActive` boolean — The status of the callout action. The default value is `false`.
  - `calloutTemplateIds` string[] — List of callout template IDs that the notification definition is associated with.
  - `communicationProfileId` string, uuid — The ID of the communication profile that the notification definition is associated with. If the notification definition is associated with multiple communication profiles, see `communicationProfileIds` for all associated communication profile IDs.
  - `communicationProfileIds` string[] — List of communication profile IDs that the notification definition is associated with.
  - `createdBy` string, uuid — The ID of the user who created the notification definition.
  - `createdOn` string — The time when the notification definition was created. Specified in the UTC timezone in the ISO860 format (YYYY-MM-DDThh:mm:ss.sTZD). E.g. 1997-07-16T19:20:30.45+00:00
  - `description` string, nullable — Description of the notification definition
  - `emailActive` boolean — The status of the email action. The default value is `false`.
  - `emailTemplateId` string, uuid — The ID of the email template. In the request, there should be at least one email template or callout.
  - `eventCategory` number — The event category code for a standard event, on which the notification definition is created. This field is available only if the notification definition is based on a standard event. For the list of supported standard event category codes, see <a href="https://docs.zuora.com?resourceId=platform-parent-and-event-category-code" target="_blank">Standard event category code for events and notifications</a>.
  - `eventId` string, uuid — The ID of the event that the notification definition is based on. This field is available only if the notification definition is based on a standard event.
  - `eventTypeName` string — The name of the event that the notification definition is based on. This field is available only if the notification definition is based on a Zuora custom event, custom event, or custom scheduled event.
  - `eventTypeNamespace` 'user.notification' | 'com.zuora.notification' — The namespace of the `eventTypeName` field. It indicates who created the event and which namespace the event is assigned to. Supported values are as follows: - `com.zuora.notification`: events that are created by Zuora. This value applies to Zuora custom events. - `user.notification`: events that are created by tenant users. This value applies to custom events and custom scheduled events. This field is available only if the notification definition is based on a Zuora custom event, custom event, or custom scheduled event.
  - `filterRule` object
    - `condition` string — The filter rule conditions, written in [JEXL](http://commons.apache.org/proper/commons-jexl/). The rule might contain event context merge fields and data source merge fields. Data source merge fields must be from [the base object of the event or from the joined objects of the base object](https://docs.zuora.com?resourceId=platform-data-source-reference). Notifications with invalid merge fields will fail to evaluate, thus will not be invoked. For example, to trigger an event when an invoice is posted with the amount over 1000, you would define the following condition on the `Invoice` object: ```changeType == 'UPDATE' && Invoice.Status == 'Posted' && Invoice.Status_old != 'Posted' && Invoice.Amount > 1000.0``` There are conventions and keywords you need to be aware of. For example: * `changeType` is a keyword to specify what kind of change happened to the object. Allowed values are `INSERT`, `UPDATE` or `DELETE`. * `Invoice.Status` refers to field `Status` of the Zuora object `Invoice`. * A variable with the `_old` suffix means it’s a previous value of the corresponding object field. The "_old" fields are only available on the base objects.
    - `description` string — The description of the filter rule.
    - `eventTypeName` string — The value is `null`.
    - `id` string, uuid — The ID of the filter rule. If not specified or null, the notification definition is always qualified to process events of "eventType".
    - `parameters` FilterRuleParameterDefinitions — The parameters of the filter rule and their name must match those in the filter rule. And all parameters must be defined in the event type payload. The name of parameters can't be duplicate. The following reserved keywords should not be used as a parameter name: `AttachmentList`, `RecipientList`, `RecipientType`, `Exceptions`, `OCP_OBJECT_TYPE`, `OCP_OBJECT_ID`, `OCP_TRIGGER_BY`
  - `filterRuleParams` FilterRuleParameterValues — The parameter values used to configure the filter rule.
  - `id` string, uuid — The ID associated with this notification definition.
  - `name` string — The name of the notification definition.
  - `updatedBy` string, uuid — The ID of the user who updated the notification definition.
  - `updatedOn` string — The time when the notification was updated. Specified in the UTC timezone in the ISO860 format (YYYY-MM-DDThh:mm:ss.sTZD). E.g. 1997-07-16T19:20:30.45+00:00

## Other responses

- `400` — Bad Request
- `404` — Not Found
- `405` — Method Not Allowed
- `415` — Unsupported Media Type
- `500` — Internal Server Error

---

[API](https://skmtc.dev/zuora/apis/api-reference.md) · [All operations](https://skmtc.dev/zuora/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/zuora/api-reference/revisions/d11e237f3e54/schema)
