Reference
Curated reference for the go-unifi exported API — client, configuration, errors, resources, and the Official OpenAPI surface.
This section is a curated reference. It documents the parts of the API you reach for most — how to build a client, every configuration field, the error model, and the two API surfaces — with the structure, defaults, and gotchas you cannot get from a flat symbol list.
For exhaustive, always-current detail (every resource struct, every field, every method signature), the source of truth is pkg.go.dev. These pages link there liberally rather than re-typing hundreds of generated fields that would drift out of date.
Most resource types are generated from the controller's own API definitions, so they are far better browsed on pkg.go.dev than transcribed here. The curated pages cover the hand-written, stable surface; pkg.go.dev covers the long tail.
Pages
Client
NewClient, the Client interface, and its transport/lifecycle methods.
Configuration types
Every ClientConfig field plus the ValidationMode, APIStyle, and logging enums.
Errors
ServerError, ValidationError, and the Err* sentinels you match with errors.Is.
Surface Coverage
What each surface covers, resource by resource, and where they overlap.
Official API
The c.Official() surface and the OpenAPI endpoint-by-endpoint reference.
Internal API
The legacy resource methods, the settings catalogue, and feature constants.
Conventions
- Every client method takes a
context.Contextas its first argument. - Internal (legacy) methods address a site by its name string (
"default"); the Official surface addresses a site byuuid.UUID(resolve it withc.Official().Sites().ResolveID). See Choosing a surface. - Errors are wrapped with
%w; match sentinels and typed errors witherrors.Is/errors.As. See Errors.