notiflowsDocs
Channel Subscriptions

Add a channel subscription

Add a channel subscription for the current user. If a subscription with the same identifier already exists, its settings are updated in place.

{
  "identifier": "https://fcm.googleapis.com/fcm/send/...",
  "settings": {
    "endpoint": "https://fcm.googleapis.com/fcm/send/...",
    "p256dh": "BOxxx...",
    "auth": "xxx..."
  }
}

The identifier is the dedup key (for web push, the push endpoint URL). The settings object contains provider-specific fields validated per channel type.

POST
/channels/{channel_id}/subscriptions

Authorization

ApiKeyAuth UserKeyAuth
x-notiflows-api-key<token>

Your project's public API key. Safe to include in client-side code. Starts with pk_.

In: header

x-notiflows-user-key<token>

JWT token identifying the current user. Must be signed with your Application Signing Key (RS256).

Required claims:

  • sub: User's external_id (required)
  • exp: Expiration timestamp (recommended)
  • iat: Issued at timestamp (recommended)

Development Mode: Use x-notiflows-user-id header with the user's external_id instead (insecure, testing only).

In: header

Path Parameters

channel_id*string

Channel ID (UUID)

Request Body

application/json

Channel subscription to add

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

curl -X POST "https://api.notiflows.com/user/v1/channels/01HQXYZ123456789ABCDEFGHIJ/subscriptions" \  -H "Content-Type: application/json" \  -d '{    "identifier": "https://fcm.googleapis.com/fcm/send/dAPq1...",    "settings": {      "auth": "xxx...",      "endpoint": "https://fcm.googleapis.com/fcm/send/dAPq1...",      "p256dh": "BOxxx..."    }  }'
{
  "channel_id": "bbe8aa76-a4bb-46f6-a785-df8e831cc459",
  "created_at": "2019-08-24T14:15:22Z",
  "id": "01HQXYZ123456789ABCDEFGHIJ",
  "identifier": "https://fcm.googleapis.com/fcm/send/dAPq1...",
  "settings": {
    "auth": "xxx...",
    "endpoint": "https://fcm.googleapis.com/fcm/send/dAPq1...",
    "p256dh": "BOxxx..."
  },
  "updated_at": "2019-08-24T14:15:22Z"
}
{
  "error": {
    "code": "not_found",
    "details": {
      "allowed_statuses": [
        "string"
      ],
      "allowed_transitions": [
        "string"
      ],
      "auth": "api_key",
      "current_status": "string",
      "fields": [
        {
          "field": "email",
          "message": "can't be blank",
          "reason": "required"
        }
      ],
      "id": "string",
      "idempotency_key": "string",
      "limit": 0,
      "param": "string",
      "reason": "string",
      "required_scope": "string",
      "resource": "string",
      "retry_after": 0,
      "window": "string"
    },
    "message": "User not found",
    "request_id": "req_abc123",
    "status": 404,
    "type": "https://notiflows.com/docs/api/errors#not_found-404"
  }
}
{
  "error": {
    "code": "not_found",
    "details": {
      "allowed_statuses": [
        "string"
      ],
      "allowed_transitions": [
        "string"
      ],
      "auth": "api_key",
      "current_status": "string",
      "fields": [
        {
          "field": "email",
          "message": "can't be blank",
          "reason": "required"
        }
      ],
      "id": "string",
      "idempotency_key": "string",
      "limit": 0,
      "param": "string",
      "reason": "string",
      "required_scope": "string",
      "resource": "string",
      "retry_after": 0,
      "window": "string"
    },
    "message": "User not found",
    "request_id": "req_abc123",
    "status": 404,
    "type": "https://notiflows.com/docs/api/errors#not_found-404"
  }
}
{
  "error": {
    "code": "not_found",
    "details": {
      "allowed_statuses": [
        "string"
      ],
      "allowed_transitions": [
        "string"
      ],
      "auth": "api_key",
      "current_status": "string",
      "fields": [
        {
          "field": "email",
          "message": "can't be blank",
          "reason": "required"
        }
      ],
      "id": "string",
      "idempotency_key": "string",
      "limit": 0,
      "param": "string",
      "reason": "string",
      "required_scope": "string",
      "resource": "string",
      "retry_after": 0,
      "window": "string"
    },
    "message": "User not found",
    "request_id": "req_abc123",
    "status": 404,
    "type": "https://notiflows.com/docs/api/errors#not_found-404"
  }
}
{
  "error": {
    "code": "not_found",
    "details": {
      "allowed_statuses": [
        "string"
      ],
      "allowed_transitions": [
        "string"
      ],
      "auth": "api_key",
      "current_status": "string",
      "fields": [
        {
          "field": "email",
          "message": "can't be blank",
          "reason": "required"
        }
      ],
      "id": "string",
      "idempotency_key": "string",
      "limit": 0,
      "param": "string",
      "reason": "string",
      "required_scope": "string",
      "resource": "string",
      "retry_after": 0,
      "window": "string"
    },
    "message": "User not found",
    "request_id": "req_abc123",
    "status": 404,
    "type": "https://notiflows.com/docs/api/errors#not_found-404"
  }
}
{
  "error": {
    "code": "not_found",
    "details": {
      "allowed_statuses": [
        "string"
      ],
      "allowed_transitions": [
        "string"
      ],
      "auth": "api_key",
      "current_status": "string",
      "fields": [
        {
          "field": "email",
          "message": "can't be blank",
          "reason": "required"
        }
      ],
      "id": "string",
      "idempotency_key": "string",
      "limit": 0,
      "param": "string",
      "reason": "string",
      "required_scope": "string",
      "resource": "string",
      "retry_after": 0,
      "window": "string"
    },
    "message": "User not found",
    "request_id": "req_abc123",
    "status": 404,
    "type": "https://notiflows.com/docs/api/errors#not_found-404"
  }
}
{
  "error": {
    "code": "not_found",
    "details": {
      "allowed_statuses": [
        "string"
      ],
      "allowed_transitions": [
        "string"
      ],
      "auth": "api_key",
      "current_status": "string",
      "fields": [
        {
          "field": "email",
          "message": "can't be blank",
          "reason": "required"
        }
      ],
      "id": "string",
      "idempotency_key": "string",
      "limit": 0,
      "param": "string",
      "reason": "string",
      "required_scope": "string",
      "resource": "string",
      "retry_after": 0,
      "window": "string"
    },
    "message": "User not found",
    "request_id": "req_abc123",
    "status": 404,
    "type": "https://notiflows.com/docs/api/errors#not_found-404"
  }
}