> ## Documentation Index
> Fetch the complete documentation index at: https://novu-c5de82d9-docs-homepage-redesign.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create topic subscriptions

> Create topic subscriptions using the Novu REST API. Requires your environment secret key in the Authorization header.



## OpenAPI

````yaml POST /v2/topics/{topicKey}/subscriptions
openapi: 3.0.0
info:
  title: Novu API
  description: >-
    Novu REST API. Please see https://docs.novu.co/api-reference for more
    details.
  version: 3.15.0
  contact:
    name: Novu Support
    url: https://discord.gg/novu
    email: support@novu.co
  termsOfService: https://novu.co/terms
  license:
    name: MIT
    url: https://opensource.org/license/mit
servers:
  - url: https://api.novu.co
  - url: https://eu.api.novu.co
security:
  - secretKey: []
tags:
  - name: Events
    description: >-
      Events represent a change in state of a subscriber. They are used to
      trigger workflows, and enable you to send notifications to subscribers
      based on their actions.
    externalDocs:
      url: https://docs.novu.co/workflows
  - name: Subscribers
    description: >-
      A subscriber in Novu represents someone who should receive a message. A
      subscriber's profile information contains important attributes about the
      subscriber that will be used in messages (name, email). The subscriber
      object can contain other key-value pairs that can be used to further
      personalize your messages.
    externalDocs:
      url: https://docs.novu.co/subscribers/subscribers
  - name: Topics
    description: >-
      Topics are a way to group subscribers together so that they can be
      notified of events at once. A topic is identified by a custom key. This
      can be helpful for things like sending out marketing emails or notifying
      users of new features. Topics can also be used to send notifications to
      the subscribers who have been grouped together based on their interests,
      location, activities and much more.
    externalDocs:
      url: https://docs.novu.co/subscribers/topics
  - name: Integrations
    description: >-
      With the help of the Integration Store, you can easily integrate your
      favorite delivery provider. During the runtime of the API, the
      Integrations Store is responsible for storing the configurations of all
      the providers.
    externalDocs:
      url: https://docs.novu.co/platform/integrations/overview
  - name: Workflows
    description: >-
      All notifications are sent via a workflow. Each workflow acts as a
      container for the logic and blueprint that are associated with a type of
      notification in your system.
    externalDocs:
      url: https://docs.novu.co/workflows
  - name: Messages
    description: >-
      A message in Novu represents a notification delivered to a recipient on a
      particular channel. Messages contain information about the request that
      triggered its delivery, a view of the data sent to the recipient, and a
      timeline of its lifecycle events. Learn more about messages.
    externalDocs:
      url: https://docs.novu.co/workflows/messages
  - name: Environments
    description: >-
      Environments allow you to manage different stages of your application
      development lifecycle. Each environment has its own set of API keys and
      configurations, enabling you to separate development, staging, and
      production workflows.
    externalDocs:
      url: https://docs.novu.co/platform/environments
  - name: Layouts
    description: Layouts are reusable wrappers for your email notifications.
    externalDocs:
      url: https://docs.novu.co/platform/workflow/layouts
  - name: Translations
    description: Used to localize your notifications to different languages.
    externalDocs:
      url: https://docs.novu.co/platform/workflow/advanced-features/translations
  - name: Domains
    description: Used to manage your inbound email domains.
    externalDocs:
      url: https://docs.novu.co/platform/domains
externalDocs:
  description: Novu Documentation
  url: https://docs.novu.co
