go-unifi
A Go client for the UniFi Network controller API — type-safe access to networks, clients, devices, firewall, and more.
go-unifi is a Go client library for the UniFi Network controller API. It powers the Terraform provider for UniFi but works standalone in any Go project that needs to talk to a UniFi controller.
It gives you strongly-typed access to networks, WLANs, clients, devices, firewall rules, settings and dozens of other resources — most of them generated directly from the controller's own API definitions for broad, accurate coverage.
Two API surfaces, one client
A single unifi.Client exposes both of the controller's APIs:
Internal API (default)
The legacy UniFi Network API the library has always wrapped. Every resource method (ListNetwork,
CreateUser, …) lives here, reachable directly on the client or via c.Internal().
Official API
The official UniFi OpenAPI (integration/v1), reached via c.Official(). A fluent, per-resource surface
that requires a newer controller and an API key.
Start here
Installation
Add the module and import the packages.
Quickstart
Connect to a controller and make your first call in one runnable program.
Authentication
Create an API key and understand the version requirements.
Guides
Task-oriented recipes: networks, devices, clients, firewall, and more.
Reference
The exported Go API: client, configuration, errors, and resources.
UniFi API Reference
The Official OpenAPI rendered endpoint-by-endpoint, with Go equivalents.
Requirements
- Go 1.26 or later.
- A UniFi OS console (new-style) running UniFi Network 9.0.114 or newer — API-key authentication is the only supported auth. The Official API surface additionally requires UniFi Network 10.1.78 or newer. (Both are Network Application versions; UniFi OS — the console's operating system — versions separately.)
Upgrading from go-unifi 1.x? See the migration guide. Coming from
paultyng/go-unifi? See Migrating from upstream.
AI & LLMs
Pointing an LLM or AI coding agent at these docs? They're published in machine-readable form following the llms.txt convention:
/llms.txt— a compact index of every page, with descriptions./llms-full.txt— the entire documentation as a single plain-text file.
Every page header also has a button to copy that page as Markdown.