← Back

API Reference

Send push notifications to the device using your API token. All requests require a Bearer token in the Authorization header.

Base URL

https://your-domain.vercel.app/api

Send Notification

Sends a push notification to the device.

POST/api/notify

Headers

Authorization: Bearer <your_token>
Content-Type: application/json

Request Body

{
  "title": "string",  // required
  "body": "string"    // required
}

Response

// 200 OK
{ "success": true }

// 401 Unauthorized
{ "error": "Invalid token" }

// 403 Forbidden
{ "error": "Token is disabled" }

Examples

curl

curl -X POST https://your-domain.vercel.app/api/notify \
  -H "Authorization: Bearer <your_token>" \
  -H "Content-Type: application/json" \
  -d '{"title": "Hello", "body": "World"}'

JavaScript

await fetch("https://your-domain.vercel.app/api/notify", {
  method: "POST",
  headers: {
    "Authorization": "Bearer <your_token>",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    title: "Hello",
    body: "World",
  }),
});

Python

import requests

requests.post(
    "https://your-domain.vercel.app/api/notify",
    headers={
        "Authorization": "Bearer <your_token>",
        "Content-Type": "application/json",
    },
    json={"title": "Hello", "body": "World"},
)

Error Codes

StatusMeaning
200Notification sent
400Missing title or body
401Missing or invalid token
403Token is disabled
500Failed to send to device
503No active devices registered