---
title: "Inbox client | EventWolf SDK"
description: "Read a signed-in principal's notifications in a browser or app with the EventWolf SDK's inbox client, and keep its live stream open as their token expires."
url: "https://agentpost.tools/docs/eventwolf/sdk/inbox"
kind: sdk
---

# Inbox client

`createInboxClient({ token })` reads one principal’s [notifications](/docs/eventwolf/concepts/notifications.md) from a browser or an app. Pass the signed-in principal’s [user token](/docs/platform/concepts/user-tokens.md), IdentityHound session token, API key, or a delegated token that acts for them, or a function that supplies their credential. Pass a function when the client keeps a stream open, so it can get a fresh token when one expires.

## Read and mark

The client lists, counts, and marks the principal’s notifications, and reads and sets their preferences. A notification whose event was erased has `erasedAt` and no `title`. Use `isErased(notification)` to check. In a phone app, `seenOnPushAddress(addressId, notificationId)` marks that phone seen.

## Stream

`subscribe({ onNotification, onCount })` streams new notifications. Pass the notification ID or cursor in `subscription.lastId` as `after` to resume a later subscription.

## When the token expires

If a user token expires on an open stream, the client calls your function with `{ expired }` and reconnects from its last position, which the server sends even before the first notification. It catches up on retained notifications.

If your function returns the expired token again, the client waits, reports it with `onError(error, { stopped: false })`, and asks again. Pass `staleRetries` to `subscribe` to set how many times it asks. The default is `5`. Set `maxRetryMs` to cap the wait between reconnects in milliseconds. The default is `30_000`.

The stream stops with `onError(error, { stopped: true })` when access is withdrawn, a fresh token is refused, the retries run out, or a fixed token expires.
