| Crates.io | unifi-protect-client |
| lib.rs | unifi-protect-client |
| version | 0.2.2 |
| created_at | 2025-06-16 08:48:13.077372+00 |
| updated_at | 2025-08-18 07:36:46.395963+00 |
| description | A Rust client library for interacting with the UniFi Protect API |
| homepage | https://github.com/Xapphire13/unifi-protect-client |
| repository | https://github.com/Xapphire13/unifi-protect-client |
| max_upload_size | |
| id | 1714053 |
| size | 73,234 |
A Rust client library for interacting with the UniFi Protect API.
cargo add unifi-protect-client
use unifi_protect_client::{UnifiProtectClient, models::camera::*};
use anyhow::Result;
#[tokio::main]
async fn main() -> Result<()> {
// Create a client
let client = UnifiProtectClient::new(
"https://192.168.1.1",
"username",
"password"
);
// List all cameras
let cameras = client.list_cameras().await?;
println!("Found {} cameras", cameras.len());
for camera in &cameras {
println!("Camera: {} (ID: {})", camera.name, camera.id);
println!("Recording mode: {:?}", camera.recording_settings.mode);
}
// Update a camera's recording mode
if let Some(camera) = cameras.first() {
let update = CameraUpdate {
recording_settings: Some(RecordingSettingsUpdate {
mode: Some(RecordingMode::Always),
}),
};
client.update_camera(&camera.id, update).await?;
println!("Updated camera {} to always record", camera.name);
}
Ok(())
}
See https://docs.rs/unifi-protect-client
Authentication Failures
Error: Unauthorized access - check your credentials
Admins & Users in your UniFi console)Protect permissions in UniFi console)Network Connectivity
Error: Network error: connection refused
Invalid Response Format
Error: Failed to parse API response: missing field 'id'
This crate is for interacting with the UniFi Protect API.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
This is an unofficial client library and is not affiliated with or endorsed by Ubiquiti Inc. UniFi and Protect are trademarks of Ubiquiti Inc.