starti.app
REST API

Push Notifications

Send push notifications and badge updates to users or topics.

Send Notification

POST /push-notifications/send

Send notifications or badge updates to users or topics. The request body is an array of notification objects, allowing you to send multiple notifications in a single request.

Each notification must target either userIds or topics, not both. The userIds correspond to the IDs registered via startiapp.User.registerId() on the client side.

Request body

The request body is a JSON array of notification objects.

[
  {
    "userIds": ["user123", "user456"],
    "title": "New Message",
    "body": "You have received a new message",
    "openToUrl": "https://example.com/message/123",
    "badgeCount": 5
  }
]

Prop

Type

Either userIds or topics must be provided. To send a visible notification, include both title and body. To update only the badge count, omit title and body and provide badgeCount.

Examples

curl -X POST \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '[
    {
      "userIds": ["user123"],
      "title": "New Message",
      "body": "You have received a new message",
      "openToUrl": "https://example.com/message/123"
    },
    {
      "userIds": ["user456"],
      "badgeCount": 5
    }
  ]' \
  https://api.starti.app/v1/push-notifications/send
curl -X POST \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '[
    {
      "topics": ["general", "announcements"],
      "title": "System Update",
      "body": "The system will be updated tonight",
      "openToUrl": "https://example.com/updates"
    }
  ]' \
  https://api.starti.app/v1/push-notifications/send
curl -X POST \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '[
    {
      "userIds": ["user123"],
      "badgeCount": 5
    }
  ]' \
  https://api.starti.app/v1/push-notifications/send

Responses

On this page