Skip to content

The Notifications & Events API provides access to platform-level event history and user-facing notifications. Use these endpoints to query audit logs, retrieve aggregated event statistics, manage user notifications, and clean up old event records.

Query event history with filtering, pagination, and sorting. Maximum 500 events per page.

NameInTypeRequiredDescription
limitqueryintegerNoNumber of events to return (max 500). Default: 100
offsetqueryintegerNoNumber of events to skip. Default: 0
sort_byquerystringNoField to sort by. Allowed: created_at, event_type. Default: "created_at"
sort_orderquerystringNoSort direction. Allowed: asc, desc. Default: "desc"
event_typequerystringNoFilter by specific event type
resource_typequerystringNoFilter by resource type
resource_idquerystringNoFilter by specific resource ID
project_idquerystringNoFilter by project ID
container_idquerystringNoFilter by container ID
start_datequerystringNoFilter events after this timestamp
end_datequerystringNoFilter events before this timestamp
realm_idquerystringNoFilter by realm ID
const stream = client.api.events.listIterator({
limit: 100,
sort_by: "created_at",
sort_order: "desc",
});
for await (const event of stream) {
console.log(event.event_type);
}
{
"statusCode": 200,
"message": "Events retrieved successfully",
"data": {
"events": [
{
"id": "507f1f77bcf86cd799439044",
"event_type": "container.running",
"resource_type": "container",
"resource_id": "507f1f77bcf86cd799439033",
"user_id": "507f1f77bcf86cd799439011",
"payload": {
"container": {
"id": "507f1f77bcf86cd799439033",
"name": "web-app-1",
"status": "running",
"project_id": "507f1f77bcf86cd799439022"
}
},
"realm_ids": ["507f1f77bcf86cd799439022"],
"created_at": "2025-01-15T10:30:05.123Z"
}
],
"pagination": {
"total": 1523,
"limit": 100,
"offset": 0,
"has_more": true
}
}
}

Retrieve detailed information about a specific event.

NameInTypeRequiredDescription
idpathstringYesEvent ID
const event = await client.api.events.get({
id: "507f1f77bcf86cd799439044",
});
{
"statusCode": 200,
"message": "Event retrieved successfully",
"data": {
"id": "507f1f77bcf86cd799439044",
"event_type": "container.running",
"resource_type": "container",
"resource_id": "507f1f77bcf86cd799439033",
"user_id": "507f1f77bcf86cd799439011",
"payload": {
"container": {
"id": "507f1f77bcf86cd799439033",
"name": "web-app-1",
"status": "running",
"project_id": "507f1f77bcf86cd799439022"
}
},
"realm_ids": ["507f1f77bcf86cd799439022"],
"created_at": "2025-01-15T10:30:05.123Z"
}
}

Get aggregated statistics about event history.

NameInTypeRequiredDescription
start_datequerystringNoStart of time range
end_datequerystringNoEnd of time range
realm_idquerystringNoFilter by realm
const stats = await client.api.events.getStats({
start_date: "2025-01-01T00:00:00.000Z",
end_date: "2025-01-31T23:59:59.999Z",
});
{
"statusCode": 200,
"message": "Event statistics retrieved successfully",
"data": {
"total_events": 15234,
"by_type": {
"container.running": 3456,
"container.stopped": 2134,
"storage.share.mount_changed": 1523,
"notification.read": 8121
},
"by_resource": {
"container": 8765,
"storage_share": 2456,
"notification": 4013
},
"oldest_event": "2024-11-15T10:30:00.000Z",
"newest_event": "2025-01-15T10:30:00.000Z"
}
}

Delete events older than the specified retention period. Admin access required.

FieldTypeRequiredDescription
retention_daysintegerYesDelete events older than this many days (min: 1, max: 365)
{
"retention_days": 30
}
const result = await client.api.events.cleanup({
retention_days: 30,
});
{
"statusCode": 200,
"message": "Old events cleaned up successfully",
"data": {
"deleted_count": 5432,
"retention_days": 30,
"cutoff_date": "2024-12-15T10:30:00.000Z"
}
}

Delete multiple events at once based on filters.

FieldTypeRequiredDescription
event_typestringNoDelete all events of this type
resource_typestringNoDelete all events for this resource type
resource_idstringNoDelete all events for this resource
before_datestringNoDelete events before this date
realm_idstringNoDelete events in this realm
{
"resource_type": "container",
"before_date": "2024-12-15T00:00:00.000Z"
}
const result = await client.api.events.bulkDelete({
resource_id: "507f1f77bcf86cd799439033",
});
{
"statusCode": 200,
"message": "Events deleted successfully",
"data": {
"deleted_count": 1523
}
}

Permanently delete an event from history.

NameInTypeRequiredDescription
idpathstringYesEvent ID to delete
await client.api.events.delete({
id: "507f1f77bcf86cd799439044",
});
{
"statusCode": 200,
"message": "Event deleted successfully"
}

Get all notifications for the authenticated user, including global notifications and notifications targeted to the user.

This endpoint takes no parameters.

const stream = client.api.notifications.listIterator();
for await (const notification of stream) {
console.log(notification.title);
}
{
"statusCode": 200,
"message": "Notifications retrieved successfully",
"data": [
{
"id": "507f1f77bcf86cd799439030",
"title": "System Maintenance Notice",
"message": "Scheduled maintenance will occur on January 25th at 2:00 AM UTC.",
"type": "MAINTENANCE",
"severity": "WARNING",
"is_public": true,
"is_global": true,
"target_user_ids": null,
"expires_at": "2025-01-26T00:00:00.000Z",
"created_at": "2025-01-20T10:00:00.000Z",
"updated_at": "2025-01-20T10:00:00.000Z",
"is_read": false,
"read_at": null
}
]
}

Get all public notifications. No authentication required.

This endpoint takes no parameters.

const stream = client.api.notifications.listPublicIterator();
for await (const notification of stream) {
console.log(notification.title);
}
{
"statusCode": 200,
"message": "Public notifications retrieved successfully",
"data": [
{
"id": "507f1f77bcf86cd799439030",
"title": "System Maintenance Notice",
"message": "Scheduled maintenance will occur on January 25th at 2:00 AM UTC.",
"type": "MAINTENANCE",
"severity": "WARNING",
"is_public": true,
"is_global": true,
"target_user_ids": null,
"expires_at": "2025-01-26T00:00:00.000Z",
"created_at": "2025-01-20T10:00:00.000Z",
"updated_at": "2025-01-20T10:00:00.000Z"
}
]
}

Mark a notification as read for the authenticated user.

NameInTypeRequiredDescription
idpathstringYesUnique identifier of the notification to mark as read
const result = await client.api.notifications.markRead({
id: "507f1f77bcf86cd799439030",
});
{
"statusCode": 200,
"message": "Notification marked as read",
"data": {
"id": "507f1f77bcf86cd799439150",
"notification_id": "507f1f77bcf86cd799439030",
"is_read": true,
"read_at": "2025-01-21T21:30:00.000Z"
}
}

Mark all notifications as read for the authenticated user.

This endpoint takes no parameters.

const result = await client.api.notifications.markAllRead();
{
"statusCode": 200,
"message": "All notifications marked as read",
"data": {
"count": 5
}
}