Novu Preferences API

Per-subscriber notification preferences.

Documentation

Specifications

Other Resources

OpenAPI Specification

novu-co-preferences-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: Novu Environments Preferences API
  description: 'The Novu REST API drives open-source notification infrastructure that sends multi-channel messages - email, SMS, push, chat, and an in-app Inbox - from a single workflow trigger. A trigger event fans a notification out across the channels defined in a workflow. This document models the core resources - Events (Trigger), Subscribers, Topics, the in-app Inbox feed, Messages, Notifications (activity), Workflows, Integrations, Layouts, subscriber Preferences, Environments, and Translations. Novu is open source (MIT) and self-hostable, and also runs as Novu Cloud with US and EU regions. All requests authenticate with a secret API key sent as `Authorization: ApiKey <NOVU_SECRET_KEY>`. Endpoints are grounded in Novu''s published API reference; request/response bodies are modeled at a representative level rather than field-complete.'
  version: '1.0'
  contact:
    name: Novu
    url: https://novu.co
  license:
    name: MIT
    url: https://github.com/novuhq/novu/blob/next/LICENSE
servers:
- url: https://api.novu.co/v1
  description: Novu Cloud - US (default)
- url: https://eu.api.novu.co/v1
  description: Novu Cloud - EU
security:
- apiKeyAuth: []
tags:
- name: Preferences
  description: Per-subscriber notification preferences.
paths:
  /subscribers/{subscriberId}/preferences:
    parameters:
    - $ref: '#/components/parameters/SubscriberId'
    get:
      operationId: getSubscriberPreferences
      tags:
      - Preferences
      summary: Retrieve subscriber preferences
      responses:
        '200':
          description: The subscriber's preferences per workflow and channel.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PreferencesResponse'
        '404':
          $ref: '#/components/responses/NotFound'
    patch:
      operationId: updateSubscriberPreferences
      tags:
      - Preferences
      summary: Update subscriber preferences
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PreferenceUpdate'
      responses:
        '200':
          description: Updated preferences.
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    Error:
      type: object
      properties:
        statusCode:
          type: integer
        message:
          type: string
        error:
          type: string
    PreferenceUpdate:
      type: object
      properties:
        channel:
          type: object
          properties:
            type:
              type: string
              enum:
              - in_app
              - email
              - sms
              - chat
              - push
            enabled:
              type: boolean
        workflowId:
          type: string
        enabled:
          type: boolean
    PreferencesResponse:
      type: object
      properties:
        data:
          type: array
          items:
            type: object
            properties:
              template:
                type: object
                additionalProperties: true
              preference:
                type: object
                additionalProperties: true
  responses:
    NotFound:
      description: The requested resource was not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  parameters:
    SubscriberId:
      name: subscriberId
      in: path
      required: true
      description: Your application's unique identifier for the subscriber.
      schema:
        type: string
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'Novu secret API key from the Dashboard API Keys page, sent as `Authorization: ApiKey <NOVU_SECRET_KEY>`.'