paths:
  /v2/topics/{topicKey}/subscriptions:
    post:
      tags:
        - Topics
      summary: Create topic subscriptions
      description: |-
        This api will create subscription for subscriberIds for a topic. 
              Its like subscribing to a common interest group. if topic does not exist, it will be created.
      operationId: TopicsController_createTopicSubscriptions
      parameters:
        - name: topicKey
          required: true
          in: path
          description: The key identifier of the topic
          schema:
            type: string
        - name: idempotency-key
          in: header
          description: A header for idempotency purposes
          required: false
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateTopicSubscriptionsRequestDto'
      responses:
        '201':
          description: Subscriptions created successfully
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSubscriptionsResponseDto'
        '400':
          description: Bad Request
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '401':
          description: Unauthorized
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '403':
          description: Forbidden
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '404':
          description: Not Found
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '405':
          description: Method Not Allowed
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '409':
          description: Conflict
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '413':
          description: Payload Too Large
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '414':
          description: URI Too Long
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '415':
          description: Unsupported Media Type
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '422':
          description: Unprocessable Entity
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorDto'
        '429':
          description: 'The client has sent too many requests in a given amount of time. '
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
            Retry-After:
              $ref: '#/components/headers/Retry-After'
          content:
            application/json:
              schema:
                type: string
                example: API rate limit exceeded
        '500':
          description: Internal Server Error
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDto'
        '503':
          description: >-
            The server is currently unable to handle the request due to a
            temporary overload or scheduled maintenance, which will likely be
            alleviated after some delay.
          headers:
            Content-Type:
              $ref: '#/components/headers/Content-Type'
            RateLimit-Limit:
              $ref: '#/components/headers/RateLimit-Limit'
            RateLimit-Remaining:
              $ref: '#/components/headers/RateLimit-Remaining'
            RateLimit-Reset:
              $ref: '#/components/headers/RateLimit-Reset'
            RateLimit-Policy:
              $ref: '#/components/headers/RateLimit-Policy'
            Idempotency-Key:
              $ref: '#/components/headers/Idempotency-Key'
            Idempotency-Replay:
              $ref: '#/components/headers/Idempotency-Replay'
            Retry-After:
              $ref: '#/components/headers/Retry-After'
          content:
            application/json:
              schema:
                type: string
                example: Please wait some time, then try again.
      security:
        - secretKey: []
      x-codeSamples:
        - lang: php
          label: PHP
          source: >-
            declare(strict_types=1);


            require 'vendor/autoload.php';


            use novu;

            use novu\Models\Components;


            $sdk = novu\Novu::builder()
                ->setSecurity(
                    'YOUR_SECRET_KEY_HERE'
                )
                ->build();

            $createTopicSubscriptionsRequestDto = new
            Components\CreateTopicSubscriptionsRequestDto(
                subscriptions: [
                    new Components\TopicSubscriberIdentifierDto(
                        identifier: 'subscriber-123-subscription-a',
                        subscriberId: 'subscriber-123',
                    ),
                    new Components\TopicSubscriberIdentifierDto(
                        identifier: 'subscriber-456-subscription-b',
                        subscriberId: 'subscriber-456',
                    ),
                ],
                name: 'My Topic',
                context: [
                    'key' => 'org-acme',
                ],
                preferences: [
                    new Components\WorkflowPreferenceRequestDto(
                        condition: [
                            '===' => [
                                [
                                    'var' => 'tier',
                                ],
                                'premium',
                            ],
                        ],
                        workflowId: 'workflow-123',
                    ),
                ],
            );


            $response = $sdk->topics->subscriptions->create(
                topicKey: '<value>',
                createTopicSubscriptionsRequestDto: $createTopicSubscriptionsRequestDto

            );


            if ($response->createSubscriptionsResponseDto !== null) {
                // handle response
            }
        - lang: python
          label: Python
          source: |-
            from novu_py import Novu


            with Novu(
                secret_key="YOUR_SECRET_KEY_HERE",
            ) as novu:

                res = novu.topics.subscriptions.create(topic_key="<value>", create_topic_subscriptions_request_dto={
                    "subscriptions": [
                        {
                            "identifier": "subscriber-123-subscription-a",
                            "subscriber_id": "subscriber-123",
                        },
                        {
                            "identifier": "subscriber-456-subscription-b",
                            "subscriber_id": "subscriber-456",
                        },
                    ],
                    "name": "My Topic",
                    "context": {
                        "key": "org-acme",
                    },
                    "preferences": [
                        {
                            "condition": {
                                "===": [
                                    {
                                        "var": "tier",
                                    },
                                    "premium",
                                ],
                            },
                            "workflow_id": "workflow-123",
                        },
                    ],
                })

                # Handle response
                print(res)
        - lang: go
          label: Go
          source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/novuhq/novu-go/v3\"\n\t\"github.com/novuhq/novu-go/v3/models/components\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := v3.New(\n        v3.WithSecurity(\"YOUR_SECRET_KEY_HERE\"),\n    )\n\n    res, err := s.Topics.Subscriptions.Create(ctx, \"<value>\", components.CreateTopicSubscriptionsRequestDto{\n        Subscriptions: []components.Subscriptions{\n            components.CreateSubscriptionsTopicSubscriberIdentifierDto(\n                components.TopicSubscriberIdentifierDto{\n                    Identifier: \"subscriber-123-subscription-a\",\n                    SubscriberID: \"subscriber-123\",\n                },\n            ),\n            components.CreateSubscriptionsTopicSubscriberIdentifierDto(\n                components.TopicSubscriberIdentifierDto{\n                    Identifier: \"subscriber-456-subscription-b\",\n                    SubscriberID: \"subscriber-456\",\n                },\n            ),\n        },\n        Name: v3.Pointer(\"My Topic\"),\n        Context: map[string]components.CreateTopicSubscriptionsRequestDtoContext{\n            \"key\": components.CreateCreateTopicSubscriptionsRequestDtoContextStr(\n                \"org-acme\",\n            ),\n        },\n        Preferences: []components.Preferences{\n            components.CreatePreferencesWorkflowPreferenceRequestDto(\n                components.WorkflowPreferenceRequestDto{\n                    Condition: map[string]any{\n                        \"===\": []any{\n                            map[string]any{\n                                \"var\": \"tier\",\n                            },\n                            \"premium\",\n                        },\n                    },\n                    WorkflowID: \"workflow-123\",\n                },\n            ),\n        },\n    }, nil)\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.CreateSubscriptionsResponseDto != nil {\n        // handle response\n    }\n}"
        - lang: typescript
          label: TypeScript
          source: |-
            import { Novu } from "@novu/api";

            const novu = new Novu({
              secretKey: "YOUR_SECRET_KEY_HERE",
            });

            async function run() {
              const result = await novu.topics.subscriptions.create({
                subscriptions: [
                  {
                    identifier: "subscriber-123-subscription-a",
                    subscriberId: "subscriber-123",
                  },
                  {
                    identifier: "subscriber-456-subscription-b",
                    subscriberId: "subscriber-456",
                  },
                ],
                name: "My Topic",
                context: {
                  "key": "org-acme",
                },
                preferences: [
                  {
                    condition: {
                      "===": [
                        {
                          "var": "tier",
                        },
                        "premium",
                      ],
                    },
                    workflowId: "workflow-123",
                  },
                ],
              }, "<value>");

              console.log(result);
            }

            run();
        - lang: csharp
          label: Csharp (SDK)
          source: |-
            using Novu;
            using Novu.Models.Components;
            using System.Collections.Generic;

            var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");

            var res = await sdk.Topics.Subscriptions.CreateAsync(
                topicKey: "<value>",
                createTopicSubscriptionsRequestDto: new CreateTopicSubscriptionsRequestDto() {
                    Subscriptions = new List<Novu.Models.Components.Subscriptions>() {
                        Novu.Models.Components.Subscriptions.CreateTopicSubscriberIdentifierDto(
                            new TopicSubscriberIdentifierDto() {
                                Identifier = "subscriber-123-subscription-a",
                                SubscriberId = "subscriber-123",
                            }
                        ),
                        Novu.Models.Components.Subscriptions.CreateTopicSubscriberIdentifierDto(
                            new TopicSubscriberIdentifierDto() {
                                Identifier = "subscriber-456-subscription-b",
                                SubscriberId = "subscriber-456",
                            }
                        ),
                    },
                    Name = "My Topic",
                    Context = new Dictionary<string, CreateTopicSubscriptionsRequestDtoContext>() {
                        { "key", CreateTopicSubscriptionsRequestDtoContext.CreateStr(
                            "org-acme"
                        ) },
                    },
                    Preferences = new List<Novu.Models.Components.Preferences>() {
                        Novu.Models.Components.Preferences.CreateWorkflowPreferenceRequestDto(
                            new WorkflowPreferenceRequestDto() {
                                Condition = new Dictionary<string, object>() {
                                    { "===", new List<object>() {
                                        new Dictionary<string, object>() {
                                            { "var", "tier" },
                                        },
                                        "premium",
                                    } },
                                },
                                WorkflowId = "workflow-123",
                            }
                        ),
                    },
                }
            );

            // handle response
