Skip to main content
The TEE server creates notifications when significant events happen to an agent — for example, when an invoice is paid, when a payment is received to a stealth address, or when a scheduled payment runs. Use these endpoints to surface alerts in your application UI. All endpoints require a Bearer token in the Authorization header.

GET /agent/:id/notifications

Fetch all notifications for an agent along with the count of unread ones.

Path parameters

id
string
required
The agent UUID.

Response

notifications
Notification[]
required
An array of notification objects, ordered from newest to oldest.
unreadCount
number
required
The number of notifications with read: false. Use this to render a badge in your UI.

Example

curl https://api.wraith.dev/agent/550e8400-e29b-41d4-a716-446655440000/notifications \
  -H "Authorization: Bearer wraith_live_abc123"

The Notification interface

import type { Notification } from "@wraith-protocol/sdk";

interface Notification {
  id: number;
  type: string;
  title: string;
  body: string;
  read: boolean;
  createdAt: string;
}

POST /agent/:id/notifications/read

Mark all notifications as read. The unreadCount will be 0 after this call.

Path parameters

id
string
required
The agent UUID.

Response

Returns 200 OK with no body on success.

Example

curl -X POST \
  https://api.wraith.dev/agent/550e8400-e29b-41d4-a716-446655440000/notifications/read \
  -H "Authorization: Bearer wraith_live_abc123"

DELETE /agent/:id/notifications

Delete all notifications for an agent. This is permanent — deleted notifications cannot be recovered.

Path parameters

id
string
required
The agent UUID.

Response

Returns 200 OK with no body on success.

Example

curl -X DELETE \
  https://api.wraith.dev/agent/550e8400-e29b-41d4-a716-446655440000/notifications \
  -H "Authorization: Bearer wraith_live_abc123"

Polling for notifications

Notifications are not pushed — poll the endpoint on a schedule to surface updates in your UI:
import { Wraith } from "@wraith-protocol/sdk";

const wraith = new Wraith({ apiKey: "wraith_live_abc123" });
const agent = wraith.agent("550e8400-e29b-41d4-a716-446655440000");

async function pollNotifications() {
  const { notifications, unreadCount } = await agent.getNotifications();

  if (unreadCount > 0) {
    // Surface unread notifications in your UI
    const unread = notifications.filter((n) => !n.read);
    displayAlerts(unread);

    // Mark as read after displaying
    await agent.markNotificationsRead();
  }
}

// Poll every 30 seconds
setInterval(pollNotifications, 30_000);