# Create a notification definition 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 Standard event category code for events and notifications. - 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 Zuora custom events, Custom event triggers, and Custom scheduled events. You must specify either eventCategory or eventTypeName, but not both at the same time. Endpoint: POST /notifications/notification-definitions Version: 2026-02-20 Security: bearerAuth ## Header parameters: - `Idempotency-Key` (string) Specify a unique idempotency key if you want to perform an idempotent POST or PATCH request. Do not use this header in other request types. With this header specified, the Zuora server can identify subsequent retries of the same request using this value, which prevents the same operation from being performed multiple times by accident. - `Accept-Encoding` (string) Include the Accept-Encoding: gzip header to compress responses as a gzipped file. It can significantly reduce the bandwidth required for a response. If specified, Zuora automatically compresses responses that contain over 1000 bytes of data, and the response contains a Content-Encoding header with the compression algorithm so that your client can decompress it. - `Content-Encoding` (string) Include the Content-Encoding: gzip header to compress a request. With this header specified, you should upload a gzipped file for the request payload instead of sending the JSON payload. - `Zuora-Track-Id` (string) A custom identifier for tracing the API call. If you set a value for this header, Zuora returns the same value in the response headers. This header enables you to associate your system process identifiers with Zuora API calls, to assist with troubleshooting in the event of an issue. The value of this field must use the US-ASCII character set and must not include any of the following characters: colon (:), semicolon (;), double quote ("), and quote ('). - `Zuora-Entity-Ids` (string) An entity ID. If you have Zuora Multi-entity enabled and the OAuth token is valid for more than one entity, you must use this header to specify which entity to perform the operation in. If the OAuth token is only valid for a single entity, or you do not have Zuora Multi-entity enabled, you should not set this header. - `Zuora-Org-Ids` (string) Comma separated IDs. If you have Zuora Multi-Org enabled, you can use this header to specify which orgs to perform the operation in. If you do not have Zuora Multi-Org enabled, you should not set this header. The IDs must be a sub-set of the user's accessible orgs. If you specify an org that the user does not have access to, the operation fails. This header is important in Multi-Org (MO) setups because it defines the organization context under which the API should operate—mainly used for read access or data visibility filtering. If the header is not set, the operation is performed in scope of the user's accessible orgs. ## Request fields (application/json): - `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 Customer Hierarchy 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://knowledgecenter.zuora.com/Billing/Reporting/D_Data_Sources_and_Exports/C_Data_Source_Reference) to check the available types of accounts for the current notification. - `callout` (any) 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 Manage callout templates. - `calloutActive` (boolean) The status of the callout action. The default value is false. - `calloutTemplateIds` (array) 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 Manage callout templates. - `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` (array) 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) 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 Standard event category code for events and notifications. - `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` (string) 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. Enum: "user.notification", "com.zuora.notification" - `filterRule` (object) - `filterRule.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://knowledgecenter.zuora.com/DC_Developers/M_Export_ZOQL#Data_Sources_and_Objects). 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. Example: "Account.Balance >= _VIP_BALANCE_AMOUNT && Account.Status == _ACCOUNT_STATUS" - `filterRule.description` (string) The description of the filter rule. - `filterRule.parameters` (object, 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` (object) The parameter values used to configure the filter rule. - `name` (string, required) The name of the notification definition, unique per communication profile. ## Response 200 fields (application/json): - `active` (boolean) The status of the notification definition. The default value is true. Example: 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. - `callout` (object) - `callout.active` (boolean) The status of the callout. The default value is true. - `callout.calloutAuth` (object,null) If requiredAuth is true, this object is required. - `callout.calloutAuth.domain` (string) The domain of the callout auth. - `callout.calloutAuth.password` (string) The field is required when requiredAuth is true. - `callout.calloutAuth.preemptive` (boolean) Set this field to true if you want to enable the preemptive authentication. - `callout.calloutAuth.username` (string) The field is required when requiredAuth is true. - `callout.calloutBaseurl` (string) The callout URL. It must start with 'https://' Example: "https://***" - `callout.calloutParams` (object) A key-value map of merge fields of this callout. - `callout.calloutRetry` (boolean) Specified whether to retry the callout when the callout fails. The default value is true. - `callout.description` (string) Description for the callout. - `callout.eventTypeName` (string) The name of the custom event type. - `callout.httpMethod` (string) The HTTP method of the callout. Enum: "POST", "GET", "PUT", "PATCH", "DELETE" - `callout.id` (string) 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. - `callout.name` (string) The name of the created callout. - `callout.oauth2ProviderId` (string) The ID of the OAuth 2.0 provider in your tenant that provides access tokens for the callout. - `callout.requiredAuth` (boolean) Indicates whether Basic authentication is enabled for the callout. - `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` (array) List of callout template IDs that the notification definition is associated with. Example: [] - `communicationProfileId` (string) 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. Example: "2c92c0f9446cd49501447539d6a72815" - `communicationProfileIds` (array) List of communication profile IDs that the notification definition is associated with. Example: ["2c92c0f9446cd49501447539d6a72815"] - `createdBy` (string) The ID of the user who created the notification definition. Example: "8ad084a67f9c7138017fab8a8b511b5a" - `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 Example: "2024-11-11T03:00:03.000 UTC" - `description` (string) Description of the notification definition - `emailActive` (boolean) The status of the email action. The default value is false. Example: true - `emailTemplateId` (string) The ID of the email template. In the request, there should be at least one email template or callout. Example: "f11e498862584a10a05b83ea70119659" - `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 Standard event category code for events and notifications. - `eventId` (string) 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. Example: "AccountEdit" - `eventTypeNamespace` (string) 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. Enum: "user.notification", "com.zuora.notification" - `filterRule` (object) Example: {"id":"a1efc8cc717e48208b9f0fd5d7bf2a58","createdBy":"8ad084a67f9c7138017fab8a8b511b5a","createdOn":"2024-11-11T03:00:04.000 UTC","updatedBy":null,"updatedOn":null,"description":"Filter rule to test if an account is a VIP account","condition":"Account.Balance >= _VIP_BALANCE_AMOUNT && Account.Status == _ACCOUNT_STATUS","parameters":{"_ACCOUNT_STATUS":{"displayName":"VIP Account Status","description":"The status of the VIP Account","options":["Draft","Active","Canceled"],"valueType":"STRING"},"_VIP_BALANCE_AMOUNT":{"displayName":"VIP Account Balance","description":"The minimum account balance","options":null,"valueType":"BIG_DECIMAL"}},"scheduled":false} - `filterRule.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://knowledgecenter.zuora.com/DC_Developers/M_Export_ZOQL#Data_Sources_and_Objects). 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. Example: "Account.Balance >= _VIP_BALANCE_AMOUNT && Account.Status == _ACCOUNT_STATUS" - `filterRule.description` (string) The description of the filter rule. Example: "Filter rule to test if an account is a VIP account" - `filterRule.eventTypeName` (string) The value is null. - `filterRule.id` (string) The ID of the filter rule. If not specified or null, the notification definition is always qualified to process events of "eventType". Example: "a1efc8cc717e48208b9f0fd5d7bf2a58" - `filterRule.parameters` (object) 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` (object) The parameter values used to configure the filter rule. - `id` (string) The ID associated with this notification definition. Example: "838bfafa9b224408809f8ecbdae198ef" - `name` (string) The name of the notification definition. Example: "Account Edit Notification" - `updatedBy` (string) The ID of the user who updated the notification definition. Example: "8ad084a67f9c7138017fab8a8b511b5a" - `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 Example: "2024-11-11T03:00:03.000 UTC" ## Response 400 fields (application/json): - `reasons` (array) Example: [{"code":"ObjectNotFound","message":"Notification definition with id 6e569e1e05f040eda51a927b140c0ac1 does not exist"}] - `reasons.code` (string) The error code of response. - `reasons.message` (string) The detail information of the error response ## Response 404 fields (application/json): - `reasons` (array) Example: [{"code":"ObjectNotFound","message":"Notification definition with id 6e569e1e05f040eda51a927b140c0ac1 does not exist"}] - `reasons.code` (string) The error code of response. - `reasons.message` (string) The detail information of the error response ## Response 405 fields (application/json): - `reasons` (array) Example: [{"code":"ObjectNotFound","message":"Notification definition with id 6e569e1e05f040eda51a927b140c0ac1 does not exist"}] - `reasons.code` (string) The error code of response. - `reasons.message` (string) The detail information of the error response ## Response 415 fields (application/json): - `reasons` (array) Example: [{"code":"ObjectNotFound","message":"Notification definition with id 6e569e1e05f040eda51a927b140c0ac1 does not exist"}] - `reasons.code` (string) The error code of response. - `reasons.message` (string) The detail information of the error response ## Response 500 fields (application/json): - `reasons` (array) Example: [{"code":"ObjectNotFound","message":"Notification definition with id 6e569e1e05f040eda51a927b140c0ac1 does not exist"}] - `reasons.code` (string) The error code of response. - `reasons.message` (string) The detail information of the error response