{"id":37046383,"url":"https://github.com/christophbrunner/unifi-api-dotnet","last_synced_at":"2026-01-14T05:29:03.973Z","repository":{"id":256863504,"uuid":"852671390","full_name":"christophbrunner/unifi-api-dotnet","owner":"christophbrunner","description":"A .NET (netstandard) client for the UniFi API.  Provides asynchronous API operations.","archived":false,"fork":false,"pushed_at":"2025-01-27T18:35:53.000Z","size":123,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-15T08:16:23.814Z","etag":null,"topics":["api","client","dotnet","ubiquiti","unifi"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/christophbrunner.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-05T08:05:00.000Z","updated_at":"2025-01-27T18:35:19.000Z","dependencies_parsed_at":"2024-09-13T13:33:28.526Z","dependency_job_id":"1a7a19f4-543d-4f03-9670-45d33de66285","html_url":"https://github.com/christophbrunner/unifi-api-dotnet","commit_stats":null,"previous_names":["christophbrunner/unifi-api-dotnet"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/christophbrunner/unifi-api-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophbrunner%2Funifi-api-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophbrunner%2Funifi-api-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophbrunner%2Funifi-api-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophbrunner%2Funifi-api-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/christophbrunner","download_url":"https://codeload.github.com/christophbrunner/unifi-api-dotnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/christophbrunner%2Funifi-api-dotnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28410471,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","client","dotnet","ubiquiti","unifi"],"created_at":"2026-01-14T05:29:03.339Z","updated_at":"2026-01-14T05:29:03.967Z","avatar_url":"https://github.com/christophbrunner.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"UniFi API dotnet Client\n=======================\n\nA .NET (netstandard) client for the official UniFi Site Manager API.  Provides asynchronous API operations.\n\nThe client is suitable for dependency injection (DI) and for classic applications.\n\n[![NuGet](https://img.shields.io/nuget/v/UniFiApiDotnet.svg)](https://www.nuget.org/packages/UniFiApiDotnet/)\n\n[![Continuous Integration (CI)](https://github.com/christophbrunner/unifi-api-dotnet/actions/workflows/ci.yml/badge.svg)](https://github.com/christophbrunner/unifi-api-dotnet/actions/workflows/ci.yml)\n\nThe UniFi API\n-------------\nThe official UniFi API is developed by Ubiquiti Networks created to enable developers to programmatically monitor and manage UniFi deployments at scale.\nIt provides robust tools to access and control your UniFi devices� data, allowing you to retrieve detailed information, monitor performance, and manage your network infrastructure efficiently. \n\nSite Manager API Version 0.1 centers around extracting data from the UniFi Site Manager (unifi.ui.com). Future versions will expand support to include more granular configurations, allowing management of individual sites and the devices within those sites.\nThe original documentation can be found at https://developer.ui.com/unifi-api/.\n\nUsage\n-----\n\nSimple and easy to use, the UniFi Site Manager API dotnet Client provides a set of methods to interact with the UniFi Site Manager API.\n\n```csharp\nIUniFiApiService uniFiApiService = new UniFiApiService();\n//e.g. get all UniFi devices\nvar sites = await uniFiApiService.GetDevices();\n```\n\nTo use the client with dependency injection (DI), the service can simply be registered.\n\n```csharp\n// Register the service in the service container\nbuilder.Services.UseUniFiApiDotnet();\n```\nAnd injected into the service class.\n```csharp\n// Inject the service into the service class\npublic class YourService\n{\n    private readonly IUniFiApiService _uniFiApiService;\n\n    public YourService(IUniFiApiService uniFiApiService)\n    {\n        _uniFiApiService = uniFiApiService;\n    }\n\n    public async Task YourMethode()\n    {\n        var devices = await _uniFiApiService.GetDevices();\n        //...\n    }\n}\n```\n\nAPI Coverage\n------------\n\n\n| |Complete?|API Method|\n|:---|:---:|:---|\n| [List Hosts](https://developer.ui.com/unifi-api/get__ea_hosts/) | :heavy_check_mark: | `GetHosts()` |\n| [Get Host by ID](https://developer.ui.com/unifi-api/get__ea_hosts_id/) | :heavy_check_mark: | `GetHostById(x)` |\n| [List Sites](https://developer.ui.com/unifi-api/get__ea_sites/) | :heavy_check_mark:  | `GetSites()`  |\n| [List Devices](https://developer.ui.com/unifi-api/get__ea_devices/) | :heavy_check_mark:  | `GetDevices(x)`  |\n| [Get ISP Metrics](https://developer.ui.com/unifi-api/get__ea_isp-metrics_type/) | :heavy_check_mark:  | `GetIspMetrics(x)`  |\n| [Query ISP Metrics](https://developer.ui.com/unifi-api/post__ea_isp-metrics_type_query/) | :heavy_check_mark:  | `QueryIspMetrics(x)`  |\n\nAuthentication\n--------------\nThe UniFi Site Manager API use a API key for authentication.\nThe API key can be created in the UniFi [Site Manager \u003e API](https://unifi.ui.com/api).\n\nThe API key can be initialized via different variants.\n\nInitialize the API key via Code\n```csharp\n// Initialize the API key via the constructor\nIUniFiApiService uniFiApiService = new UniFiApiService(\"[your_api_key]\");\n```\nor\n```csharp\n// Initialize the API key via a method\nIUniFiApiService uniFiApiService = new UniFiApiService();\nuniFiApiService.SetApiKey(\"[your_api_key]\");\n```\nor initialize the API key via the appsettings.json file\n```json\n{\n  \"UniFiApi\": {\n    \"ApiKey\": \"[your_api_key]\"\n  }\n}\n```\nor initialization during service registration for dependency injection (DI)\n\n```csharp\n// Initialize the API key on service registration\nbuilder.Services.UseUniFiApiDotnet(configure =\u003e\n{\n    configure.ApiKey = \"[your_api_key]\";\n});\n```\n\nThe API key is stored in the `UniFiApiService` class and is used for all subsequent API calls.\n\n[HttpClient](https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclient) / [WebProxy](https://learn.microsoft.com/de-de/dotnet/api/system.net.webproxy)\n--------------------------------------------------------------------------------------------------------------------------------------------------------------------\n\nBy default, a HttpClient is created internally.\nIt is also possible to specify a specific HttpClient with specific configurations.\n\nUse specific HttpClient (e.g. with Proxy) via the constructor\n```csharp\nvar proxy = new WebProxy\n{\n    Address = new Uri($\"http://myProxy:8081\"),\n};\n\nvar httpClientHandler = new HttpClientHandler\n{\n    Proxy = proxy,\n};\n\nvar client = new HttpClient(handler: httpClientHandler, disposeHandler: true);\n\n// Set the HttpClient via the constructor (optional with API key)\nIUniFiApiService uniFiApiService = new UniFiApiService(client);\n// or optional with API key\nIUniFiApiService uniFiApiService = new UniFiApiService(client, \"[your_api_key]\");\n```\n\nor with dependency injection (DI), register a named HttpClient (e.g. with Proxy) in the service container\n\n```csharp\nbuilder.Services.AddHttpClient(\"UniFiApi\").ConfigurePrimaryHttpMessageHandler(() =\u003e\n{\n    var proxy = new WebProxy\n    {\n        Address = new Uri($\"http://myProxy:8081\"),\n    };\n    var httpClientHandler = new HttpClientHandler\n    {\n        Proxy = proxy,\n    };\n\n    return httpClientHandler;\n});\n\nbuilder.Services.UseUniFiApiDotnet();\n```\n\nLogging (optional)\n------------------\n\nThe client uses the [Microsoft.Extensions.Logging](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging) framework for logging.\n\nBugs and Feedback\n-----------------\nThe UniFi Site Manager API is unfortunately not fully documented by UniFi.\nThe current implementation of the service is based on demo data and data from customers. \n\nIf you miss something just create an [issue](https://github.com/christophbrunner/unifi-api-dotnet/issues).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophbrunner%2Funifi-api-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchristophbrunner%2Funifi-api-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchristophbrunner%2Funifi-api-dotnet/lists"}