Skip to main content
post/v2/topics/{topicKey}/subscriptions
Request example
Response
post/v2/topics/{topicKey}/subscriptions

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.

Note

When you provide a custom identifier for a subscription, it must be 512 characters or fewer. Requests with longer identifiers are rejected.

Authorization

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

Path parameters

topicKeystringrequired#
The key identifier of the topic

Headers

idempotency-keystring#
A header for idempotency purposes

Body

application/json
subscriberIdsstring[]deprecated#
List of subscriber IDs to subscribe to the topic (max: 100). @deprecated Use the "subscriptions" property instead.

Items: 1–100

Example:
subscriptionsstring · 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

Items: 1–100

Example:
namestring#
The name of the topic

Example:"My Topic"

contextobject#
preferencesstring · object[]#
The preferences of the topic. Can be a simple workflow ID string, workflow preference object, or group filter object
Example:

Responses

application/json
Subscriptions created successfully
dataobject[]required#
The list of successfully created subscriptions
metaobjectrequired#
Metadata about the operation
errorsobject[]#
The list of errors for failed subscription attempts