---
title: "Create topic subscriptions"
method: POST
path: "/v2/topics/{topicKey}/subscriptions"
tags: ["Topics"]
---

# Create topic subscriptions

`POST /v2/topics/{topicKey}/subscriptions`

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.

## Path parameters

- `topicKey` string, required

## Request body

- CreateTopicSubscriptionsRequestDto
  - `subscriberIds` string[] — List of subscriber IDs to subscribe to the topic (max: 100). @deprecated Use the "subscriptions" property instead.
  - `subscriptions` union[] — 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
    - union
      - string
      - TopicSubscriberIdentifierDto
        - `identifier` string, required — Unique identifier for this subscription
        - `subscriberId` string, required — The subscriber ID
        - `name` string — The name of the subscription
  - `name` string — The name of the topic
  - `context` object
  - `preferences` union[] — The preferences of the topic. Can be a simple workflow ID string, workflow preference object, or group filter object
    - union
      - string
      - WorkflowPreferenceRequestDto
        - `enabled` boolean — Whether the preference is enabled. Used when condition is not provided.
        - `condition` object — Optional JSON Logic condition evaluated at fan-out time against trigger payload, subscriber profile, actor, and context (for example, `{ "var": "payload.tier" }`, `{ "var": "subscriber.data.plan" }`, or `{ "var": "actor.data.role" }`)
        - `workflowId` string, required — The workflow identifier
      - GroupPreferenceFilterDto
        - `enabled` boolean — Whether the preference is enabled. Used when condition is not provided.
        - `condition` object — Optional JSON Logic condition evaluated at fan-out time against trigger payload, subscriber profile, actor, and context (for example, `{ "var": "payload.tier" }`, `{ "var": "subscriber.data.plan" }`, or `{ "var": "actor.data.role" }`)
        - `filter` GroupPreferenceFilterDetailsDto, required
          - `workflowIds` string[] — List of workflow identifiers
          - `tags` string[] — List of tags

## Response `201`

Subscriptions created successfully

- CreateSubscriptionsResponseDto
  - `data` SubscriptionResponseDto[], required — The list of successfully created subscriptions
    - `_id` string, required — The unique identifier of the subscription
    - `identifier` string — The identifier of the subscription
    - `name` string — The name of the subscription
    - `topic` TopicDto, required
      - `_id` string, required — The internal unique identifier of the topic
      - `key` string, required — The key identifier of the topic used in your application. Should be unique on the environment level.
      - `name` string — The name of the topic
    - `subscriber` SubscriberDto, required
      - `_id` string, required — The identifier of the subscriber
      - `subscriberId` string, required — The external identifier of the subscriber
      - `avatar` string, nullable — The avatar URL of the subscriber
      - `firstName` string, nullable — The first name of the subscriber
      - `lastName` string, nullable — The last name of the subscriber
      - `email` string, nullable — The email of the subscriber
    - `preferences` SubscriptionPreferenceDto[] — The preferences for workflows in this subscription
      - `subscriptionId` string, required — The unique identifier of the subscription
      - `workflow` WorkflowDto
        - `id` string, required — Unique identifier of the workflow
        - `identifier` string, required — Workflow identifier used for triggering
        - `name` string, required — Human-readable name of the workflow
        - `critical` boolean, required — Whether this workflow is marked as critical
        - `tags` string[] — Tags associated with the workflow
        - `data` object — Custom data associated with the workflow
        - `severity` 'high' | 'medium' | 'low' | 'none', required — Severity of the workflow
      - `enabled` boolean, required — Whether the preference is enabled
      - `condition` object — Optional JSON Logic condition evaluated against the trigger payload at fan-out time (for example, `{ "var": "payload.tier" }`)
    - `contextKeys` string[] — Context keys that scope this subscription (e.g., tenant:org-a, project:proj-123)
    - `createdAt` string, required — The creation date of the subscription
    - `updatedAt` string, required — The last update date of the subscription
  - `meta` MetaDto, required
    - `totalCount` number, required — The total count of subscriber IDs provided
    - `successful` number, required — The count of successfully created subscriptions
    - `failed` number, required — The count of failed subscription attempts
  - `errors` SubscriptionErrorDto[] — The list of errors for failed subscription attempts
    - `subscriberId` string, required — The subscriber ID that failed
    - `code` string, required — The error code
    - `message` string, required — The error message

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `405` — Method Not Allowed
- `409` — Conflict
- `413` — Payload Too Large
- `414` — URI Too Long
- `415` — Unsupported Media Type
- `422` — Unprocessable Entity
- `429` — The client has sent too many requests in a given amount of time.
- `500` — Internal Server Error
- `503` — 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.

---

[API](https://skmtc.net/novu/apis/deprecated-novu-api-use-openapi-json-yaml-instead.md) · [All operations](https://skmtc.net/novu/apis/deprecated-novu-api-use-openapi-json-yaml-instead/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/novu/deprecated-novu-api-use-openapi-json-yaml-instead/versions/986fe259fa85/schema)
