Notifly
API ReferenceTopics

Create topic subscriptions

This api will create subscription for subscriberIds for a topic. Its like subscribing to a common interest group. if topic does not exist, it will be created.

POST
/v2/topics/{topicKey}/subscriptions

This api will create subscription for subscriberIds for a topic. Its like subscribing to a common interest group. if topic does not exist, it will be created.

Authorization

secretKey
Authorization<token>

API key authentication. Allowed headers-- "Authorization: ApiKey <secret_key>".

In: header

Path Parameters

topicKey*string

The key identifier of the topic

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v2/topics/string/subscriptions" \  -H "Content-Type: application/json" \  -d '{}'
{  "data": {    "data": [      {        "_id": "64f5e95d3d7946d80d0cb679",        "identifier": "tk=product-updates:si=subscriber-123",        "name": "My Subscription",        "topic": {          "_id": "64f5e95d3d7946d80d0cb677",          "key": "product-updates",          "name": "Product Updates"        },        "subscriber": {          "_id": "64da692e9a94fb2e6449ad07",          "subscriberId": "user-123",          "avatar": "https://example.com/avatar.png",          "firstName": "John",          "lastName": "Doe",          "email": "[email protected]"        },        "preferences": [          {            "subscriptionId": "64f5e95d3d7946d80d0cb679",            "workflow": {              "id": "64a1b2c3d4e5f6g7h8i9j0k1",              "identifier": "welcome-email",              "name": "Welcome Email Workflow",              "critical": false,              "tags": [                "user-onboarding",                "email"              ],              "data": {                "category": "onboarding",                "priority": "high"              },              "severity": "high"            },            "enabled": true,            "condition": {              "and": [                {                  "===": [                    {                      "var": "tier"                    },                    "premium"                  ]                }              ]            }          }        ],        "contextKeys": [          "tenant:org-a",          "project:proj-123"        ],        "createdAt": "2025-04-24T05:40:21Z",        "updatedAt": "2025-04-24T05:40:21Z"      }    ],    "meta": {      "totalCount": 3,      "successful": 2,      "failed": 1    },    "errors": [      {        "subscriberId": "invalid-subscriber-id",        "code": "SUBSCRIBER_NOT_FOUND",        "message": "Subscriber with ID invalid-subscriber-id could not be found"      }    ]  }}