Push Notification Gateway
Internal service for delivering push notifications to iOS and Android devices via APNs and FCM. Provides a unified REST API abstracting transport-layer differences.
Base URL
https://push.djrafik.ru/v1
All API requests must use HTTPS. Plain HTTP connections are rejected.
Authentication
All requests require a Bearer token in the Authorization header.
Authorization: Bearer <token>
Tokens are issued per service and scoped to specific device groups. A missing or invalid token returns 401 Unauthorized.
Endpoints
Delivers a push notification to a single device token. Supports both APNs (iOS) and FCM (Android) transports — the gateway routes automatically based on the token format.
Request body
{
"token": "device_push_token",
"title": "Notification title",
"body": "Notification body text",
"data": { "key": "value" },
"ttl": 3600
}
Response
{
"id": "msg_01HZ3K9X4P",
"status": "delivered"
}
Returns the current service status and aggregated delivery metrics for the last 60 seconds.
{
"status": "ok",
"apns": "connected",
"fcm": "connected",
"delivered": 14823,
"failed": 12,
"uptime_s": 86400
}
Sends the same notification payload to up to 1 000 device tokens in a single request. Tokens from different platforms can be mixed in one batch.
{
"tokens": ["token_a", "token_b", "..."],
"title": "Broadcast title",
"body": "Broadcast body",
"data": {}
}
{
"sent": 2,
"failed": 0,
"results": [
{ "token": "token_a", "status": "delivered" },
{ "token": "token_b", "status": "delivered" }
]
}
Error codes
| HTTP | Code | Description |
|---|---|---|
| 400 | invalid_payload | Malformed JSON or missing required field |
| 401 | unauthorized | Missing or invalid Bearer token |
| 404 | device_not_found | Token is not registered or has expired |
| 429 | rate_limited | Too many requests — see rate limits |
| 503 | upstream_unavailable | APNs or FCM connection is down |
Rate limits
Limits apply per token, per minute:
POST /v1/send— 600 req / minPOST /v1/batch— 60 req / min, max 1 000 tokens per requestGET /v1/status— 120 req / min
Exceeded limits return 429 with a Retry-After header.
Changelog
Fixed APNs certificate rotation under high load.
Added POST /v1/batch endpoint. Increased batch limit to 1 000 tokens.
FCM v1 API migration. Legacy FCM tokens are automatically converted.