List topic subscriptions
List all subscriptions of subscribers for a topic. Checkout all available filters in the query section.
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.topics.subscriptions.list({
topicKey: "<value>",
limit: 10,
contextKeys: [
"tenant:org-123",
"region:us-east-1",
],
});
console.log(result);
}
run();using Novu;
using Novu.Models.Components;
using Novu.Models.Requests;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
TopicsControllerListTopicSubscriptionsRequest req = new TopicsControllerListTopicSubscriptionsRequest() {
TopicKey = "<value>",
Limit = 10D,
ContextKeys = new List<string>() {
"tenant:org-123",
"region:us-east-1",
},
};
var res = await sdk.Topics.Subscriptions.ListAsync(req);
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Operations;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$request = new Operations\TopicsControllerListTopicSubscriptionsRequest(
topicKey: '<value>',
limit: 10,
contextKeys: [
'tenant:org-123',
'region:us-east-1',
],
);
$response = $sdk->topics->subscriptions->list(
request: $request
);
if ($response->listTopicSubscriptionsResponseDto !== null) {
// handle response
}from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.topics.subscriptions.list(request={
"topic_key": "<value>",
"limit": 10,
"context_keys": [
"tenant:org-123",
"region:us-east-1",
],
})
# Handle response
print(res)package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Topics.Subscriptions.List(ctx, operations.TopicsControllerListTopicSubscriptionsRequest{
TopicKey: "<value>",
Limit: v3.Pointer[float64](10.0),
ContextKeys: []string{
"tenant:org-123",
"region:us-east-1",
},
})
if err != nil {
log.Fatal(err)
}
if res.ListTopicSubscriptionsResponseDto != nil {
// handle response
}
}curl --request GET \
--url https://api.novu.co/v2/topics/{topicKey}/subscriptions \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.novu.co/v2/topics/{topicKey}/subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.novu.co/v2/topics/{topicKey}/subscriptions")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v2/topics/{topicKey}/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"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",
"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": "[email protected]"
},
"contextKeys": [
"tenant:org-a",
"project:proj-123"
]
}
],
"next": "<string>",
"previous": "<string>",
"totalCount": 123,
"totalCountCapped": true
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"errors": {
"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"
]
}
},
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"API rate limit exceeded"{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"Please wait some time, then try again."Authorizations
API key authentication. Allowed headers-- "Authorization: ApiKey <novu_secret_key>".
Headers
A header for idempotency purposes
Path Parameters
The key identifier of the topic
Query Parameters
Cursor for pagination indicating the starting point after which to fetch results.
Cursor for pagination indicating the ending point before which to fetch results.
Limit the number of items to return (max 100)
x <= 100Direction of sorting
ASC, DESC Field to order by
Include cursor item in response
Filter by subscriber ID
Filter by exact context keys, order insensitive (format: "type:id")
Response
OK
List of returned Topic Subscriptions
Show child attributes
Show child attributes
The cursor for the next page of results, or null if there are no more pages.
The cursor for the previous page of results, or null if this is the first page.
The total count of items (up to 50,000)
Whether there are more than 50,000 results available
Was this page helpful?
import { Novu } from "@novu/api";
const novu = new Novu({
secretKey: "YOUR_SECRET_KEY_HERE",
});
async function run() {
const result = await novu.topics.subscriptions.list({
topicKey: "<value>",
limit: 10,
contextKeys: [
"tenant:org-123",
"region:us-east-1",
],
});
console.log(result);
}
run();using Novu;
using Novu.Models.Components;
using Novu.Models.Requests;
using System.Collections.Generic;
var sdk = new NovuSDK(secretKey: "YOUR_SECRET_KEY_HERE");
TopicsControllerListTopicSubscriptionsRequest req = new TopicsControllerListTopicSubscriptionsRequest() {
TopicKey = "<value>",
Limit = 10D,
ContextKeys = new List<string>() {
"tenant:org-123",
"region:us-east-1",
},
};
var res = await sdk.Topics.Subscriptions.ListAsync(req);
// handle responsedeclare(strict_types=1);
require 'vendor/autoload.php';
use novu;
use novu\Models\Operations;
$sdk = novu\Novu::builder()
->setSecurity(
'YOUR_SECRET_KEY_HERE'
)
->build();
$request = new Operations\TopicsControllerListTopicSubscriptionsRequest(
topicKey: '<value>',
limit: 10,
contextKeys: [
'tenant:org-123',
'region:us-east-1',
],
);
$response = $sdk->topics->subscriptions->list(
request: $request
);
if ($response->listTopicSubscriptionsResponseDto !== null) {
// handle response
}from novu_py import Novu
with Novu(
secret_key="YOUR_SECRET_KEY_HERE",
) as novu:
res = novu.topics.subscriptions.list(request={
"topic_key": "<value>",
"limit": 10,
"context_keys": [
"tenant:org-123",
"region:us-east-1",
],
})
# Handle response
print(res)package main
import(
"context"
"github.com/novuhq/novu-go/v3"
"github.com/novuhq/novu-go/v3/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := v3.New(
v3.WithSecurity("YOUR_SECRET_KEY_HERE"),
)
res, err := s.Topics.Subscriptions.List(ctx, operations.TopicsControllerListTopicSubscriptionsRequest{
TopicKey: "<value>",
Limit: v3.Pointer[float64](10.0),
ContextKeys: []string{
"tenant:org-123",
"region:us-east-1",
},
})
if err != nil {
log.Fatal(err)
}
if res.ListTopicSubscriptionsResponseDto != nil {
// handle response
}
}curl --request GET \
--url https://api.novu.co/v2/topics/{topicKey}/subscriptions \
--header 'Authorization: <api-key>'const options = {method: 'GET', headers: {Authorization: '<api-key>'}};
fetch('https://api.novu.co/v2/topics/{topicKey}/subscriptions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.novu.co/v2/topics/{topicKey}/subscriptions")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.novu.co/v2/topics/{topicKey}/subscriptions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"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",
"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": "[email protected]"
},
"contextKeys": [
"tenant:org-a",
"project:proj-123"
]
}
],
"next": "<string>",
"previous": "<string>",
"totalCount": 123,
"totalCountCapped": true
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"errors": {
"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"
]
}
},
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"API rate limit exceeded"{
"statusCode": 404,
"timestamp": "2024-12-12T13:00:00Z",
"path": "/api/v1/resource",
"message": "xx xx xx ",
"ctx": {
"workflowId": "some_wf_id",
"stepId": "some_wf_id"
},
"errorId": "abc123"
}"Please wait some time, then try again."