Topics

List topic subscriptions

Changed on

List all subscriptions of subscribers for a topic. Checkout all available filters in the query section.

get/v2/topics/{topicKey}/subscriptions

Request

  • Base URL
    https://api.novu.co
  • Auth
    API key in header Authorization

Path parameters

topicKeystring required

The key identifier of the topic

Query parameters

afterstring

Cursor for pagination indicating the starting point after which to fetch results.

beforestring

Cursor for pagination indicating the ending point before which to fetch results.

limitnumber
Example:10

Limit the number of items to return (max 100)

orderDirection'ASC' | 'DESC'

Direction of sorting

orderBystring

Field to order by

includeCursorboolean

Include cursor item in response

subscriberIdstring

Filter by subscriber ID

contextKeysstring[]

Filter by exact context keys, order insensitive (format: "type:id")

[
  "tenant:org-123",
  "region:us-east-1"
]

Headers

idempotency-keystring

A header for idempotency purposes

Response

OK

nextstring nullable required

The cursor for the next page of results, or null if there are no more pages.

previousstring nullable required

The cursor for the previous page of results, or null if this is the first page.

totalCountnumber required

The total count of items (up to 50,000)

totalCountCappedboolean required

Whether there are more than 50,000 results available

Example response

{
  "data": [
    {
      "_id": "64da692e9a94fb2e6449ad08",
      "identifier": "tk=product-updates:si=subscriber-123",
      "createdAt": "2021-01-01T00:00:00.000Z",
      "topic": {
        "_id": "64da692e9a94fb2e6449ad06",
        "key": "product-updates",
        "name": "Product Updates",
        "data": {
          "category": "product",
          "priority": 1
        },
        "createdAt": "2023-08-15T00:00:00.000Z",
        "updatedAt": "2023-08-15T00:00:00.000Z"
      },
      "subscriber": {
        "_id": "64da692e9a94fb2e6449ad07",
        "subscriberId": "user-123",
        "avatar": "https://example.com/avatar.png",
        "firstName": "John",
        "lastName": "Doe",
        "email": "john@example.com"
      },
      "contextKeys": [
        "tenant:org-a",
        "project:proj-123"
      ],
      "preferences": [
        {
          "subscriptionId": "64f5e95d3d7946d80d0cb679",
          "workflow": {
            "id": "64a1b2c3d4e5f6g7h8i9j0k1",
            "identifier": "welcome-email",
            "name": "Welcome Email Workflow",
            "tags": [
              "user-onboarding",
              "email"
            ],
            "data": {
              "category": "onboarding",
              "priority": "high"
            }
          },
          "enabled": true,
          "condition": {
            "and": [
              {
                "===": [
                  {
                    "var": "payload.tier"
                  },
                  "premium"
                ]
              }
            ]
          }
        }
      ]
    }
  ]
}

Changes

    • breaking

      the //// response's property type changed from no type to object for status

    • info

      added the optional property /////// to the response with the status