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.
| Endpoint | HTTP Method | Description |
|---|---|---|
/web |
GET | Retrieves web push information for Notepush, including the VAPID key for FCM. |
WebPushInfo
vaapi_key: Option - VAPID key from FCM configuration, if available200 OK with JSON body, e.g., {"vaapi_key": "example_key"}| 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. |
Authorization header with Nostr Event)pubkey: PublicKey - User public key in hex format (required, validated against auth event)deviceToken: String - Device token (required, URL-encoded)backend: NotificationBackend - Notification backend (optional, defaults to "apns"; must be a supported backend, e.g., APNS, FCM)200 OK with JSON body: {"message": "User info saved successfully"}200 OK with JSON body: {"message": "User info removed successfully"}400 Bad Request: Invalid pubkey, deviceToken, or unsupported backend401 Unauthorized: Missing or invalid Authorization header, or pubkey mismatch with auth event500 Internal Server Error: Unexpected server error (includes case ID for debugging)| 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. |
Authorization header with Nostr Event)pubkey: PublicKey - User public key in hex format (required, validated against auth event)target: PublicKey - Target public key in hex format (required for PUT and DELETE, validated)KindsSettings, e.g., {"kinds": {...}}NotificationManager::get_notify_keys)200 OK with JSON body: {"message": "Saved notification target successfully"}200 OK with JSON body: {"message": "Deleted notification target successfully"}200 OK with JSON body containing notification keys400 Bad Request: Invalid pubkey, target, or missing/invalid KindsSettings in request body401 Unauthorized: Missing or invalid Authorization header, or pubkey mismatch with auth event500 Internal Server Error: Unexpected server error (includes case ID for debugging)| 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. |
Authorization header with Nostr Event)pubkey: PublicKey - User public key in hex format (required, validated against auth event)deviceToken: String - Device token (required, URL-encoded)UserNotificationSettings, e.g., {"settings": {...}}UserNotificationSettings200 OK with JSON body containing user notification settings200 OK with JSON body: {"message": "User settings saved successfully"}400 Bad Request: Invalid pubkey, deviceToken, or missing/invalid UserNotificationSettings in request body401 Unauthorized: Missing or invalid Authorization header, or pubkey mismatch with auth event500 Internal Server Error: Unexpected server error (includes case ID for debugging)| 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. |
200 OK with HTML content101 Switching Protocols500 Internal Server Error: Failed WebSocket upgradeAll endpoints except /web and / require authentication via a Nostr event in the Authorization header, following NIP-98. The event must:
pubkey that matches the pubkey path parameter.nip98_auth::nip98_verify_auth_header.Error Responses for Authentication:
401 Unauthorized: Missing Authorization header, invalid Nostr event, or pubkey mismatchCommon error responses across all endpoints include:
400 Bad Request: Invalid or missing parameters, invalid request body401 Unauthorized: Authentication failure404 Not Found: Unmatched endpoint500 Internal Server Error: Unexpected server errors (includes a unique case ID for debugging)