Overview

The API enables you to access the entire Novu platform using a RESTful API. This API provides a programmatic access to the platform's data and functionality.

Base URL
1https://api.novu.co/v1

API Authorization

Novu API is authorized by passing the ApiKey (generated from the settings page) with each request.

Header Format

'Authorization': 'ApiKey REPLACE_WITH_API_KEY' 

Client libraries

Novu offers native SDK in several popular programming languages:

Trigger event

Trigger event is the main (and the only) way to send notification to subscribers. The trigger identifier is used to match the particular template associated with it. Additional information can be passed according the body interface below.

Endpoint

post/v1/events/trigger

Body parameters

  • namestring

    The trigger identifier of the template you wish to send. This identifier can be found on the template page.

  • payloadobject

    The payload object is used to pass additional custom information that could be used to render the template, or perform routing rules based on it. This data will also be available when fetching the notifications feed from the API to display certain parts of the UI.

  • overridesobject (optional)

    This could be used to override provider specific configurations

  • toarray
  • transactionIdstring (optional)

    A unique identifier for this transaction, we will generated a UUID if not provided.

  • actoroneOf (optional)

    It is used to display the Avatar of the provided actor's subscriber id or actor object. If a new actor object is provided, we will create a new subscriber in our system

    Show parameters

Responses

post/v1/events/trigger
1import { Novu } from '@novu/node';
2
3export const novu = new Novu('<REPLACE_WITH_API_KEY_FROM_ADMIN_PANEL>');
4
5await novu.trigger('<REPLACE_WITH_EVENT_NAME_FROM_ADMIN_PANEL>',
6  {
7    to: {
8      subscriberId: '<USER_IDENTIFIER>',
9      email: 'email@email.com',
10      firstName: 'John',
11      lastName: 'Doe',
12    },
13    payload: {
14      customVariables: 'Hello'
15    },
16    transactionId: 'transactionId',
17  }
18);
19
Response
1{
2    data: data
3}

Bulk trigger event

Using this endpoint you can trigger multiple events at once, to avoid multiple calls to the API. The bulk API is limited to 100 events per request.

Endpoint

post/v1/events/trigger/bulk

Body parameters

  • eventsarray
    Show child parameters

Responses

post/v1/events/trigger/bulk
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/events/trigger/bulk', {
4  method: 'POST',
5  headers: {
6    'Content-Type': 'application/json',
7    'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8  },
9  body: JSON.stringify({
10    events: ["events"]
11  }),
12});
13const data = await response.json();
14    
Response
1{
2    data: ["data"]
3}

Broadcast event to all

Trigger a broadcast event to all existing subscribers, could be used to send announcements, etc. In the future could be used to trigger events to a subset of subscribers based on defined filters.

Endpoint

post/v1/events/trigger/broadcast

Body parameters

  • namestring

    The trigger identifier associated for the template you wish to send. This identifier can be found on the template page.

  • payloadobject

    The payload object is used to pass additional custom information that could be used to render the template, or perform routing rules based on it. This data will also be available when fetching the notifications feed from the API to display certain parts of the UI.

  • overridesobject (optional)

    This could be used to override provider specific configurations

  • transactionIdstring (optional)

    A unique identifier for this transaction, we will generated a UUID if not provided.

  • actoroneOf (optional)

    It is used to display the Avatar of the provided actor's subscriber id or actor object. If a new actor object is provided, we will create a new subscriber in our system

    Show parameters

Responses

post/v1/events/trigger/broadcast
1import { Novu } from '@novu/node';
2
3export const novu = new Novu('<REPLACE_WITH_API_KEY_FROM_ADMIN_PANEL>');
4
5await novu.broadcast('<REPLACE_WITH_EVENT_NAME_FROM_ADMIN_PANEL>',
6  {
7    payload: {
8      customVariables: 'Hello'
9    },
10    transactionId: 'transactionId',
11  }
12);
13
Response
1{
2    data: data
3}

Cancel triggered event

Using a previously generated transactionId during the event trigger, will cancel any active or pending workflows. This is useful to cancel active digests, delays etc...

