Push Server: Integration and API
The Push Server exposes OpenAPI-defined HTTP APIs for customer backends, mobile devices and operators. Each contract is the source for a generated Dart client package.
| API (OpenAPI title) | Base path | Connector | Caller | Authentication | Dart package |
|---|---|---|---|---|---|
| m8ty Push Service Messaging API | /push/api/v2 |
Public (8080) | Customer backend | Bearer JWT | m8ty_push_client_messaging |
| m8ty Push Mobile API | /push/api/v2 |
Public (8080) | Device app | Registration: PKCE + attestation; otherwise device HTTP signature (token verification: bearer JWT) | m8ty_push_client_mobile |
| m8ty Push Public Keys API | /push |
Public (8080) | Device app | None | m8ty_push_client_public_keys |
| m8ty Push Admin Reporting API | /push/api/v1 |
Admin (8090) | Operator or reporting service | Bearer JWT | m8ty_push_client_admin |
m8ty-push-application-api in the source tree is an internal module with use-case interfaces, not an HTTP API. Interactive API documentation (RapiDoc) is served at /api-docs/index.html on the public and admin connectors.
All tenant operations use the path segment {tenantId} (the customer) and the query parameter appId. appId is required when the customer has more than one app; IDs match [A-Za-z0-9._-]{1,64}.
Headers and authentication
Section titled “Headers and authentication”Backend bearer tokens
Section titled “Backend bearer tokens”Send Authorization: Bearer <JWT>. The token is verified against the trust configured for the path customer (issuer discovery, explicit JWKS URL or static RSA key) and must contain:
| Claim | Requirement |
|---|---|
aud |
Includes push |
iat, exp |
Required; lifetime at most 15 minutes by default (configurable up to one hour) |
tenant_id |
String or list that explicitly contains the path tenant (claim name configurable) |
app_access |
Map of tenant IDs to exact app IDs, for example {"customer-a": ["wallet"]} (claim name configurable; no wildcards) |
scope, roles |
Per operation, see below |
| Operation | Required authorization |
|---|---|
| Send message | Scope m8ty:usr:pushmessages, role service |
| Read message metadata, state and diagnostics | Scope m8ty:usr:pushmessagesread |
| Read or query devices | Scope m8ty:usr:pushdeviceread |
| De-register device, verify device token | Scope m8ty:usr:pushdevice |
| Customer reporting (public connector) | Scope m8ty:usr:pushreports, role admin, exact customer/app grant |
| Monthly usage report (admin connector) | Scope m8ty:usr:pushreports, role admin |
Example claims for a backend that may read messages of the wallet app:
{ "tenant_id": "customer-a", "app_access": { "customer-a": ["wallet"] }, "aud": ["push"], "scope": "m8ty:usr:pushmessagesread"}Device HTTP signatures
Section titled “Device HTTP signatures”All device calls except registration and the public keys use RFC 9421 HTTP message signatures with the registered device key:
| Header | Content |
|---|---|
Signature-Input |
Covered components "@method" "@target-uri" "content-digest" plus created, nonce, keyid (JWK thumbprint of the device key) and alg (ecdsa-p256-sha256 or rsa-pss-sha512) |
Signature |
sig1=:<base64-signature>: |
Content-Digest |
sha-256=<base64 SHA-256 of the raw body> (hash of an empty body for GET) |
Signature-Input: sig1=("@method" "@target-uri" "content-digest");created=<epoch>;nonce="<unique>";keyid="<thumbprint>";alg="ecdsa-p256-sha256"Signature: sig1=:<base64-signature>:Content-Digest: sha-256=<base64-body-hash>The signature must be at most five minutes old (plus 30 seconds tolerance) and each nonce is accepted once. The target URI includes the query string, so appId must not change after signing. Ingress and clients must agree on scheme, host and port.
Other headers and responses
Section titled “Other headers and responses”| Header / response | Use |
|---|---|
X-Correlation-Id |
Idempotency key for message submission (max. 200 characters); retries with the same ID return the original pushId with duplicate=true |
Content-Type: application/json |
JSON request bodies |
429 with Retry-After |
Request rate or customer quota exceeded; signed retries need a fresh nonce |
413 |
Request body exceeds the configured limit (default 1 MiB) |
Errors from controllers use an ErrorResponse with code, messages, datetime, traceId and endpoint. Errors raised by security filters (for example invalid signatures) can use a different representation.
Messaging API
Section titled “Messaging API”| Method | Path | Behavior |
|---|---|---|
| POST | /{tenantId}/messages |
Validate, deduplicate, persist and enqueue; 202 with pushId and duplicate |
| GET | /{tenantId}/messages/{pushId} |
Message metadata and aggregate state |
| GET | /{tenantId}/messages/{pushId}/state |
Aggregate state plus paginated recipient states |
| GET | /{tenantId}/messages/{pushId}/diagnostics |
Per-device delivery diagnostics timeline |
| GET | /{tenantId}/devices/{deviceId} |
Device metadata (status, OS, OS version, language, model, app version) |
| POST | /{tenantId}/devices/query |
Look up up to 999 devices by ID |
| DELETE | /{tenantId}/devices/{deviceId} |
De-register (block) a device; 204 |
| GET | /{tenantId}/reporting/overview |
Customer reporting: monthly series and distributions for one app (1–36 months) |
| GET | /{tenantId}/reporting/drilldown |
Customer reporting: daily counts for one metric and month |
| POST | /{tenantId}/users/{userId}/messages |
Not supported; returns 501 |
Sending a message
Section titled “Sending a message”Request body (PushMessageCommand):
| Field | Required | Description |
|---|---|---|
target |
Yes | mode must be SENDER_SPECIFIED_DEVICES_LIST; deviceIds lists registered device UUIDs |
classification |
Yes | INSTANT (1–10 recipients, consumed on first read) or ALERT (1–999 recipients, repeatable reads) |
sender |
Yes | 1–25 characters; must match a configured sender when the app defines senders |
publicNotification |
Yes | Visible content that may pass through FCM/APNs and appear on the lock screen; its expirationDate sets the message expiry |
privateNotification |
No | Encrypted content and business data, delivered only through the Push Server |
callback |
No | url, method (POST), optional expires, and auth (type: NONE, BASIC, KEY, ACCESS_TOKEN, SERVICE_TOKEN; optional reference) |
Both notification sections accept title (1–50), body (1–450), subtitle (up to 100), imageUrl (HTTPS PNG/JPEG), sound (default, none or a bundled file name), badge, groupId, collapseId, android (channelId, visibility, large icon), ios (categoryId, interruptionLevel), up to four actions, translations and up to 36 data items. Data item types are text/plain (max. 250 characters), application/link-format (400), application/jwt and application/json (8000).
| Classification | Default lifetime | Minimum | Maximum |
|---|---|---|---|
INSTANT |
10 minutes | 5 seconds | 2 hours |
ALERT |
30 days | 5 seconds | 30 days |
POST /push/api/v2/customer-a/messages?appId=walletHost: push.example.comAuthorization: Bearer <service-token>X-Correlation-Id: 6f1c2a52-3e0b-4f8e-9d1e-2a7c1b0f9e11Content-Type: application/json{ "target": { "mode": "SENDER_SPECIFIED_DEVICES_LIST", "deviceIds": ["11111111-1111-4111-8111-111111111111"] }, "classification": "INSTANT", "sender": "bank", "publicNotification": { "title": "New message", "body": "Open the app." }}Response (202):
{ "status": "SUCCESSFUL", "pushId": "d23b472b-8713-499f-a75e-90786114699f", "duplicate": false}202 means the message was accepted and queued, not that it was delivered. Aggregate message states are QUEUED, NO_DEVICES, PROCESSING, PROCESSED, PROCESSED_WITH_WARNINGS and REJECTED; recipient states include QUEUED, SENT, ERROR, EXPIRED, DELIVERED, READ, ANSWERED and DELETED.
Private notifications
Section titled “Private notifications”A message without privateNotification is sent as a visible public push. With privateNotification:
- The provider receives only a silent push containing the
pushId(no text, images, sender, data or translations). - The app retrieves the message from the Mobile API and receives
publicNotificationplusencryptedNotification, a compact JWE encrypted to its device key with a nested server-signed JWT. - The app decrypts, verifies push ID, device ID, expiry and signature, and displays the private notification locally.
- If the device has not retrieved the message within the server-controlled fallback timeout (default 15 seconds), the server sends the
publicNotificationas a visible fallback.
Business data belongs in privateNotification.data; it is encrypted per recipient. Only publicNotification.expirationDate controls expiry, and senders cannot change the fallback timeout.
{ "target": { "mode": "SENDER_SPECIFIED_DEVICES_LIST", "deviceIds": ["5c68500a-7b23-4ad2-8f4f-cb0ea919c23b"] }, "classification": "ALERT", "sender": "bank", "publicNotification": { "title": "Payment approval", "body": "Open the app to review your payment.", "translations": { "de": { "title": "Zahlungsfreigabe", "body": "Öffnen Sie die App, um Ihre Zahlung zu prüfen." } }, "android": { "channelId": "payments" }, "ios": { "categoryId": "PAYMENT_APPROVAL", "interruptionLevel": "time-sensitive" }, "collapseId": "payment:123" }, "privateNotification": { "title": "Confirm CHF 125.50", "subtitle": "Example AG", "body": "Approve your payment to Example AG.", "translations": { "de": { "title": "CHF 125.50 bestätigen", "subtitle": "Example AG", "body": "Geben Sie Ihre Zahlung an Example AG frei.", "actions": [ { "id": "VIEW_PAYMENT", "label": "Zahlung ansehen" }, { "id": "REJECT_PAYMENT", "label": "Ablehnen", "destructive": true } ] } }, "badge": 1, "groupId": "payments", "android": { "channelId": "payments", "visibility": "private" }, "ios": { "categoryId": "PAYMENT_APPROVAL", "interruptionLevel": "time-sensitive" }, "actions": [ { "id": "VIEW_PAYMENT", "label": "View payment" }, { "id": "REJECT_PAYMENT", "label": "Reject", "destructive": true } ], "sound": "payment.wav", "data": [ { "key": "messageType", "type": "text/plain", "value": "pushTan" }, { "key": "payment", "type": "application/json", "value": "{\"paymentId\":\"123\",\"amount\":\"125.50\",\"currency\":\"CHF\"}" } ] }, "callback": { "url": "https://api.example.com/push/callback", "method": "POST", "auth": { "type": "NONE" } }}The decrypted content has this structure:
{ "version": 1, "pushId": "<same push ID>", "deviceId": "<recipient device ID>", "expirationDate": "<same message expiry>", "privateNotification": { "title": "Localized private title", "body": "Localized private body", "data": [{ "key": "paymentId", "type": "text/plain", "value": "123" }] }}With M8TY_PUSH_SILENT_FIRST_DELIVERY=true (the default), public-only messages also use silent-first delivery with the same fallback.
Localization
Section titled “Localization”translationsmaps BCP 47 language tags (up to 50) to a completetitleandbodyand an optionalsubtitleandactions.- The server selects the text per device using its stored language: exact tag, then parent tags, then the default text (
de-CH→de→ default). It never picks a sibling region. - The selected text is frozen per recipient when it is first prepared and is used for retries and all retrievals. Public and private sections are resolved independently.
- Translated
actionsmust keep the same IDs, order and behavior flags; only labels and text-input labels change. - The device language comes from registration and the signed
PUT /{tenantId}/devices/{deviceId}/preferencescall (language,osType,osVersion).
Actions are definitions for app rendering (opensApp, requiresAuthentication, destructive, optional textInput). The server does not create buttons on automatically displayed provider alerts; iOS public alerts use categories registered by the app.
Mobile API
Section titled “Mobile API”| Method | Path | Behavior |
|---|---|---|
| GET | /{tenantId}/devices/registration |
Issue nonce for code_challenge with code_challenge_method=S256 |
| POST | /{tenantId}/devices/registration?code_verifier=... |
Register device from raw JSON (registrationData, attestationData); 201 |
| GET | /{tenantId}/devices/{deviceId}/token |
Signed; issue one-time DEVICE_LOGIN token (5 minutes) |
| POST | /{tenantId}/devices/{deviceId}/token/verify |
Backend bearer JWT; body token and scope; 202 or 409 |
| PUT | /{tenantId}/devices/{deviceId}/push-token |
Signed; replace the FCM or APNs token (providerType, value); 204 |
| PUT | /{tenantId}/devices/{deviceId}/preferences |
Signed; update language and OS metadata; 204 |
| GET | /{tenantId}/devices/{deviceId}/messages |
Signed; list unexpired messages (selector all or undelivered, size 1–100, order, date, cursor) |
| GET | /{tenantId}/devices/{deviceId}/messages/{pushId} |
Signed; message with publicNotification and encryptedNotification |
| PUT | /{tenantId}/devices/{deviceId}/messages/{pushId} |
Signed; set state delivered, read or deleted; 204 |
| POST | /{tenantId}/devices/{deviceId}/messages/{pushId}/callback |
Signed; forward an encrypted device answer |
| GET | /push/.well-known/jwks.json |
Public server keys (Public Keys API) |
Registration must send the exact attested bytes of registrationData (for example as application/octet-stream); do not rebuild the JSON after obtaining attestation. List requests are cursor-based: pass nextCursor as cursor and keep page=0. Reading an INSTANT message consumes it, even if the HTTP response is lost.
Callbacks
Section titled “Callbacks”- The backend sets
callbackin the message. The URL must match the sender’scallback-urlorcallback-url-allowed-basein the app configuration; authenticated callbacks require HTTPS.{tenantId}and{pushId}in the URL are substituted. - The app posts
{"jwe": "<compact JWE>"}to the callback endpoint. The JWE contains the device-signed answer encrypted to the server key. - The server forwards the decrypted JSON with
POSTand the configured authentication, plus anIdempotency-Keyheader.
| Auth type | Outbound credential (from app configuration) |
|---|---|
NONE |
None |
BASIC |
Username and password reference |
KEY |
Static key, header X-API-Key by default |
ACCESS_TOKEN |
Static token, Authorization: Bearer by default |
SERVICE_TOKEN |
OAuth client-credentials token from the sender’s callback-realm (no static fallback) |
| Response to the device | Meaning |
|---|---|
| 200 | Backend returned 2xx; recipient is now ANSWERED |
| 409 | Concurrent or repeated callback |
| 410 | Callback or message expired |
| 422 | Recipient unknown or not DELIVERED/READ |
| 502 | Backend returned a non-2xx response |
Repeated callbacks are rejected unless M8TY_PUSH_ALLOW_MULTI_CALLBACK=true. Forwarding is not exactly-once; backends should honor the Idempotency-Key.
Delivery diagnostics
Section titled “Delivery diagnostics”GET /push/api/v2/customer-a/messages/{pushId}/diagnostics?appId=wallet&size=100Authorization: Bearer <service-token>Optional deviceId filters one recipient; size is 1–500 and after takes the previous nextCursor. Each event has a type, phase (SILENT, PUBLIC, FALLBACK, RETRIEVAL), timestamp, provider and attempt ID:
| Event | Meaning |
|---|---|
SEND_STARTED |
Provider call about to start |
PROVIDER_ACCEPTED / PROVIDER_REJECTED |
Known provider result (not device delivery) |
PROVIDER_OUTCOME_UNKNOWN |
Provider may or may not have accepted the request |
PROVIDER_DEFERRED |
Send postponed to a later processing turn (for example, processing budget exhausted) |
RETRIEVAL_SERVED |
First retrieval prepared content for the device |
FALLBACK_SCHEDULED, FALLBACK_CANCELLATION_REQUESTED, FALLBACK_SKIPPED |
Fallback lifecycle |
DELIVERY_BLOCKED |
No token/adapter, expired message or terminal failure |
Diagnostics contain identifiers, timestamps and status codes only, never notification text, data or tokens. deviceDisplay and userInteraction are always UNKNOWN: the server does not collect display or interaction receipts.
Admin Reporting API
Section titled “Admin Reporting API”GET /push/api/v1/{tenantId}/reports/devices?from=2026-09-01&to=2026-09-30 on the admin connector returns monthly active-device counts (unique devices with a provider-accepted send per UTC month, whole months, at most 36).
Dart client packages
Section titled “Dart client packages”The four packages are generated from the OpenAPI contracts with the dart-dio generator and use built_value models:
| Package | Contract | Typical user | API classes |
|---|---|---|---|
m8ty_push_client_messaging |
Messaging API | Backend services or tools written in Dart | MessagingApi, DiagnosticsApi, ReportingApi |
m8ty_push_client_mobile |
Mobile API | Mobile app | RegistrationApi, DeviceAuthenticationApi, DeviceTokensApi, DevicePreferencesApi, MobileApi |
m8ty_push_client_public_keys |
Public Keys API | Mobile app | PublicKeysApi |
m8ty_push_client_admin |
Admin Reporting API | Reporting tools | ReportingApi |
Sending a message with the messaging client:
import 'package:m8ty_push_client_messaging/m8ty_push_client_messaging.dart';
final client = M8tyPushClientMessaging( basePathOverride: 'https://push.example.com/push/api/v2',);client.setBearerAuth('bearerAuth', accessToken);
final command = PushMessageCommand((b) => b ..target.mode = 'SENDER_SPECIFIED_DEVICES_LIST' ..target.deviceIds.add(deviceId) ..classification = PushMessageCommandClassificationEnum.ALERT ..sender = 'bank' ..publicNotification.title = 'Payment approval' ..publicNotification.body = 'Open the app to review your payment.');
final response = await client.getMessagingApi().deliverMessage( tenantId: 'customer-a', appId: 'wallet', xCorrelationId: correlationId, pushMessageCommand: command,);print(response.data?.pushId);In the app, the mobile and public-key clients cover the device protocol:
- Fetch server keys with
PublicKeysApi.getServerPublicKeys. - Request a nonce with
RegistrationApi.issueRegistrationNonceand register withRegistrationApi.registerDevice, passing the original attested JSON bytes (MultipartFile.fromBytes). - Keep the push token and language current with
DeviceTokensApi.updateDevicePushTokenandDevicePreferencesApi.updateDevicePreferences. - On a silent push, fetch the message with
MobileApi.getDeviceMessage(orlistDeviceMessages), decryptencryptedNotificationwith the device key and verify it against the server keys. - Report state with
MobileApi.updateMessageStateand send answers withMobileApi.forwardCallback.
See Dart Clients for the general use of m8ty Dart client packages.
See Also
Section titled “See Also”- Push Server — overview and capabilities
- Push Server: Architecture — components and core flows
- Push Server: APNs and FCM Setup — provider credentials
- Dart Clients — m8ty Dart client packages
- BFF Server — m8ty backend architecture
© m8ty GmbH 2023 · m8ty.eu
