Types
Shared request/response type definitions exported by @litepush/sdk.
BroadcastTarget
typeBroadcast audience selector passed to send().
NotificationPayload
interfaceThe notification a broadcast renders in the browser.
| Property | Type | Description |
|---|---|---|
| title | string | Title — visible to the user. 1–256 chars. |
| body | string | Body text. 1–2048 chars. |
| icon? | string | Small icon. Either an HTTPS URL (used as-is) or a base64 |
| image? | string | Large banner image shown below the body on supported platforms. Same formats as |
| url? | string | URL opened on click. Defaults to |
SubscribeOptions
interface| Property | Type | Description |
|---|---|---|
| userId? | string | Your own user ID — lets you target this user across devices in |
SubscribeResult
interface| Property | Type | Description |
|---|---|---|
| id | string | LitePush-assigned subscriber ID ( |
Urgency
typeWeb Push delivery priority hint (RFC 8030 Urgency header). The push service uses it to trade off battery vs. promptness:
very-low— deliver only when the device is plugged in and on Wi-Fi.low— deliver when the device is active.normal— the default.high— wake the device promptly even when it's idle (e.g. a call, a code).
CreateBroadcastParams
interface| Property | Type | Description |
|---|---|---|
| target | BroadcastTarget | — |
| notification | NotificationPayload | — |
| ttl? | number | How long (seconds) the push service keeps trying to deliver while the device is offline. |
| urgency? | Urgency | Delivery priority hint. Defaults to |
| topic? | string | Collapse key (≤ 32 URL-safe chars: |
| scheduled_at? | number | Unix-ms timestamp to schedule the broadcast for a future time instead of sending now. Plus plan and above. Must be in the future, within 90 days. |
CreateBroadcastResult
interface| Property | Type | Description |
|---|---|---|
| broadcast_id | string | — |
| scheduled_at? | number | Present only when the broadcast was scheduled. |
Broadcast
interfaceA broadcast as returned by broadcasts.get() / broadcasts.list().
| Property | Type | Description |
|---|---|---|
| id | string | Broadcast id ( |
| status | "pending" | "sending" | "sent" | "failed" | "canceled" | Lifecycle: |
| source | "dashboard" | "api" | Where it originated: the dashboard or the API. |
| target | BroadcastTarget | The audience it was sent to. |
| notification | { title: string; body: string; icon: string | null; image: string | null; url: string | null } | The notification content. |
| ttl | number | null | Delivery options as sent. |
| urgency | Urgency | null | — |
| topic | string | null | — |
| delivered_count | number | Pushes accepted by the push gateway. |
| failed_count | number | Pushes that failed (dead subscription, gateway error, retries exhausted). |
| scheduled_at | number | null | Scheduled fire time (Unix ms), or |
| started_at | number | null | When fan-out began (Unix ms), or |
| finished_at | number | null | When fan-out finished (Unix ms), or |
| created_at | number | When the broadcast was created (Unix ms). |
ListBroadcastsParams
interface| Property | Type | Description |
|---|---|---|
| limit? | number | Max rows to return. 1–100. Defaults to 20. |
| offset? | number | Rows to skip, for paging. Defaults to 0. |
ListBroadcastsResult
interface| Property | Type | Description |
|---|---|---|
| broadcasts | Broadcast[] | This page of broadcasts, most recent first. |
| total | number | Total broadcasts in the project (ignores |
| limit | number | Echoes the effective |
| offset | number | — |
MeResult
interface| Property | Type | Description |
|---|---|---|
| project | { id: string; name: string; domain: string; vapid_public: string } | — |
Group
interface| Property | Type | Description |
|---|---|---|
| id | string | — |
| name | string | — |
| description | string | null | — |
| member_count | number | — |
| created_at | number | — |
ListGroupsResult
interface| Property | Type | Description |
|---|---|---|
| groups | Group[] | — |
CreateGroupParams
interface| Property | Type | Description |
|---|---|---|
| name | string | — |
| description? | string | — |
CreateGroupResult
interface| Property | Type | Description |
|---|---|---|
| id | string | — |
UpdateGroupParams
interface| Property | Type | Description |
|---|---|---|
| name? | string | — |
| description? | string | null | Pass |
AddSubscribersResult
interface| Property | Type | Description |
|---|---|---|
| added | number | Count actually inserted — members already in the group don't double-count. |
DeleteResult
interface| Property | Type | Description |
|---|---|---|
| deleted | number | Number of subscriber rows removed ( |
OkResult
interface| Property | Type | Description |
|---|---|---|
| ok | true | — |
LitePushErrorCode
typeStable, machine-readable error identifiers the LitePush API returns in the error.code field (see LitePushApiError). Branch on these rather than on the human-readable message. New codes may be added over time, so keep a default branch when switching exhaustively.
Auth & project resolution:
missing_api_key(401) — noAuthorization: Bearer …header.invalid_api_key(401) — the API key is unknown or revoked.missing_project(400) —subscribe()reached the API with no project id.project_not_found(404) — the project id doesn't exist.origin_not_allowed(403) —subscribe()called from an origin that isn't
the project's registered domain.
project_locked(403) — the project exceeds the owner's plan limit; it's
read-only and won't accept subscribers until they upgrade or free a slot.
orphan_project(500) — the project's owner record is missing.
Plan limits / upgrades:
subscriber_limit_reached(403) — at the plan's subscriber cap.monthly_push_limit_reached(403) — at the plan's monthly push cap.group_limit_reached(403) — at the plan's group cap.image_requires_upgrade(403) — banner images need Hobby or above.scheduling_requires_upgrade(403) — scheduled sends need Plus or above.
Request validation:
invalid_icon/invalid_image(400) — bad icon/image data or dimensions.invalid_scheduled_at(400) — schedule time missing, in the past, or too far out.
Resource state:
group_not_found(404),broadcast_not_found(404).group_name_taken(409) — a group with that name already exists.not_cancelable(409) — the broadcast already fired or isn't a scheduled one.
Transport:
rate_limited(429) — too many requests; see theRetry-Afterheader.internal_error(500) — an unexpected server error.
ApiErrorBody
interfaceShape of the API error envelope: { error: { code, message } }.
| Property | Type | Description |
|---|---|---|
| error | { code: LitePushErrorCode | string & object; message: string } | — |