Endpoint

delete/v1/events/trigger/:transactionId

Path parameters

  • transactionIdstring

Responses

delete/v1/events/trigger/:transactionId
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/events/trigger/:transactionId', {
4  method: 'DELETE',
5  
6});
7const data = await response.json();
8    
Response
1{
2    data: true
3}

Get subscribers

Returns a list of subscribers, could paginated using the `page` and `limit` query parameter

Endpoint

get/v1/subscribers

Query parameters

  • pagenumber (optional)
  • limitnumber (optional)

Responses

  • 200

get/v1/subscribers
1import { Novu } from '@novu/node';
2
3export const novu = new Novu('<REPLACE_WITH_API_KEY_FROM_ADMIN_PANEL>');
4
5await novu.subscribers.list(0);
6

Create subscriber

Creates a subscriber entity, in the Novu platform. The subscriber will be later used to receive notifications, and access notification feeds. Communication credentials such as email, phone number, and 3 rd party credentials i.e slack tokens could be later associated to this entity.

Endpoint

post/v1/subscribers

Body parameters

  • subscriberIdstring

    The internal identifier you used to create this subscriber, usually correlates to the id the user in your systems

  • emailstring (optional)
  • firstNamestring (optional)
  • lastNamestring (optional)
  • phonestring (optional)
  • avatarstring (optional)

    An http url to the profile image of your subscriber

  • localestring (optional)
  • dataobject (optional)

Responses

post/v1/subscribers
1import { Novu } from '@novu/node';
2
3export const novu = new Novu('<REPLACE_WITH_API_KEY_FROM_ADMIN_PANEL>');
4
5await novu.subscribers.identify(user.id, {
6  email: user.email,
7  firstName: user.firstName,
8  lastName: user.lastName,
9  phone: user.phone,
10  avatar: user.profile_avatar
11});
12
Response
1{
2    data: data
3}

Get subscriber

Get subscriber by your internal id used to identify the subscriber

Endpoint

get/v1/subscribers/:subscriberId

Path parameters

  • subscriberIdstring

Responses

get/v1/subscribers/:subscriberId
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId', {
4  method: 'GET',
5  
6});
7const data = await response.json();
8    
Response
1{
2    data: data
3}

Update subscriber

Used to update the subscriber entity with new information

Endpoint

put/v1/subscribers/:subscriberId

Path parameters

  • subscriberIdstring

Body parameters

  • emailstring (optional)
  • firstNamestring (optional)
  • lastNamestring (optional)
  • phonestring (optional)
  • avatarstring (optional)
  • localestring (optional)
  • dataobject (optional)

Responses

put/v1/subscribers/:subscriberId
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId', {
4  method: 'PUT',
5  headers: {
6    'Content-Type': 'application/json',
7    'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8  },
9  body: JSON.stringify({
10    email: "email",
11    firstName: "firstName",
12    lastName: "lastName",
13    phone: "phone",
14    avatar: "avatar",
15    locale: "locale",
16    data: data
17  }),
18});
19const data = await response.json();
20    
Response
1{
2    data: data
3}

Delete subscriber

Deletes a subscriber entity from the Novu platform

Endpoint

delete/v1/subscribers/:subscriberId

Path parameters

  • subscriberIdstring

Responses

delete/v1/subscribers/:subscriberId
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId', {
4  method: 'DELETE',
5  
6});
7const data = await response.json();
8    
Response
1{
2    data: data
3}

Update subscriber credentials

Subscriber credentials associated to the delivery methods such as slack and push tokens.

Endpoint

put/v1/subscribers/:subscriberId/credentials

Path parameters

  • subscriberIdstring

Body parameters

  • providerIdstring

    The provider identifier for the credentials

  • credentialsallOf

    Credentials payload for the specified provider

    Show parameters

Responses

put/v1/subscribers/:subscriberId/credentials
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/credentials', {
4  method: 'PUT',
5  headers: {
6    'Content-Type': 'application/json',
7    'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8  },
9  body: JSON.stringify({
10    providerId: "providerId",
11    credentials: "credentials"
12  }),
13});
14const data = await response.json();
15    
Response
1{
2    data: data
3}

