Documentation Index
Fetch the complete documentation index at: https://visual-layer-my-changes.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
How This Helps
The Notifications API provides programmatic access to alert notifications generated by the monitoring system. Retrieve alerts, check unread counts, mark notifications as read, and subscribe to real-time updates via Server-Sent Events (SSE).
Prerequisites
- A Visual Layer Cloud account with API access.
- A valid JWT token. See Authentication.
- At least one saved view with alerting enabled, and a dataset that has received new media since the view was created.
Notifications are generated automatically when a monitored view with alerting enabled detects new matching results after a media batch is processed. The Notifications API is read-only — notifications cannot be created through the API.
List Notifications
Retrieve notifications for the authenticated user with pagination and filtering.Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
limit | integer | 20 | Maximum notifications to return (1–100). |
offset | integer | 0 | Number of notifications to skip for pagination. |
unread_only | boolean | false | When true, return only unread notifications. |
dataset_id | UUID | null | Filter notifications to a specific dataset. |
Example
Response (200)
Notification Fields
| Field | Type | Description |
|---|---|---|
id | UUID | Unique notification identifier. |
user_id | UUID | The user this notification belongs to. |
entity_type | string | Always "saved_view" for monitor alerts. |
entity_id | UUID | The saved view that triggered this alert. |
title | string | Notification title (currently empty for monitor alerts). |
message | string or null | Optional notification message. |
metadata | object | Alert details including view_name, dataset_name, result_count, batch_id, and is_alert. |
dataset_id | UUID or null | The dataset associated with this notification. |
created_at | datetime | When the notification was generated. |
read_at | datetime or null | When the notification was marked as read. null if unread. |
Pagination
The response includestotal (total matching notifications) and has_more (boolean indicating whether additional pages exist). Increment offset by limit to retrieve the next page.
Get Unread Count
Retrieve the number of unread notifications for the authenticated user. This endpoint is lightweight and suitable for polling to update badge counts.Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
dataset_id | UUID | null | Count only unread notifications for a specific dataset. |
Example
Response (200)
Mark Notification as Read
Mark a single notification as read by its ID.Parameters
| Parameter | Location | Type | Required | Description |
|---|---|---|---|---|
notification_id | path | UUID | Yes | The notification to mark as read. |
Example
Response (200)
Mark All Notifications as Read
Mark all notifications as read for the authenticated user. Optionally scope to a specific dataset.Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
dataset_id | UUID | null | Mark only notifications for this dataset as read. If omitted, all notifications are marked as read. |
Example
Response (200)
count field indicates how many notifications were marked as read.
Real-Time Notification Stream (SSE)
Subscribe to a Server-Sent Events stream for real-time notification delivery. The server maintains a long-lived connection and pushes new notifications as they arrive.Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
dataset_id | UUID | null | Stream only notifications for a specific dataset. |
Event Types
| Event | Description |
|---|---|
notification | A new notification. The data field contains the full notification JSON object. |
ping | Keepalive event sent every 3 seconds. No meaningful data. |
error | An internal error occurred. The connection remains open and retries automatically. |
JavaScript Example
Python Example
The SSE stream polls the database every 3 seconds. Notifications appear within one polling cycle of being generated. The connection stays open until the client disconnects.
Python Example: Full Workflow
Response Codes
See Error Handling for the error response format and Python handling patterns.| HTTP Code | Meaning | Common Cause |
|---|---|---|
| 200 | Request successful. | |
| 401 | Unauthorized. | Invalid or expired JWT token. |
| 404 | Not found. | Notification does not exist, does not belong to the user, or is already read (for mark-as-read). |
| 422 | Validation error. | Invalid query parameter values (for example, limit exceeding 100). |
| 500 | Internal server error. | Contact support if this persists. |
Best Practices
- Use
unread-countfor lightweight polling. The unread count endpoint returns a single integer and is suitable for frequent polling to update UI badge counts without fetching full notification payloads. - Filter by
dataset_idwhen possible. Scoping requests to a specific dataset reduces response size and improves relevance, especially for users with access to many datasets. - Use SSE for real-time integrations. The streaming endpoint provides sub-second alert delivery without polling overhead. Use it for dashboards, Slack integrations, or automated response workflows.
- Mark alerts as read after processing. Unread counts continue to grow if alerts are not acknowledged. Use
read-allafter reviewing a batch of notifications, or mark individual notifications as you process them. - Use
has_morefor pagination. Check thehas_morefield before requesting additional pages. Requesting pages beyond the total returns empty results.
Related Resources
Saved Views API
Create views and configure monitoring and alerting.
Monitoring and Alerts
Understand how monitoring and alerting works across your datasets.
Add Media
Add media to datasets, triggering monitoring evaluation on all views.
Task Manager API
Track media addition tasks that trigger monitoring evaluation.