Back to Documentation

API Reference

Complete reference for the notification API endpoint including headers, request body, and all possible responses.

Endpoint

POST https://thenotification.app/api/sendNotification

Headers

HeaderValueRequired
Content-Typeapplication/jsonYes
app_keyYour application API keyYes

Request Body

FieldTypeRequiredDescription
titlestringYesNotification title
bodystringYesNotification message
linkstringNoURL to open when notification is tapped
imagestringNoImage URL to display in notification

Responses

200 OK - Success

{
  "success": true,
  "message": "Notification sent to 1 device(s)",
  "devices_sent": 1,
  "failed_count": 0
}

400 Bad Request - Validation Error

{
  "success": false,
  "error": "Title and body are required"
}

// Other 400 errors:
// - "Title and body must be strings"
// - "Link must be a string"
// - "Image must be a string"
// - "No devices registered for this application"

401 Unauthorized - Authentication Error

{
  "success": false,
  "error": "Missing app_key header"
}

// Or: "Invalid app_key"

429 Too Many Requests - Rate Limit Exceeded

{
  "success": false,
  "error": "Monthly message limit exceeded",
  "limit": 100,
  "received": 100
}

500 Internal Server Error - Server Error

{
  "success": false,
  "error": "Internal server error"
}