sgeraDocs
Push notifications

Push API & Troubleshooting

REST API reference for /v1/push/*, test sends, error codes, and troubleshooting.

All server-side push endpoints are available at /v1/push/* (and /v1/developer/push/*) and require an API key with the push service permission enabled in Settings → API keys.

Send or schedule a push notification

POST /v1/push/messages reserves quota from your monthly pushSendsPerMonth pool and fans out deliveries across your target audience. Pass an Idempotency-Key header to make retries safe.

FieldTypeDescription
appIdrequiredstringPush app UUID or publicId.
titlerequiredstringNotification title (1–120 characters).
bodyrequiredstringNotification body (1–500 characters).
imageUrlstringOptional HTTPS image URL.
clickUrlstringOptional HTTPS URL opened when the notification is tapped.
buttonsarrayUp to 3 action buttons: { id, title, url? }.
dataobjectCustom string key/value pairs delivered to the app.
audiencerequiredobject{ type: "all" | "platforms" | "externalUserIds" | "subscriberIds", ... }.
scheduleTyperequiredstring"NOW", "AT" (requires sendAt ISO8601), or "LOCAL_TIME" (requires localTime HH:mm).
throttleMinutesintegerOptional spread duration: 15, 60, 360, or 1440.
curl -X POST https://api.msgera.io/v1/push/messages \
  -H "X-API-Key: $MSGERA_KEY" \
  -H "Idempotency-Key: 9b2f1c4e-6a8d-4b1a-9e0c-2d4f6a8b0c1e" \
  -H "Content-Type: application/json" \
  -d '{
    "appId": "app_01JXYZ...",
    "title": "Your order has shipped!",
    "body": "Tap to track your package in real time.",
    "clickUrl": "https://example.com/orders/42",
    "audience": {
      "type": "externalUserIds",
      "externalUserIds": ["user_123"]
    },
    "scheduleType": "NOW",
    "priority": "high"
  }'

Test devices & test sends

Mark up to 50 subscribers per app as test devices with PATCH /v1/push/subscribers/:id ({"isTest": true}). Then call POST /v1/push/apps/:id/test to dispatch immediately to all active test devices and inspect per-device outcomes. Test sends do not count against pushSendsPerMonth and are rate-limited to 20 per app per hour.

curl -X POST https://api.msgera.io/v1/push/apps/YOUR_APP_ID/test \
  -H "X-API-Key: $MSGERA_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Test notification",
    "body": "Verifying push setup"
  }'

Subscribers & cancellation

  • GET /v1/push/subscribers?appId=&platform=&isTest=&q= — List subscribers with cursor pagination.
  • PATCH /v1/push/subscribers/:id — Toggle { "isTest": true | false }.
  • DELETE /v1/push/subscribers/:id — Delete a single subscriber device.
  • DELETE /v1/push/apps/:id/users/:externalUserId — Delete all devices linked to an externalUserId.
  • POST /v1/push/messages/:id/cancel — Cancel a SCHEDULED, QUEUED, or SENDING message and refund unsent quota.

Error codes

CodeStatusMeaning
PUSH_APP_NOT_FOUND404The push app ID or publicId does not exist on your account.
PUSH_PLATFORM_NOT_CONFIGURED409A mobile SDK tried to subscribe before credentials for that platform were saved.
PUSH_CREDENTIALS_INVALID400The uploaded Firebase, Apple, or Huawei credentials failed validation.
PUSH_ORIGIN_NOT_ALLOWED403A web push request came from an origin not listed in the app's allowedOrigins.
PUSH_IDENTITY_REQUIRED401identityVerification is enabled on the app, but userHash was omitted.
PUSH_IDENTITY_INVALID401The provided userHash did not match HMAC-SHA256(appSecret, externalUserId).
PUSH_NO_TEST_DEVICES422POST /v1/push/apps/:id/test was called when no active subscribers have isTest = true.
PUSH_TEST_DEVICE_LIMIT_REACHED422An app already has the maximum of 50 test devices.
PUSH_TEST_SEND_RATE_LIMITED429Exceeded 20 test sends for this app within the current hour.
PUSH_PAYLOAD_TOO_LARGE400The combined notification payload exceeds the 3,500-byte limit.

Troubleshooting

Common invalidReason values on subscribers
FieldTypeDescription
UNREGISTERED / Unregisteredandroid / iosThe user uninstalled the app or revoked notification permission. The subscriber is marked INVALID automatically.
SENDER_ID_MISMATCHandroidThe google-services.json in the Android app belongs to a different Firebase project than the service account JSON uploaded in Msgera.
DeviceTokenNotForTopiciosThe Bundle ID configured in Msgera does not match the iOS app's bundle identifier.
BadDeviceTokeniosThe APNs token was rejected by both production and sandbox gateways.
80300007huaweiThe HMS Push Kit token is expired or unregistered.
404 / 410webThe browser push subscription expired or notifications were blocked in browser settings.

Paused platforms

If Firebase, Apple, or Huawei rejects your credentials (for example, a revoked .p8 key or deleted service account), Msgera pauses that platform, emails you once, and holds queued deliveries so your subscribers are not marked failed. Upload working credentials on the Platforms tab to resume delivery immediately.