API Reference — Alert
Endpoint untuk mengelola Alert Rule dan Alert Type — buat, baca, perbarui, dan hapus konfigurasi aturan notifikasi berbasis event AI Visionaire.
← Kembali ke Alert Rules
Panduan operator: tambah, edit, hapus, dan konfigurasi alert rule.
Otentikasi
API key untuk integrasi, Bearer token untuk sesi pengguna, dan otentikasi WebSocket.
Semua endpoint memerlukan otentikasi. Untuk integrasi, kirim header X-Api-Key: <key> di setiap request tanpa header Authorization. Bearer token (Authorization: Bearer <access_token>, berlaku 30 menit) hanya untuk aplikasi yang menampilkan login Lenz ke penggunanya sendiri dan wajib menyertakan X-Integration-Signature. Basis URL mengikuti variabel lingkungan VITE_API_URL yang dikonfigurasi pada instalasi Lenz. Lihat Otentikasi untuk memilih jalur yang tepat.
Alert Rule
Endpoint utama untuk membuat, membaca, memperbarui, dan menghapus Alert Rule. Setiap rule menghubungkan kondisi trigger berbasis event AI dengan satu atau lebih channel notifikasi.
Daftar Alert Rule
Authorization
bearerAuth In: header
Query Parameters
Nomor halaman, dimulai dari 1
1Jumlah data per halaman
10Pencarian berdasarkan nama alert rule
Filter berdasarkan status aktif: true, false, atau kosong untuk semua
"true" | "false" | ""ID instance pada mode federation (opsional)
Response Body
application/json
application/json
curl -X GET "https://lenz.example.com/api/alert-rules"{ "ok": true, "message": "success", "result": { "limit": 10, "current_page": 1, "total_data": 2, "total_page": 1, "offset": 0, "alert_rules": [ { "id": 1, "name": "Deteksi Blacklist Pintu Utama", "description": "Notifikasi jika wajah blacklist terdeteksi", "active": true, "analytic_id": "FR", "alert_type_id": 1, "rules": [ { "attribute": "status", "operator": "==", "value": "blacklist", "streams": [ "stream-uuid-001" ], "logic": "AND", "auto_include_streams": false } ], "notification_channel_ids": [ 3, 7 ], "recipient_rules": null, "created_at": "2024-06-01T08:00:00Z", "updated_at": "2024-06-01T09:00:00Z", "deleted_at": null } ] }}{ "ok": false, "message": "unauthorized"}Buat Alert Rule
Authorization
bearerAuth In: header
Query Parameters
ID instance pada mode federation (opsional)
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
curl -X POST "https://lenz.example.com/api/alert-rules" \ -H "Content-Type: application/json" \ -d '{ "name": "Deteksi Blacklist Pintu Utama", "description": "Kirim notifikasi jika wajah dengan status blacklist terdeteksi", "active": true, "analytic_id": "FR", "alert_type_id": 1, "rules": [ { "attribute": "status", "operator": "==", "value": "blacklist", "streams": [ "stream-uuid-001", "stream-uuid-002" ], "logic": "AND", "auto_include_streams": false } ], "notification_channel_ids": [ 3 ], "recipient_rules": null }'{ "ok": true, "message": "alert rule created successfully"}{ "ok": false, "message": "invalid request body"}{ "ok": false, "message": "unauthorized"}Detail Alert Rule
Authorization
bearerAuth In: header
Path Parameters
ID numerik alert rule
Query Parameters
ID instance pada mode federation (opsional)
Response Body
application/json
application/json
curl -X GET "https://lenz.example.com/api/alert-rules/0"{ "ok": true, "message": "success", "alert_rule": { "id": 1, "name": "Deteksi Blacklist Pintu Utama", "description": "Notifikasi jika wajah blacklist terdeteksi", "active": true, "analytic_id": "FR", "alert_type_id": 1, "rules": [ { "attribute": "status", "operator": "==", "value": "blacklist", "streams": [ "stream-uuid-001" ], "logic": "AND", "auto_include_streams": false } ], "notification_channel_ids": [ 3, 7 ], "recipient_rules": [ { "attribute": "role_id", "operator": "==", "value": "2" } ], "created_at": "2024-06-01T08:00:00Z", "updated_at": "2024-06-01T09:00:00Z", "deleted_at": null }}{ "ok": false, "message": "alert rule not found"}Perbarui Alert Rule
Authorization
bearerAuth In: header
Path Parameters
ID numerik alert rule
Query Parameters
ID instance pada mode federation (opsional)
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
curl -X PUT "https://lenz.example.com/api/alert-rules/0" \ -H "Content-Type: application/json" \ -d '{ "active": false }'{ "ok": true, "message": "alert rule updated successfully"}{ "ok": false, "message": "alert rule not found"}Hapus Alert Rule
Authorization
bearerAuth In: header
Path Parameters
ID numerik alert rule
Query Parameters
ID instance pada mode federation (opsional)
Response Body
application/json
application/json
curl -X DELETE "https://lenz.example.com/api/alert-rules/0"{ "ok": true, "message": "alert rule deleted successfully"}{ "ok": false, "message": "alert rule not found"}Alert Type
Endpoint untuk membaca dan memperbarui konfigurasi Alert Type. Alert Type menentukan level keparahan visual (CRITICAL, WARNING, INFORMATION), warna tampilan, durasi notifikasi, dan suara opsional yang diputar saat alert terpicu di dashboard.
Daftar Alert Type
Authorization
bearerAuth In: header
Query Parameters
ID instance pada mode federation (opsional)
Response Body
application/json
application/json
curl -X GET "https://lenz.example.com/api/alert-type"{ "ok": true, "message": "success", "data": [ { "id": 1, "level": "CRITICAL", "color": "#FF0000", "duration_ms": 10000, "sound_data": null, "sound_updated_at": null, "instance": "core", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-01T00:00:00Z" }, { "id": 2, "level": "WARNING", "color": "#FFA500", "duration_ms": 7000, "sound_data": null, "sound_updated_at": null, "instance": "core", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-01T00:00:00Z" }, { "id": 3, "level": "INFORMATION", "color": "#0077FF", "duration_ms": 5000, "sound_data": null, "sound_updated_at": null, "instance": "core", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-01T00:00:00Z" } ]}{ "ok": false, "message": "unauthorized"}Detail Alert Type
Authorization
bearerAuth In: header
Path Parameters
ID numerik Alert Type
Response Body
application/json
application/json
curl -X GET "https://lenz.example.com/api/alert-type/0"{ "ok": true, "message": "success", "data": { "id": 1, "level": "CRITICAL", "color": "#FF0000", "duration_ms": 10000, "sound_data": null, "sound_updated_at": null, "instance": "core", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-01T00:00:00Z" }}{ "ok": false, "message": "alert type not found"}Perbarui Alert Type
Authorization
bearerAuth In: header
Path Parameters
ID numerik Alert Type
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
curl -X PUT "https://lenz.example.com/api/alert-type/0" \ -H "Content-Type: application/json" \ -d '{ "color": "#FF8C00", "duration_ms": 8000 }'{ "ok": true, "message": "alert type updated successfully", "data": { "id": 2, "level": "WARNING", "color": "#FF8C00", "duration_ms": 8000, "sound_data": null, "sound_updated_at": null, "instance": "core", "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-06-01T12:00:00Z" }}Alert Rules
Konfigurasi aturan alert untuk memicu notifikasi secara otomatis berdasarkan event AI Visionaire — tentukan kondisi, stream target, dan channel pengiriman dalam satu rule.
Alert History
Riwayat alert yang sudah menyala dari Alert Rules — tinjau, tandai tindak lanjutnya, perbarui banyak baris sekaligus, dan ekspor ke PDF atau Excel.