Update subscriber online status

Used to update the subscriber isOnline flag.

Endpoint

patch/v1/subscribers/:subscriberId/online-status

Path parameters

  • subscriberIdstring

Body parameters

  • isOnlineboolean

Responses

patch/v1/subscribers/:subscriberId/online-status
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/online-status', {
4  method: 'PATCH',
5  headers: {
6    'Content-Type': 'application/json',
7    'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8  },
9  body: JSON.stringify({
10    isOnline: true
11  }),
12});
13const data = await response.json();
14    
Response
1{
2    data: data
3}

Get subscriber preferences

Endpoint

get/v1/subscribers/:subscriberId/preferences

Path parameters

  • subscriberIdstring

Responses

get/v1/subscribers/:subscriberId/preferences
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/preferences', {
4  method: 'GET',
5  
6});
7const data = await response.json();
8    
Response
1{
2    data: ["data"]
3}

Update subscriber preference

Endpoint

patch/v1/subscribers/:subscriberId/preferences/:templateId

Path parameters

  • subscriberIdstring
  • templateIdstring

Body parameters

  • channelallOf (optional)

    The subscriber preferences for every ChannelTypeEnum for the notification template assigned.

    Show parameters
  • enabledboolean (optional)

    Sets if the notification template is fully enabled for all channels or not for the subscriber.

Responses

patch/v1/subscribers/:subscriberId/preferences/:templateId
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/preferences/:templateId', {
4  method: 'PATCH',
5  headers: {
6    'Content-Type': 'application/json',
7    'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8  },
9  body: JSON.stringify({
10    channel: "channel",
11    enabled: true
12  }),
13});
14const data = await response.json();
15    
Response
1{
2    data: data
3}

Get in-app notification feed for a particular subscriber

Endpoint

get/v1/subscribers/:subscriberId/notifications/feed

Path parameters

  • subscriberIdstring

Query parameters

  • pagenumber (optional)
  • limitnumber (optional)
  • readboolean (optional)
  • seenboolean (optional)

Responses

  • 200

get/v1/subscribers/:subscriberId/notifications/feed
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/notifications/feed', {
4  method: 'GET',
5  
6});
7const data = await response.json();
8    

Get the unseen in-app notifications count for subscribers feed

Endpoint

get/v1/subscribers/:subscriberId/notifications/unseen

Path parameters

  • subscriberIdstring

Query parameters

  • seenboolean
  • limitnumber

Responses

get/v1/subscribers/:subscriberId/notifications/unseen
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/notifications/unseen', {
4  method: 'GET',
5  
6});
7const data = await response.json();
8    
Response
1{
2    data: data
3}

Mark a subscriber feed message as seen

Endpoint

post/v1/subscribers/:subscriberId/messages/markAs

Path parameters

  • subscriberIdstring

Body parameters

  • messageIdoneOf
    Show parameters
  • markobject
    Show child parameters

Responses

post/v1/subscribers/:subscriberId/messages/markAs
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/messages/markAs', {
4  method: 'POST',
5  headers: {
6    'Content-Type': 'application/json',
7    'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8  },
9  body: JSON.stringify({
10    messageId: "messageId",
11    mark: mark
12  }),
13});
14const data = await response.json();
15    
Response
1{
2    data: ["data"]
3}

Mark message action as seen

Endpoint

post/v1/subscribers/:subscriberId/messages/:messageId/actions/:type

Path parameters

  • messageIdstring
  • typestring
  • subscriberIdstring

Body parameters

  • statusstring

    Message action status

  • payloadobject (optional)

    Message action payload

Responses

post/v1/subscribers/:subscriberId/messages/:messageId/actions/:type
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/subscribers/:subscriberId/messages/:messageId/actions/:type', {
4  method: 'POST',
5  headers: {
6    'Content-Type': 'application/json',
7    'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8  },
9  body: JSON.stringify({
10    status: "status",
11    payload: payload
12  }),
13});
14const data = await response.json();
15    
Response
1{
2    data: data
3}

