TypeScript SDK ยท client.sdk.notifications

Notifications

The notifications namespace gives your application access to fill pipeline events via standard REST API calls. When a fill job finishes or fails, a notification is recorded automatically - no extra setup required. Use these methods to display a badge counter, build an in-app notification feed, or check for completion without polling the document result endpoint directly.

client.sdk.notificationslistmarkAsRead
What this page covers
How fill pipeline events become notifications
Listing your notification feed with pagination
Fetching the unread count in your list response
Marking a single notification as read
Clearing all unread notifications in one call

Overview

What are notifications?

Every time the AI fill pipeline processes a job - whether it succeeds, fails, or reaches an intermediate state - the platform records a notification. Think of them as event receipts: they tell you what happened, when, and which pipeline or document was involved. You do not need to configure webhooks or set up listeners - notifications are recorded server-side and are available to fetch at any time through these REST endpoints.

REST API polling - not real-time
These endpoints use standard HTTP requests. To check for new notifications your application needs to call list() on a schedule. Real-time push delivery (WebSockets / SSE) is not available yet and will be added in a future release.
How a notification is created
Fill job triggereddocs.uploadFilledInfo()
Pipeline runsAI processes PDF
Notification createdstatus: ready / failed
You read itlist()
Mark as readmarkAsRead()
What a notification contains
FieldTypeDescription
idnumberUnique numeric ID for this notification.
event_typestringWhat happened - e.g. fill_complete or fill_failed.
statusstringCurrent pipeline state: ready, failed, or processing.
pipeline_idstringThe fill job that triggered this notification.
readbooleanfalse until you call markAsRead().
payloadobjectThe original event data - includes doc IDs, timestamps, and result details.
Full lifecycle example
notifications-overview.ts
import 'dotenv/config';
import Pdffillr from '@pdffillr/sdk';

const client = new Pdffillr({
  apiKey: process.env['PDFFILLR_API_KEY'], // This is the default and can be omitted
});

// 1. list() - fetch the notification feed. Response includes unreadCount.
const result = await client.sdk.notifications.list();
console.log(`Unread: ${result.unreadCount}`);
result.data?.forEach((n) => {
  console.log(`[${n.event_type}] Pipeline ${n.pipeline_id} - ${n.status}`);
});

// 2. markAsRead({ id }) - mark a single notification as read.
if (result.data && result.data.length > 0) {
  await client.sdk.notifications.markAsRead({ id: result.data[0].id });
}

// 3. markAsRead() - omit id to mark all unread notifications as read.
await client.sdk.notifications.markAsRead();

1. List Notifications

Returns your full notification feed - every event the pipeline has generated for your API key - ordered from newest to oldest. Results are paginated, so for large feeds you can request specific pages using the optional page and pageSize parameters. The response also conveniently includes the total unreadCount.

client.sdk.notifications.list(query?, options?)GET
/v1/sdk/notifications
ReturnsPaginated list of notification objects & unreadCount
RequiredNone - all parameters are optional
Query parameters
ParameterTypeDefaultDescription
pagenumber1Page number to retrieve. 1-indexed.
pageSizenumber20Number of notifications per page (1-100).
Example
notifications-list.ts
import Pdffillr from '@pdffillr/sdk';

const client = new Pdffillr({
  apiKey: process.env['PDFFILLR_API_KEY'], // This is the default and can be omitted
});

// Fetch the first page of notifications (default page size).
const result = await client.sdk.notifications.list();

console.log('Unread count:', result.unreadCount);
result.data?.forEach((notification) => {
  console.log('Event type :', notification.event_type);
  console.log('Pipeline   :', notification.pipeline_id);
  console.log('Status     :', notification.status);
  console.log('Read       :', notification.read);
  console.log('---');
});

// Paginate through a larger notification feed.
const page2 = await client.sdk.notifications.list({ page: 2, pageSize: 20 });
console.log(`Page 2 - ${page2.data?.length || 0} notification(s).`);
Use list() to poll for fill completion
Instead of repeatedly calling docs.getMetadata() to check if a fill job is done, you can poll notifications.list() and look for a notification with event_type: "fill_complete". This is more efficient when you are waiting on multiple jobs at once.

2. Mark Notification(s) as Read

Marks one or more notifications as read. By passing an object with an id, you mark a single, specific notification as read. If you omit the id, the system automatically marks all unread notifications as read at once.

client.sdk.notifications.markAsRead(body, options?)POST
/v1/sdk/notifications/read
Returnsvoid - no response body
RequiredNone
Body parameters (NotificationMarkAsReadParams)
ParameterTypeRequiredDescription
idnumberNoThe numeric ID of the notification. Omit to mark ALL notifications as read.
Example
notifications-mark-read.ts
import Pdffillr from '@pdffillr/sdk';

const client = new Pdffillr({
  apiKey: process.env['PDFFILLR_API_KEY'], // This is the default and can be omitted
});

// 1. Mark a single notification as read by passing its numeric ID.
await client.sdk.notifications.markAsRead({ id: 42 });
console.log('Notification 42 is now read.');

// 2. Clear all unread notifications in a single call by omitting the ID.
await client.sdk.notifications.markAsRead();
console.log('All notifications marked as read.');

What to read next

Was this page helpful?
PDFFILLR.AI logo

PDFFILLR.AI

The intelligent layer for modern fund
administration. Automating high-stakes
documentation with precision and speed.

Powered byEngineersMind