Notepush API Endpoints Documentation

This document describes the API endpoints for the Notepush application, which manages push notifications and user settings using the Nostr protocol. All endpoints except /web require authentication via a Nostr event in the Authorization header, as per NIP-98. The pubkey in the path must match the public key in the authentication event.

1. Web Push Information

Endpoint HTTP Method Description
/web GET Retrieves web push information for Notepush, including the VAPID key for FCM.

2. User Information Management

Endpoint HTTP Method Description
/user-info/{pubkey}/{deviceToken} PUT Updates user device information with the specified public key and device token.
/user-info/{pubkey}/{deviceToken} DELETE Removes user device information for the specified public key and device token.

3. Notification Settings Management

Endpoint HTTP Method Description
/user-info/{pubkey}/notify/{target} PUT Sets or updates notification settings for a specific user and target.
/user-info/{pubkey}/notify/{target} DELETE Deletes notification settings for a specific user and target.
/user-info/{pubkey}/notify GET Retrieves notification settings for a specific user.

4. User Preferences Management

Endpoint HTTP Method Description
/user-info/{pubkey}/{deviceToken}/preference GET Retrieves user notification preferences for a specific public key and device token.
/user-info/{pubkey}/{deviceToken}/preference PUT Updates user notification preferences for a specific public key and device token.

5. Root and WebSocket

Endpoint HTTP Method Description
/ or /index.html GET Serves the static index.html page for Notepush.
/* WebSocket Handles WebSocket upgrade requests for real-time notification relay.

Authentication

All endpoints except /web and / require authentication via a Nostr event in the Authorization header, following NIP-98. The event must:

Error Responses for Authentication:

Error Handling

Common error responses across all endpoints include: