Skip to content

Conversation

@zupolgec
Copy link

@zupolgec zupolgec commented Jan 26, 2026

Summary

Add support for managing static DNS records on UniFi Network controllers via the v2 API (Network 8.2+).

Features

  • Supported record types: A, AAAA, CNAME, MX, TXT, SRV, NS
  • Local access: Direct connection to UniFi controller with optional TLS verification skip for self-signed certs
  • Cloud access: Remote management via UniFi Cloud Connector (api.ui.com) - requires UniFi OS 5.0.3+
  • Domain filtering: Automatically filters records by domain suffix since UniFi stores all records flat

Configuration

Local Access

{
  "unifi": {
    "TYPE": "UNIFI",
    "host": "https://192.168.1.1",
    "api_key": "your-api-key",
    "site": "default",
    "skip_tls_verify": "true"
  }
}

Cloud Access

{
  "unifi_cloud": {
    "TYPE": "UNIFI",
    "console_id": "your-console-id",
    "api_key": "cloud-api-key",
    "site": "default"
  }
}

Usage Example

var DNS_UNIFI = NewDnsProvider("unifi");

D("home.internal", REG_NONE, DnsProvider(DNS_UNIFI),
    A("server", "10.0.0.10"),
    CNAME("www", "server.home.internal."),
    MX("@", 10, "mail.home.internal."),
END);

Testing

Tested using the OLD API (/v2/api/site/{site}/static-dns) via:

  • Local access: UDM Pro (Network 10.0.162)
  • Cloud access: Remote console via api.ui.com (Network 10.1.78)

All CRUD operations verified working on both access methods.

References

Add support for managing static DNS records on UniFi Network controllers
via the v2 API (Network 8.2+). Supports both local access and remote
cloud access via api.ui.com.

Features:
- Supported record types: A, AAAA, CNAME, MX, TXT, SRV, NS
- Local access with optional TLS verification skip for self-signed certs
- Cloud access via UniFi Cloud Connector (requires UniFi OS 5.0.3+)
- Automatic record filtering by domain suffix

Configuration options:
- host: Local controller URL (e.g., https://192.168.1.1)
- console_id: Cloud console ID for remote access
- api_key: UniFi API key
- site: Site name (defaults to 'default')
- skip_tls_verify: Skip TLS verification for self-signed certs
@zupolgec
Copy link
Author

Hi @tlimoncelli, Unifi is launching a new API to manage DNS records in v10.1.
Should this new API be implemented in a new UNIFI_V2 provider, or we can add version detection in this new provider (since no one is using it yet) or a flag?

@tlimoncelli
Copy link
Collaborator

tlimoncelli commented Jan 27, 2026

Hi @tlimoncelli, Unifi is launching a new API to manage DNS records in v10.1. Should this new API be implemented in a new UNIFI_V2 provider, or we can add version detection in this new provider (since no one is using it yet) or a flag?

Either is fine. If you want to skip v1 and only support v2, that's fine too. (edited for clarity)

@tlimoncelli tlimoncelli changed the title new provider: Add UniFi Network DNS provider NEW PROVIDER: UniFi Network DNS provider Jan 27, 2026
@zupolgec
Copy link
Author

Hi @tlimoncelli, Unifi is launching a new API to manage DNS records in v10.1. Should this new API be implemented in a new UNIFI_V2 provider, or we can add version detection in this new provider (since no one is using it yet) or a flag?

Either is fine. If you want to skip v1 and only support v2, that's fine too. (edited for clarity)

Right now v2 is Early Access. And v1 would support all Unifi versions back to 8.x. That could be immediately useful for more users. I'll go with a flag that defaults to "auto" for version detection, best of both.

Support both UniFi Network APIs:
- Legacy API (v2/api/site/{site}/static-dns) for Network 8.2+
- New API (integration/v1/sites/{siteId}/dns/policies) for Network 10.1+

The new 'api_version' config parameter accepts:
- 'auto' (default): probes both APIs, prefers new, falls back to legacy
- 'new': forces new API only
- 'legacy': forces legacy API only

The new API supports native PUT for updates (no delete+create needed).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants