---
updatedAt: 2026-06-24T17:27:55.000Z
agentTools:
  projectIndex: https://marketing.developer.dotdigital.com/llms.txt
---

# Create subscription

Creates a events subscription. 

The `name` passed must be unique within the accounts subscriptions

If you apply filters to your event subscription then **all filters must match** (logical AND) for the event to be captured.

If you want to match the same event type on multiple different sets of filters (logical OR) then add the event type multiple time to the subscription with differing filters.

<br />

<Callout icon="📢" theme="default">
  ### Public preview

  This feature is in Public preview and should be considered a beta feature. It may be subject to service disruption and short notice changes or improvements.
</Callout>

***

The `name` passed must be unique within the account's subscriptions.

More details on the events you can subscribe to can be [found here](https://marketing.developer.dotdigital.com/reference/export-events#events) .

If you apply filters to your event subscription then **all filters must match** (logical AND) for the event to be captured. If you want to match the same event type on multiple different sets of filters (logical OR) then add the event type multiple times to the subscription with differing filters.

> [Learn more about events and subscriptions](https://marketing.developer.dotdigital.com/reference/export-events)

<span class="callRateLow" />

<br />

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "info": {
    "title": "Events",
    "description": "Send and receive events with Dotdigital. Use this API to import batches of\ncontact-associated events, manage event subscriptions (create, retrieve, update,\nand delete), retrieve queued events for a subscription using checkpoint-based\npagination, and download large objects referenced in event data.",
    "version": "3.1.1-Events-in-out"
  },
  "externalDocs": {
    "description": "Learn more about Dotdigital APIs",
    "url": "https://developer.dotdigital.com"
  },
  "servers": [
    {
      "url": "https://{region}-api.dotdigital.com",
      "variables": {
        "region": {
          "description": "The Dotdigital region id your account belongs to",
          "enum": [
            "r1",
            "r2",
            "r3"
          ],
          "default": "r1"
        }
      }
    }
  ],
  "security": [
    {
      "basicAuth": []
    }
  ],
  "paths": {
    "/events/v3/export/subscriptions": {
      "post": {
        "tags": [
          "Subscriptions"
        ],
        "summary": "Create subscription",
        "description": "Creates a events subscription. \n\nThe `name` passed must be unique within the accounts subscriptions\n\nIf you apply filters to your event subscription then **all filters must match** (logical AND) for the event to be captured.\n\nIf you want to match the same event type on multiple different sets of filters (logical OR) then add the event type multiple time to the subscription with differing filters.",
        "operationId": "createSubscription",
        "parameters": [
          {
            "name": "x-ddg-integration-token",
            "in": "header",
            "description": "If you are a partner of Dotdigital and have a [verified integration](https://developer.dotdigital.com/docs/partner-integration-verification) then include your [integration tracking token](https://developer.dotdigital.co/docs/verified-integration-tracking) here.",
            "required": false,
            "schema": {
              "pattern": "/^(?:\\{{0,1}(?:[0-9a-fA-F]){8}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){4}-(?:[0-9a-fA-F]){12}\\}{0,1})$/",
              "type": "string",
              "example": "5a96bc79-19a7-4544-973b-e2da0c9136f9"
            }
          },
          {
            "name": "x-ddg-calling-system",
            "in": "header",
            "description": "_Dotdigital use only_ The calling systems identifier",
            "required": false,
            "schema": {
              "maxLength": 60,
              "type": "string",
              "default": "customer"
            }
          }
        ],
        "requestBody": {
          "description": "Subscription details",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/subscriptionRequest"
              },
              "examples": {
                "Event subscription": {
                  "description": "Example of subscribing to multiple events.",
                  "value": {
                    "name": "Campaign events",
                    "status": "active",
                    "subscribedEventTypes": [
                      {
                        "eventType": "message.sent"
                      },
                      {
                        "eventType": "message.status",
                        "filters": [
                          {
                            "field": "$.channel",
                            "matchPattern": "sms"
                          },
                          {
                            "field": "$.status",
                            "matchPattern": "failed"
                          }
                        ]
                      }
                    ],
                    "alertsConfiguration": {
                      "alertChannels": "emailAndInApp",
                      "email": "alerts@emailsim.io"
                    }
                  }
                },
                "An OR event subscription": {
                  "description": "Subscribing to the same event multiple times to create a logical OR. This example includes all `message.sent` events sent on the `sms` or `whatsApp` channel.",
                  "value": {
                    "name": "Campaign events",
                    "status": "active",
                    "subscribedEventTypes": [
                      {
                        "eventType": "message.sent",
                        "filters": [
                          {
                            "field": "$.channel",
                            "matchPattern": "sms"
                          }
                        ]
                      },
                      {
                        "eventType": "message.sent",
                        "filters": [
                          {
                            "field": "$.channel",
                            "matchPattern": "whatsApp"
                          }
                        ]
                      }
                    ],
                    "alertsConfiguration": {
                      "alertChannels": "emailAndInApp",
                      "email": "alerts@emailsim.io"
                    }
                  }
                }
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Subscription created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/subscription"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponse"
                },
                "examples": {
                  "unknownEventType": {
                    "value": {
                      "errorCode": "events:invalidEventType",
                      "description": "The type value 'example.unknownType' is invalid."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized"
          },
          "403": {
            "description": "Forbidden"
          },
          "409": {
            "description": "Name conflict",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/errorResponse"
                },
                "example": {
                  "errorCode": "events:nameAlreadyExists",
                  "description": "The name value 'Camapign events' already exists. All names must be unique!"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "subscriptionStatus": {
        "type": "string",
        "description": "The subscription status.",
        "enum": [
          "active",
          "inactive"
        ],
        "default": "inactive"
      },
      "subscriptionRequest": {
        "required": [
          "alertsConfiguration",
          "name",
          "status",
          "subscribedEventTypes"
        ],
        "type": "object",
        "properties": {
          "name": {
            "maxLength": 50,
            "minLength": 1,
            "type": "string",
            "description": "Descriptive name for the subscription.",
            "example": "Campaign events"
          },
          "status": {
            "$ref": "#/components/schemas/subscriptionStatus"
          },
          "subscribedEventTypes": {
            "maxItems": 100,
            "minItems": 1,
            "type": "array",
            "description": "The  event types this subscription collects.",
            "example": [
              {
                "eventType": "message.sent"
              },
              {
                "eventType": "message.status",
                "filters": [
                  {
                    "field": "$.channel",
                    "matchPattern": "sms"
                  }
                ]
              }
            ],
            "items": {
              "$ref": "#/components/schemas/eventType"
            }
          },
          "alertsConfiguration": {
            "description": "Alert options to use if we detect issues with the subscription.",
            "oneOf": [
              {
                "title": "No alerts",
                "required": [
                  "alertChannels"
                ],
                "type": "object",
                "properties": {
                  "alertChannels": {
                    "type": "string",
                    "description": "The type(s) of channels to be alerted on.",
                    "enum": [
                      "none"
                    ]
                  }
                },
                "description": "No alerts"
              },
              {
                "title": "In app alerts only",
                "required": [
                  "alertChannels"
                ],
                "type": "object",
                "properties": {
                  "alertChannels": {
                    "type": "string",
                    "description": "The type(s) of channels to be alerted on.",
                    "enum": [
                      "inApp"
                    ]
                  }
                },
                "description": "In app alerts only"
              },
              {
                "title": "Email alerts only",
                "required": [
                  "alertChannels",
                  "email"
                ],
                "type": "object",
                "properties": {
                  "alertChannels": {
                    "type": "string",
                    "description": "The type(s) of channels to be alerted on.",
                    "enum": [
                      "email"
                    ]
                  },
                  "email": {
                    "type": "string",
                    "description": "The email address to send alerts regarding this subscription to.",
                    "format": "email",
                    "example": "alerts@emailsim.io"
                  }
                },
                "description": "Email alerts only"
              },
              {
                "title": "Email and in-app alerts",
                "required": [
                  "alertChannels",
                  "email"
                ],
                "type": "object",
                "properties": {
                  "alertChannels": {
                    "type": "string",
                    "description": "The type(s) of channels to be alerted on.",
                    "enum": [
                      "emailAndInApp"
                    ]
                  },
                  "email": {
                    "type": "string",
                    "description": "The email address to send alerts regarding this subscription to.",
                    "format": "email",
                    "example": "alerts@emailsim.io"
                  }
                },
                "description": "Email and in-app alerts"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "subscription": {
        "allOf": [
          {
            "required": [
              "created",
              "id",
              "updated"
            ],
            "type": "object",
            "properties": {
              "id": {
                "type": "integer",
                "description": "The subscriptions unique identifier.",
                "example": 95
              },
              "created": {
                "type": "string",
                "description": "The UTC date time in ISO 8601 format when the subscription was created.",
                "format": "date-time",
                "example": "2025-02-07T16:23:33.741Z"
              },
              "updated": {
                "type": "string",
                "description": "The UTC date time in ISO 8601 format when the subscription was updated.",
                "format": "date-time",
                "example": "2025-02-11T01:33:00Z"
              }
            },
            "additionalProperties": false
          },
          {
            "$ref": "#/components/schemas/subscriptionRequest"
          }
        ]
      },
      "filter": {
        "required": [
          "field",
          "matchPattern"
        ],
        "type": "object",
        "properties": {
          "field": {
            "type": "string",
            "description": "The [JSON path](https://en.wikipedia.org/wiki/JSONPath) to the field to match against.\n\nNote: The base ($) is the `eventData` field.\n",
            "example": "$.channel"
          },
          "matchPattern": {
            "maxLength": 1024,
            "minLength": 1,
            "type": "string",
            "description": "The literal value or pattern to match against the value of the field.\nYou use the following syntax to define the match pattern:\n* `*` matches any number of any characters including none\n* `?` matches any single character\n* `[abc]` matches one character given in the brackets\n* `[a-z]` matches one character from the range given in the bracket\n* `[!abc]` matches one character _that is not_ given in the brackets\n* `[!a-z]` matches one character _that is not_ from the range given in the bracket\n\n_Note: Filters use the Unicode character set and ranges must be from lower to higher code points to be valid. e.g. `[a-z]` is valid but `[z-a]` is invalid_\n",
            "example": "http?://*"
          },
          "caseSensitive": {
            "type": "boolean",
            "description": "Whether the matching should be case sensitive.",
            "default": true
          }
        },
        "additionalProperties": false,
        "description": "An inclusive filter that must be matched to include the event.\n"
      },
      "eventType": {
        "required": [
          "eventType"
        ],
        "type": "object",
        "properties": {
          "eventType": {
            "type": "string",
            "description": "The  event type",
            "example": "email.read"
          },
          "filters": {
            "maxItems": 5,
            "minItems": 1,
            "type": "array",
            "description": "Capture only events that match these filters.\n\nAll filters will be accessed and **all must match for the event to be captured!**\n",
            "items": {
              "$ref": "#/components/schemas/filter"
            }
          }
        },
        "additionalProperties": false,
        "description": "An event type and any inclusive filters that should be applied."
      },
      "errorResponse": {
        "required": [
          "description",
          "errorCode"
        ],
        "type": "object",
        "properties": {
          "errorCode": {
            "type": "string",
            "description": "Unique error code"
          },
          "description": {
            "type": "string",
            "description": "Description of the issue"
          },
          "details": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/errorResponse_details"
            }
          }
        }
      },
      "errorResponse_details": {
        "required": [
          "description",
          "item"
        ],
        "type": "object",
        "properties": {
          "item": {
            "type": "string",
            "description": "Item the error is associated with, for example, field name, unique identifier for an entity or item in batch"
          },
          "description": {
            "type": "string",
            "description": "Description of the error"
          }
        }
      }
    },
    "securitySchemes": {
      "basicAuth": {
        "type": "http",
        "scheme": "basic"
      }
    }
  },
  "x-samples-languages": [
    "curl",
    "csharp",
    "java",
    "javascript",
    "node",
    "python",
    "php",
    "ruby"
  ]
}
```

# Sibling pages

* [List subscriptions](https://marketing.developer.dotdigital.com/reference/listsubscriptions.md)
* [Gets subscription](https://marketing.developer.dotdigital.com/reference/getsubscription.md)
* [Update subscription](https://marketing.developer.dotdigital.com/reference/updatesubscription.md)
* [Deletes subscription](https://marketing.developer.dotdigital.com/reference/deletesubscription.md)