Topic creation

Create a topic

Endpoint

post/v1/topics

Body parameters

  • keystring

    User defined custom key and provided by the user that will be an unique identifier for the Topic created.

  • namestring

    User defined custom name and provided by the user that will name the Topic created.

Responses

post/v1/topics
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics', {
4  method: 'POST',
5  headers: {
6    'Content-Type': 'application/json',
7    'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8  },
9  body: JSON.stringify({
10    key: "key",
11    name: "name"
12  }),
13});
14const data = await response.json();
15    
Response
1{
2    data: data
3}

Filter topics

Returns a list of topics that can be paginated using the `page` query parameter and filtered by the topic key with the `key` query parameter

Endpoint

get/v1/topics

Query parameters

  • pagenumber (optional)

    Number of page for the pagination

  • pageSizenumber (optional)

    Size of page for the pagination

  • keystring (optional)

    Topic key

Responses

get/v1/topics
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics', {
4  method: 'GET',
5  
6});
7const data = await response.json();
8    
Response
1{
2    data: ["data"],
3    page: 0,
4    pageSize: 0,
5    totalCount: 0
6}

Subscribers addition

Add subscribers to a topic by key

Endpoint

post/v1/topics/:topicKey/subscribers

Path parameters

  • topicKeystring

Body parameters

  • subscribersarray

    List of subscriber identifiers that will be associated to the topic

Responses

  • 200

  • 204

post/v1/topics/:topicKey/subscribers
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics/:topicKey/subscribers', {
4  method: 'POST',
5  headers: {
6    'Content-Type': 'application/json',
7    'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8  },
9  body: JSON.stringify({
10    subscribers: ["subscribers"]
11  }),
12});
13const data = await response.json();
14    

Check topic subscriber

Check if a subscriber belongs to a certain topic

Endpoint

get/v1/topics/:topicKey/subscribers/:externalSubscriberId

Path parameters

  • topicKeystring
  • externalSubscriberIdstring

Responses

get/v1/topics/:topicKey/subscribers/:externalSubscriberId
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics/:topicKey/subscribers/:externalSubscriberId', {
4  method: 'GET',
5  
6});
7const data = await response.json();
8    
Response
1{
2    _organizationId: "_organizationId",
3    _environmentId: "_environmentId",
4    _subscriberId: "_subscriberId",
5    _topicId: "_topicId",
6    topicKey: "topicKey",
7    externalSubscriberId: "externalSubscriberId"
8}

Subscribers removal

Remove subscribers from a topic

Endpoint

post/v1/topics/:topicKey/subscribers/removal

Path parameters

  • topicKeystring

Body parameters

  • subscribersarray

    List of subscriber identifiers that will be removed to the topic

Responses

  • 204

post/v1/topics/:topicKey/subscribers/removal
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics/:topicKey/subscribers/removal', {
4  method: 'POST',
5  headers: {
6    'Content-Type': 'application/json',
7    'Authorization': 'ApiKey REPLACE_WITH_API_KEY',
8  },
9  body: JSON.stringify({
10    subscribers: ["subscribers"]
11  }),
12});
13const data = await response.json();
14    

Delete topic

Delete a topic by its topic key if it has no subscribers

Endpoint

delete/v1/topics/:topicKey

Path parameters

  • topicKeystring

Responses

  • 204

    The topic has been deleted correctly

  • 404

    The topic with the key provided does not exist in the database so it can not be deleted.

  • 409

    The topic you are trying to delete has subscribers assigned to it. Delete the subscribers before deleting the topic.

delete/v1/topics/:topicKey
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics/:topicKey', {
4  method: 'DELETE',
5  
6});
7const data = await response.json();
8    

Get topic

Get a topic by its topic key

Endpoint

get/v1/topics/:topicKey

Path parameters

  • topicKeystring

Responses

get/v1/topics/:topicKey
1import fetch from 'node-fetch';
2
3const response = await fetch('https://api.novu.co/v1/topics/:topicKey', {
4  method: 'GET',
5  
6});
7const data = await response.json();
8