Skip to main content
POST
TypeScript
Subscribe one or more subscribers to a topic. Pass subscriptions as subscriber IDs, or as objects with identifier and subscriberId when you need a custom subscription key. Preferences can include JSON Logic conditions evaluated at trigger time against the trigger payload, subscriber profile, actor, and context. Use paths such as { "var": "payload.fieldName" }, { "var": "subscriber.data.tier" }, { "var": "actor.data.role" }, or { "var": "context.tenant.id" }. Pass an optional context object to scope subscriptions to a Context. The Context on the subscription must exactly match the Context on the workflow trigger. See Context-scoped subscriptions.
When you provide a custom identifier for a subscription, it must be 512 characters or fewer. Requests with longer identifiers are rejected.

Authorizations

Authorization
string
header
required

API key authentication. Allowed headers-- "Authorization: ApiKey <novu_secret_key>".

Headers

idempotency-key
string

A header for idempotency purposes

Path Parameters

topicKey
string
required

The key identifier of the topic

Body

application/json
subscriberIds
string[]
deprecated

List of subscriber IDs to subscribe to the topic (max: 100). @deprecated Use the "subscriptions" property instead.

Example:
subscriptions
(string | object)[]

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

Example:
name
string

The name of the topic

Example:

"My Topic"

context
object
preferences
string · object · object[]

The preferences of the topic. Can be a simple workflow ID string, workflow preference object, or group filter object

Example:

Response

Subscriptions created successfully

data
object[]
required

The list of successfully created subscriptions

meta
object
required

Metadata about the operation

errors
object[]

The list of errors for failed subscription attempts