API Documentation

Authentication

All API requests require a Bearer token in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Use your Server Key (sk_proj_...) for sending notifications.

Use your Client Key (pk_proj_...) for registering subscriptions.

Endpoints

POST /api/projects

Create a new project. Returns project ID and API keys.

GET /api/projects

List all projects for your account.

POST /api/projects/:id/subscriptions

Register a push subscription for a user.

{
  "user_id": "user123",
  "endpoint": "https://fcm.googleapis.com/...",
  "p256dh": "base64-encoded-key",
  "auth": "base64-encoded-auth"
}

POST /api/projects/:id/send

Send a notification to a specific user.

{
  "user_id": "user123",
  "title": "Hello!",
  "body": "Your notification message",
  "url": "https://example.com/page"  // optional
}

POST /api/projects/:id/broadcast

Send a notification to all subscribers in the project.

{
  "title": "Announcement",
  "body": "Message for everyone"
}

Response Codes

  • 200 - Success
  • 201 - Created
  • 400 - Bad request (missing required fields)
  • 401 - Unauthorized (invalid/missing API key)
  • 403 - Forbidden (wrong key type)
  • 404 - Not found