List, read, and manage alert notifications triggered by monitored saved views.
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).
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 the 5 most recent notificationscurl -H "Authorization: Bearer <jwt>" \ "https://app.visual-layer.com/api/v1/notifications?limit=5"# List unread notifications for a specific datasetcurl -H "Authorization: Bearer <jwt>" \ "https://app.visual-layer.com/api/v1/notifications?unread_only=true&dataset_id=<dataset_id>"
The response includes total (total matching notifications) and has_more (boolean indicating whether additional pages exist). Increment offset by limit to retrieve the next page.
# Total unread count across all datasetscurl -H "Authorization: Bearer <jwt>" \ "https://app.visual-layer.com/api/v1/notifications/unread-count"# Unread count for a specific datasetcurl -H "Authorization: Bearer <jwt>" \ "https://app.visual-layer.com/api/v1/notifications/unread-count?dataset_id=<dataset_id>"
# Mark all notifications as readcurl -X POST \ -H "Authorization: Bearer <jwt>" \ "https://app.visual-layer.com/api/v1/notifications/read-all"# Mark only notifications for a specific dataset as readcurl -X POST \ -H "Authorization: Bearer <jwt>" \ "https://app.visual-layer.com/api/v1/notifications/read-all?dataset_id=<dataset_id>"
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.
GET /api/v1/notifications/streamAuthorization: Bearer <jwt>
import requestsimport jsonVL_BASE_URL = "https://app.visual-layer.com"JWT_TOKEN = "<your-jwt-token>"headers = {"Authorization": f"Bearer {JWT_TOKEN}"}# Open SSE streamresp = requests.get( f"{VL_BASE_URL}/api/v1/notifications/stream", headers=headers, stream=True,)for line in resp.iter_lines(decode_unicode=True): if line.startswith("data: ") and line.strip() != "data:": data = json.loads(line[6:]) if "metadata" in data and data["metadata"].get("is_alert"): print(f"Alert: {data['metadata']['view_name']}") print(f" {data['metadata']['result_count']} new results")
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.
Use unread-count for 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_id when 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-all after reviewing a batch of notifications, or mark individual notifications as you process them.
Use has_more for pagination. Check the has_more field before requesting additional pages. Requesting pages beyond the total returns empty results.