components:
  schemas:
    CreateTopicSubscriptionsRequestDto:
      type: object
      properties:
        subscriberIds:
          description: >-
            List of subscriber IDs to subscribe to the topic (max: 100).
            @deprecated Use the "subscriptions" property instead.
          example:
            - subscriberId1
            - subscriberId2
          deprecated: true
          type: array
          items:
            type: string
        subscriptions:
          type: array
          description: >-
            List of subscriptions to subscribe to the topic (max: 100). Can be
            either a string array of subscriber IDs or an array of objects with
            identifier and subscriberId
          items:
            oneOf:
              - type: string
              - $ref: '#/components/schemas/TopicSubscriberIdentifierDto'
          example:
            - identifier: subscriber-123-subscription-a
              subscriberId: subscriber-123
            - identifier: subscriber-456-subscription-b
              subscriberId: subscriber-456
        name:
          type: string
          description: The name of the topic
          example: My Topic
        context:
          type: object
          additionalProperties:
            oneOf:
              - type: string
                description: Simple context id
                example: org-acme
              - type: object
                description: Rich context object with id and optional data
                properties:
                  id:
                    type: string
                    example: org-acme
                  data:
                    type: object
                    description: Optional additional context data
                    additionalProperties: true
                    example:
                      name: Acme Corp
                      region: us-east-1
                required:
                  - id
        preferences:
          type: array
          description: >-
            The preferences of the topic. Can be a simple workflow ID string,
            workflow preference object, or group filter object
          items:
            oneOf:
              - type: string
              - $ref: '#/components/schemas/WorkflowPreferenceRequestDto'
              - $ref: '#/components/schemas/GroupPreferenceFilterDto'
          example:
            - workflowId: workflow-123
              condition:
                '===':
                  - var: tier
                  - premium
    CreateSubscriptionsResponseDto:
      type: object
      properties:
        data:
          description: The list of successfully created subscriptions
          type: array
          items:
            $ref: '#/components/schemas/SubscriptionResponseDto'
        meta:
          description: Metadata about the operation
          allOf:
            - $ref: '#/components/schemas/MetaDto'
        errors:
          description: The list of errors for failed subscription attempts
          type: array
          items:
            $ref: '#/components/schemas/SubscriptionErrorDto'
      required:
        - data
        - meta
    ErrorDto:
      type: object
      properties:
        statusCode:
          type: number
          description: HTTP status code of the error response.
          example: 404
        timestamp:
          type: string
          description: Timestamp of when the error occurred.
          example: '2024-12-12T13:00:00Z'
        path:
          type: string
          description: The path where the error occurred.
          example: /api/v1/resource
        message:
          description: Value that failed validation
          oneOf:
            - type: string
              nullable: true
            - type: number
            - type: boolean
            - type: object
              nullable: true
            - type: array
              items:
                anyOf:
                  - type: string
                    nullable: true
                  - type: number
                  - type: boolean
                  - type: object
                    additionalProperties: true
          example: 'xx xx xx '
        ctx:
          type: object
          description: Optional context object for additional error details.
          additionalProperties: true
          example:
            workflowId: some_wf_id
            stepId: some_wf_id
        errorId:
          type: string
          description: >-
            Optional unique identifier for the error, useful for tracking using
            Sentry and 
                  New Relic, only available for 500.
          example: abc123
      required:
        - statusCode
        - timestamp
        - path
    ValidationErrorDto:
      type: object
      properties:
        statusCode:
          type: number
          description: HTTP status code of the error response.
          example: 404
        timestamp:
          type: string
          description: Timestamp of when the error occurred.
          example: '2024-12-12T13:00:00Z'
        path:
          type: string
          description: The path where the error occurred.
          example: /api/v1/resource
        message:
          description: Value that failed validation
          oneOf:
            - type: string
              nullable: true
            - type: number
            - type: boolean
            - type: object
              nullable: true
            - type: array
              items:
                anyOf:
                  - type: string
                    nullable: true
                  - type: number
                  - type: boolean
                  - type: object
                    additionalProperties: true
          example: 'xx xx xx '
        ctx:
          type: object
          description: Optional context object for additional error details.
          additionalProperties: true
          example:
            workflowId: some_wf_id
            stepId: some_wf_id
        errorId:
          type: string
          description: >-
            Optional unique identifier for the error, useful for tracking using
            Sentry and 
                  New Relic, only available for 500.
          example: abc123
        errors:
          type: object
          description: A record of validation errors keyed by field name
          additionalProperties:
            $ref: '#/components/schemas/ConstraintValidation'
          example:
            fieldName1:
              messages:
                - Field is required
                - Must be a valid email address
              value: invalidEmail
            fieldName2:
              messages:
                - Must be at least 18 years old
              value: 17
            fieldName3:
              messages:
                - Must be a boolean value
              value: true
            fieldName4:
              messages:
                - Must be a valid object
              value:
                key: value
            fieldName5:
              messages:
                - Field is missing
              value: null
            fieldName6:
              messages:
                - Undefined value
      required:
        - statusCode
        - timestamp
        - path
        - errors
    TopicSubscriberIdentifierDto:
      type: object
      properties:
        identifier:
          type: string
          description: Unique identifier for this subscription
          example: subscriber-123-subscription-a
        subscriberId:
          type: string
          description: The subscriber ID
          example: subscriber-123
        name:
          type: string
          description: The name of the subscription
          example: My Subscription
      required:
        - identifier
        - subscriberId
    WorkflowPreferenceRequestDto:
      type: object
      properties:
        enabled:
          type: boolean
          description: >-
            Whether the preference is enabled. Used when condition is not
            provided.
          example: true
        condition:
          type: object
          description: Optional condition using JSON Logic rules
          additionalProperties: true
          example:
            and:
              - '===':
                  - var: tier
                  - premium
        workflowId:
          type: string
          description: The workflow identifier
          example: workflow-123
      required:
        - workflowId
    GroupPreferenceFilterDto:
      type: object
      properties:
        enabled:
          type: boolean
          description: >-
            Whether the preference is enabled. Used when condition is not
            provided.
          example: true
        condition:
          type: object
          description: Optional condition using JSON Logic rules
          additionalProperties: true
          example:
            and:
              - '===':
                  - var: tier
                  - premium
        filter:
          description: Filter criteria for workflow IDs and tags
          allOf:
            - $ref: '#/components/schemas/GroupPreferenceFilterDetailsDto'
      required:
        - filter
    SubscriptionResponseDto:
      type: object
      properties:
        _id:
          type: string
          description: The unique identifier of the subscription
          example: 64f5e95d3d7946d80d0cb679
        identifier:
          type: string
          description: The identifier of the subscription
          example: tk=product-updates:si=subscriber-123
        name:
          type: string
          description: The name of the subscription
          example: My Subscription
        topic:
          description: The topic information
          allOf:
            - $ref: '#/components/schemas/TopicDto'
        subscriber:
          nullable: true
          description: The subscriber information
          allOf:
            - $ref: '#/components/schemas/SubscriberDto'
        preferences:
          description: The preferences for workflows in this subscription
          type: array
          items:
            $ref: '#/components/schemas/SubscriptionPreferenceDto'
        contextKeys:
          description: >-
            Context keys that scope this subscription (e.g., tenant:org-a,
            project:proj-123)
          example:
            - tenant:org-a
            - project:proj-123
          type: array
          items:
            type: string
        createdAt:
          type: string
          description: The creation date of the subscription
          example: '2025-04-24T05:40:21Z'
        updatedAt:
          type: string
          description: The last update date of the subscription
          example: '2025-04-24T05:40:21Z'
      required:
        - _id
        - topic
        - subscriber
        - createdAt
        - updatedAt
    MetaDto:
      type: object
      properties:
        totalCount:
          type: number
          description: The total count of subscriber IDs provided
          example: 3
        successful:
          type: number
          description: The count of successfully created subscriptions
          example: 2
        failed:
          type: number
          description: The count of failed subscription attempts
          example: 1
      required:
        - totalCount
        - successful
        - failed
    SubscriptionErrorDto:
      type: object
      properties:
        subscriberId:
          type: string
          description: The subscriber ID that failed
          example: invalid-subscriber-id
        code:
          type: string
          description: The error code
          example: SUBSCRIBER_NOT_FOUND
        message:
          type: string
          description: The error message
          example: Subscriber with ID invalid-subscriber-id could not be found
      required:
        - subscriberId
        - code
        - message
    ConstraintValidation:
      type: object
      properties:
        messages:
          type: array
          items:
            type: string
          description: List of validation error messages
          example:
            - Field is required
            - Invalid format
        value:
          description: Value that failed validation
          oneOf:
            - type: string
              nullable: true
            - type: number
            - type: boolean
            - type: object
            - type: array
              items:
                anyOf:
                  - type: string
                    nullable: true
                  - type: number
                  - type: boolean
                  - type: object
                    additionalProperties: true
          example: 'xx xx xx '
      required:
        - messages
    GroupPreferenceFilterDetailsDto:
      type: object
      properties:
        workflowIds:
          description: List of workflow identifiers
          example:
            - workflow-1
            - workflow-2
          type: array
          items:
            type: string
        tags:
          description: List of tags
          example:
            - tag1
            - tag2
          type: array
          items:
            type: string
    TopicDto:
      type: object
      properties:
        _id:
          type: string
          description: The internal unique identifier of the topic
          example: 64f5e95d3d7946d80d0cb677
        key:
          type: string
          description: >-
            The key identifier of the topic used in your application. Should be
            unique on the environment level.
          example: product-updates
        name:
          type: string
          description: The name of the topic
          example: Product Updates
      required:
        - _id
        - key
    SubscriberDto:
      type: object
      properties:
        _id:
          type: string
          description: The identifier of the subscriber
          example: 64da692e9a94fb2e6449ad07
        subscriberId:
          type: string
          description: The external identifier of the subscriber
          example: user-123
        avatar:
          type: string
          description: The avatar URL of the subscriber
          example: https://example.com/avatar.png
          nullable: true
        firstName:
          type: string
          description: The first name of the subscriber
          example: John
          nullable: true
        lastName:
          type: string
          description: The last name of the subscriber
          example: Doe
          nullable: true
        email:
          type: string
          description: The email of the subscriber
          example: john@example.com
          nullable: true
      required:
        - _id
        - subscriberId
    SubscriptionPreferenceDto:
      type: object
      properties:
        subscriptionId:
          type: string
          description: The unique identifier of the subscription
          example: 64f5e95d3d7946d80d0cb679
        workflow:
          description: Workflow information if this is a template-level preference
          nullable: true
          allOf:
            - $ref: '#/components/schemas/WorkflowDto'
        enabled:
          type: boolean
          description: Whether the preference is enabled
          example: true
        condition:
          type: object
          description: Optional condition using JSON Logic rules
          additionalProperties: true
          example:
            and:
              - '===':
                  - var: tier
                  - premium
      required:
        - subscriptionId
        - enabled
    WorkflowDto:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the workflow
          example: 64a1b2c3d4e5f6g7h8i9j0k1
        identifier:
          type: string
          description: Workflow identifier used for triggering
          example: welcome-email
        name:
          type: string
          description: Human-readable name of the workflow
          example: Welcome Email Workflow
        critical:
          type: boolean
          description: Whether this workflow is marked as critical
          example: false
        tags:
          description: Tags associated with the workflow
          example:
            - user-onboarding
            - email
          type: array
          items:
            type: string
        data:
          type: object
          description: Custom data associated with the workflow
          example:
            category: onboarding
            priority: high
        severity:
          $ref: '#/components/schemas/SeverityLevelEnum'
      required:
        - id
        - identifier
        - name
        - critical
        - severity
    SeverityLevelEnum:
      type: string
      description: Severity of the workflow
      enum:
        - high
        - medium
        - low
        - none
  headers:
    Content-Type:
      required: true
      description: The MIME type of the response body.
      schema:
        type: string
      example: application/json
    RateLimit-Limit:
      required: false
      description: >-
        The number of requests that the client is permitted to make per second.
        The actual maximum may differ when burst is enabled.
      schema:
        type: string
      example: '100'
    RateLimit-Remaining:
      required: false
      description: The number of requests remaining until the next window.
      schema:
        type: string
      example: '93'
    RateLimit-Reset:
      required: false
      description: >-
        The remaining seconds until a request of the same cost will be
        refreshed.
      schema:
        type: string
      example: '8'
    RateLimit-Policy:
      required: false
      description: The rate limit policy that was used to evaluate the request.
      schema:
        type: string
      example: >-
        100;w=1;burst=110;comment="token
        bucket";category="trigger";cost="single"
    Idempotency-Key:
      required: false
      description: The idempotency key used to evaluate the request.
      schema:
        type: string
      example: '8'
    Idempotency-Replay:
      required: false
      description: Whether the request was a replay of a previous request.
      schema:
        type: string
      example: 'true'
    Retry-After:
      required: false
      description: >-
        The number of seconds after which the client may retry the request that
        was previously rejected.
      schema:
        type: string
      example: '8'
  securitySchemes:
    secretKey:
      type: apiKey
      name: Authorization
      in: header
      description: >-
        API key authentication. Allowed headers-- "Authorization: ApiKey
        <novu_secret_key>".
      x-speakeasy-example: YOUR_SECRET_KEY_HERE

````