Skip to main content

Push devices and notifications

The native mobile apps register the phone they run on so Budget Thing can send it short push notifications. A device is one app installation of one signed-in user, registered for one workspace the user belongs to. The user chooses which kinds of notification each device receives, and every kind is off until chosen.

OperationMethod and pathSuccess
register-push-devicePUT /v1/workspaces/{workspaceID}/me/devices200 with the device
list-push-devicesGET /v1/me/devices200 with devices
update-push-devicePATCH /v1/me/devices/{deviceID}200 with the device
unregister-push-deviceDELETE /v1/me/devices/{deviceID}204

Who can use it​

Every operation acts on the authenticated user's own devices. None takes a user ID, so you cannot register, read, change or remove another user's device. Any active member of a workspace can register a device for it, including viewers, because the notifications are about the member's own workspace. A caller who is not a member gets 404, as for every workspace operation, and nothing is stored. PATCH on another user's device is 404. DELETE on a device that is gone, or is not yours, is 204 without effect, so the app can always call it on sign-out and the call never reveals whose device an ID is.

A device is bound to the Kratos session it registered under (the session ID is read from the request, never sent in the body and never returned). POST /v1/me/sign-out-everywhere deletes the caller's devices of every other session before it revokes those sessions, so a signed-out phone stops getting notifications. The calling session's device stays. Devices registered before sessions were recorded have no session and are removed too; the app registers again on its next start. If the revocation then fails with 503, the devices are already gone and the call can be repeated safely.

No scope covers these operations, so a personal access token is refused. See What no scope can reach. They send no webhooks.

Register a device​

{
"platform": "android",
"pushToken": "<the FCM registration token>",
"appVersion": "1.4.0",
"locale": "en-US",
"notifyOverspent": true
}
FieldMeaning
platformandroid or ios. Android delivery uses Firebase Cloud Messaging; iOS devices can register now and receive notifications when iOS delivery ships.
pushTokenThe token from the platform's push service, 1 to 4096 characters. It is a secret: it is never returned by the API and never logged.
appVersion, localeOptional, for diagnostics.
notifyOverspent, notifyInbox, notifyBillDue, showAmountsOptional choices, see below. Omitted fields keep their value, and a new device starts with all of them false.

The call is an upsert keyed by the push token, so the app calls it after every sign-in and whenever the platform refreshes the token. Re-registering the same token returns the same device, moves lastSeenAt forward and keeps the choices it already had. If the token is already registered to a different user (a second person signed in on the same phone), the one row moves to the caller and starts with every choice off: nobody inherits another person's choices. A user keeps at most 10 devices; registering an eleventh removes the one seen least recently.

The response never includes the token:

{
"id": "pdev_...",
"workspaceId": "wks_...",
"platform": "android",
"appVersion": "1.4.0",
"locale": "en-US",
"lastSeenAt": "2027-03-10T12:00:00Z",
"notifyOverspent": true,
"notifyInbox": false,
"notifyBillDue": false,
"showAmounts": false,
"notificationsOn": true
}

Notification types​

FieldSent when
notifyOverspentA category goes below zero in the current budget period. Once per category and period, from the category.overspent event.
notifyInboxA bank sync staged new transactions for review (banksync.sync.completed with imported transactions).
notifyBillDueAn open bill is due within the user's bill reminder lead time (1 to 7 days, 3 by default) or today. Sent by the bill reminder worker from 07:00 in the workspace's time zone, to the opted-in devices of the user who owns them, for a workspace whose plan includes bills.

A bill-due push has its own dedupe, separate from the reminder emails: once per user, bill payment, lead time and due date (a payment whose due date moves is reminded about again), so the email and the push never hide each other, and the email switch does not have to be on. A bill the user muted gets none, and neither does a paid, skipped or archived one. Several open bills in a workspace make one notification ("3 bills are due soon"). If every matching device fails for a transient reason the claim is released and the next hourly run retries; a dead token deletes its device instead. The data payload is type: "bill_due" and workspaceId.

A push token is registered for one workspace, so a phone is only told about the workspace it was last registered for. The mobile app re-registers when the user switches workspace.

Notifications hide amounts by default: the text names the user's own category or says how many transactions are waiting. Setting showAmounts to true for a device lets the text include the overspent amount in the workspace currency. The notification's data payload (type, workspaceId) never carries an amount.

What removes a device​

  • unregister-push-device, which the app calls on sign-out.
  • Leaving a workspace or being removed from it removes your devices for that workspace.
  • Deleting your account removes all your devices.
  • When Firebase reports that a token is permanently invalid (the app was uninstalled), the device is removed.

Push tokens are excluded from workspace exports and backups.

Operator note​

Delivery needs a Firebase service account key in the FCM_SERVICE_ACCOUNT_JSON environment variable, read only from the secret store. Without it the API still accepts registrations and sends nothing.