Some checks failed
Deploy to Phoenix / deploy (push) Has been cancelled
- ADD_CHAIN138_TO_LEDGER_LIVE: Ledger form done; public code review repo bis-innovations/LedgerLive; init/push commands - CONTRACT_DEPLOYMENT_RUNBOOK: Chain 138 gas price 1 gwei, 36-addr check, TransactionMirror workaround - CONTRACT_*: AddressMapper, MirrorManager deployed 2026-02-12; 36-address on-chain check - NEXT_STEPS_FOR_YOU: Ledger done; steps completable now (no LAN); run-completable-tasks-from-anywhere - MASTER_INDEX, OPERATOR_OPTIONAL, SMART_CONTRACTS_INVENTORY_SIMPLE: updates - LEDGER_BLOCKCHAIN_INTEGRATION_COMPLETE: bis-innovations/LedgerLive reference Co-authored-by: Cursor <cursoragent@cursor.com>
7.0 KiB
7.0 KiB
UniFi API Endpoints Reference
Last Updated: 2025-01-20
Document Version: 1.0
Status: Active Documentation
Overview
This document provides a reference for UniFi Controller API endpoints. The UniFi API has two modes:
- Official Local API (v1 endpoints) - Documented, version-specific
- Private Controller API (proxy/network endpoints) - Reverse-engineered, may vary between versions
Important Notes
- Official API endpoints are version-specific and available in your UniFi Network app (Settings → Control Plane → Integrations)
- Private API endpoints are reverse-engineered and may change between releases
- UDM Pro uses
/proxy/networkprefix for all Network API paths - For complete, up-to-date documentation, check your UniFi Network app's Integrations page
Official Local API (v1 endpoints)
Base Path
/proxy/network/integration/v1/
Authentication
X-API-KEY: {apiKey}
Accept: application/json
Known Endpoints (Verified)
Sites
GET /proxy/network/integration/v1/sites- List all sites- Response format:
{ "offset": 0, "limit": 25, "count": N, "totalCount": N, "data": [...] } - Site objects contain:
{ "internalReference": "site-id", "name": "Site Name" }
- Response format:
Endpoint Discovery Notes
Site ID Format:
- Use the
internalReferencevalue from the sites list as the site ID - The value "default" may not work - use the actual
internalReferencevalue from the sites response
Available Endpoints:
- The Official API endpoints are version-specific and limited
- Many endpoints return 404 (NOT_FOUND) or 400 (BAD_REQUEST) errors
- Endpoint availability depends on your UniFi Network app version
Recommendation:
- Check your UniFi Network app's Integrations page (Settings → Control Plane → Integrations) for complete, version-specific endpoint documentation
- The Official API may have fewer endpoints available compared to the Private API
- Consider using Private API for endpoints not available in Official API
Documentation Sources
For complete endpoint documentation:
- Access your UniFi Network app
- Navigate to: Settings → Control Plane → Integrations
- View the version-specific API documentation
- Look for OpenAPI/Swagger specification if available
Private Controller API (proxy/network endpoints)
Base Path
/proxy/network/api/s/{site}/
Authentication
- Cookie-based session (obtained via
POST /api/auth/login) - Login endpoint:
/api/auth/login(not prefixed)
Controller/Global Endpoints
Authentication
POST /api/auth/login- Login (save cookie)POST /api/logout- LogoutGET /api/self- Get current user infoGET /api/self/sites- List sitesGET /api/stat/sites- Site statisticsGET /api/stat/admin- Admin statistics
Site-Scoped Endpoints
Health / Identity / System Info
GET /api/s/{site}/self- Site self infoGET /api/s/{site}/stat/health- Site health statusGET /api/s/{site}/stat/sysinfo- System informationGET /api/s/{site}/stat/ccode- Country codeGET /api/s/{site}/stat/current-channel- Current channel info
Events / Alarms
GET /api/s/{site}/stat/event- List eventsGET /api/s/{site}/rest/event- REST events (varies by version)GET /api/s/{site}/stat/alarm- List alarmsGET /api/s/{site}/rest/alarm- REST alarms (+?archived=false)
Clients
GET /api/s/{site}/stat/sta- Active clientsGET /api/s/{site}/rest/user- Known/configured clientsPOST /api/s/{site}/rest/user- Create clientPUT /api/s/{site}/rest/user/{userId}- Update clientPOST /api/s/{site}/upd/user/{userId}- Update client (alternative)
Devices
GET /api/s/{site}/stat/device-basic- Basic device listGET /api/s/{site}/stat/device- Device listPOST /api/s/{site}/stat/device- Filter devices by MAC listGET /api/s/{site}/stat/device/{mac}- Get device by MAC (UDM variant)PUT /api/s/{site}/rest/device/{_id}- Update device
Networks / VLANs
GET /api/s/{site}/rest/networkconf- List networks/VLANsPUT /api/s/{site}/rest/networkconf/{_id}- Update network
WLANs
GET /api/s/{site}/rest/wlanconf- List WLAN configurationsGET /api/s/{site}/rest/wlanconf/{_id}- Get WLAN by IDPUT /api/s/{site}/rest/wlanconf/{_id}- Update WLAN
Firewall / Routing
GET /api/s/{site}/rest/firewallrule- List firewall rulesPUT /api/s/{site}/rest/firewallrule/{_id}- Update firewall ruleGET /api/s/{site}/rest/firewallgroup- List firewall groupsGET /api/s/{site}/stat/routing- Routing statisticsGET /api/s/{site}/rest/routing- Routing configuration (varies by version)GET /api/s/{site}/stat/portforward- Port forwarding rulesPUT /api/s/{site}/rest/portforward/{rule-id}- Update port forward rule
Traffic Rules (v2 style)
GET /v2/api/site/{site}/trafficrules- List traffic rulesPOST /v2/api/site/{site}/trafficrules- Create traffic rulePUT /v2/api/site/{site}/trafficrules/{id}/- Update traffic ruleDELETE /v2/api/site/{site}/trafficrules/{id}/- Delete traffic rule
Hotspot
GET /guest/s/{site}/hotspotconfig- Hotspot configurationGET /guest/s/{site}/hotspotpackages- Hotspot packages
System Operations (UDM-level)
Note: These require Super Admin rights and X-CSRF-Token header
POST /api/system/poweroff- Power off systemPOST /api/system/reboot- Reboot system
Response Format
Private API Response
{
"meta": {
"rc": "ok"
},
"data": [...]
}
meta.rc:"ok"for success,"error"for failuremeta.msg: Error message ifrcis"error"data: Array of response objects
Official API Response
Format varies - see your UniFi Network app's Integrations documentation.
Getting Complete Endpoint Documentation
For Official API
- Access your UniFi Network app
- Navigate to Settings → Control Plane → Integrations
- View the API documentation (version-specific)
- Look for OpenAPI/Swagger spec if available
For Private API
- See Ubiquiti Community Wiki
- Note: Endpoints are reverse-engineered and may vary between versions
Usage with unifi-api Library
The unifi-api library abstracts endpoint differences based on API mode. Use the service classes:
import { UnifiClient, ApiMode } from 'unifi-api';
const client = new UnifiClient({
baseUrl: 'https://192.168.1.1',
apiMode: ApiMode.PRIVATE, // or ApiMode.OFFICIAL
// ... credentials
});
// Services handle endpoint construction automatically
const devices = await devicesService.listDevices();