Palbase Notify · API
/notify/devicesRegister a device
Records the device, or its new token: the signed-in user's, with their access token; with the publishable key alone, its installation's — a push that names the installation reaches it, whoever is signed in, no one included; when someone signs in, their registration takes the token and the device is theirs, and signed out the app registers it as the installation's again. A token another device held moves here: one token reaches one device. A signed-in user's device is the session's it is registered in: when that session ends — the user signs out, ends it from another device, an admin revokes it — the device is forgotten; registered again in another session, it is that one's. A registration in a session that has ended is refused (401 session_ended).
Called by your app, with the publishable key; or a signed-in user of your app, with their token and the publishable key.
Headers
Idempotency-Keystring · optionalMakes the write safe to send again (at most 255 characters). A retry with the same key and the same request gets the first answer back, marked `Idempotent-Replayed: true`, and changes nothing; the same key with a different request is refused with 422, and while the first request still runs a retry gets 409 with Retry-After. Answers are kept for 24 hours.X-Palbase-Installation-Secretstring · optionalThe install's secret, as its SDK keeps it (32 random bytes, base64url): the installation id is made from it (the first 16 bytes of its SHA-256, base64url), so it proves the request holds the install it names. Required whenever the request names an installation.Request body
apns_environment"sandbox" | "production" · optionalThe Apple Push Notification service environment an iOS token is for: sandbox (an app run from Xcode, a development-signed build) or production (TestFlight, the App Store, ad hoc). Palbase sends through it, to the bundle of the app whose publishable key registered the device. Absent: Palbase tries both and keeps the one that delivers.app_versionstring · optionaldevice_idstring · requiredThe app's own stable name for the device.installation_idstring · optionalThe app install's label (the SDK's installation id): required with no one signed in — the device is the installation's.localestring · optionalThe device's language: the push it gets is in it.platform"android" | "ios" | "ios_voip" | "web" · requiredtimezonestring · optionalThe device's clock, an IANA time zone (Europe/Istanbul): when a push for its person's own hour goes, and their quiet hours. A registration that says none keeps the one it had.tokenstring · requiredcurl -X POST "https://<your-ref>.palbase.studio/notify/devices" \
-H "apikey: $PALBASE_PUBLISHABLE_KEY" \
-H "authorization: Bearer $USER_ACCESS_TOKEN" \
-H "content-type: application/json" \
-d '{"device_id":"string","platform":"android","token":"string"}'Responses
200Register a device
400Validation failed or a required field is missing
401Missing or invalid API key
403Not the project's secret key, or not what the shared sender sends for it (`own_provider_required`; `auth_template_reserved`: auth's templates, which auth's own flows alone send through it, but for an organization's invitation, auth.org_invitation); or a change to the platform's own project (`owner_only`) without its owner's access token (X-Palbase-Owner) or its operator's token (X-Palbase-Operator) beside the key. An owner's sign-in that is not a passkey one from the last 15 minutes is 401 `insufficient_user_authentication`.
409A request with this Idempotency-Key is still running
422The Idempotency-Key was sent with a different request
429Over the project's request limit, or its shared sends for this window
503Temporarily unavailable; retrying is safe after Retry-After
defaultAn error: the envelope names it (`error`) and explains it (`error_description`).
Operation RegisterDevice of notify's contract.