products:software:unifi-controller:api

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:software:unifi-controller:api [2023/02/07 15:45] – Add 2 Hotspots endpoints pelletier.jeanfrancoisproducts:software:unifi-controller:api [2025/05/12 13:37] (current) – external edit 127.0.0.1
Line 16: Line 16:
 </code> </code>
  
-==== UDM Pro API ====+==== UDM Pro and UCG Max API ====
  
-**NOTE:** There are two critical differences between Unifi controllers and the UDM Pro's API:+**NOTE:** There are two critical differences between Unifi controllers and the API of the UDM Pro and UCG Max:
  
   * The login endpoint is **''/api/auth/login''**   * The login endpoint is **''/api/auth/login''**
Line 29: Line 29:
 <panel title="curl"> <panel title="curl">
 <code> <code>
-curl -k -X POST --data '{"username": "usr", "password": "$pw"}' --header 'Content-Type: application/json' -cookie.txt https://udmp:443/api/auth/login +# authenticate and save the cookie contents in local file cookie.txt with switch '-c' 
-# responds with 'Not Found'+curl -k -X POST --data '{"username": "usr", "password": "$pw"}' --header 'Content-Type: application/json' -cookie.txt https://udmp:443/api/auth/login 
 +# responds with json data 
 + 
 +# pass the local file cookie.txt with switch '-b'
 curl -k -X GET -b cookie.txt https://udmp/proxy/network/api/s/default/self curl -k -X GET -b cookie.txt https://udmp/proxy/network/api/s/default/self
 # responds with proper json # responds with proper json
Line 92: Line 95:
 | rest/firewallgroup             | GET/PUT       | ​User defined firewall groups.                                                                                                                                                                                                                                                                             | | rest/firewallgroup             | GET/PUT       | ​User defined firewall groups.                                                                                                                                                                                                                                                                             |
 | rest/wlanconf                  | GET/PUT       | List WLANs, edit current WLANs and create new WLANs                                                                                                                                                                                                                                                        | | rest/wlanconf                  | GET/PUT       | List WLANs, edit current WLANs and create new WLANs                                                                                                                                                                                                                                                        |
 +| rest/wlanconf/{_id}            | GET           | Get details of WLAN designated by '_id'                                                                                                                                                                                                                                                   |
 | rest/wlanconf/{_id}            | PUT           | Update configuration of current WLAN designated by '_id'                                                                                                                                                                                                                                                   | | rest/wlanconf/{_id}            | PUT           | Update configuration of current WLAN designated by '_id'                                                                                                                                                                                                                                                   |
 | rest/tag                       | GET/PUT?      | Tagged macs (api.err.Invalid per controller version 7.1.66)                                                                                                                                                                                                                                                | | rest/tag                       | GET/PUT?      | Tagged macs (api.err.Invalid per controller version 7.1.66)                                                                                                                                                                                                                                                |
Line 105: Line 109:
 | rest/portforward               | GET           | List all port forwards configured on the site                                                                                                                                                                                                                                                              | | rest/portforward               | GET           | List all port forwards configured on the site                                                                                                                                                                                                                                                              |
 | stat/report/{interval}.{type}  | POST          | Intervals are '5minutes', 'hourly', and 'daily' Report types are 'site', 'user', and 'ap' Must specify attributes to be returned 'bytes', 'wan-tx_bytes', 'wan-rx_bytes', 'wlan_bytes', 'num_sta', 'lan-num_sta', 'wlan-num_sta', 'time', 'rx_bytes', 'tx_bytes' Can be filtered with 'macs': [...]  | | stat/report/{interval}.{type}  | POST          | Intervals are '5minutes', 'hourly', and 'daily' Report types are 'site', 'user', and 'ap' Must specify attributes to be returned 'bytes', 'wan-tx_bytes', 'wan-rx_bytes', 'wlan_bytes', 'num_sta', 'lan-num_sta', 'wlan-num_sta', 'time', 'rx_bytes', 'tx_bytes' Can be filtered with 'macs': [...]  |
 +| stat/authorization             | POST          | JSON as "%%{"start": "START TIMESTAMP", "end": "END TIMESTAMP"}%%" and you will get the code that have been used between the Timestams    NOTE: X-CSRF-Token header required (from e.g. the login response) for UDM                                                                                        |
 +| stat/sdn                       | GET           | Return values as if the site is connected with the Unifi Cloud or the SSO                                                                                                                                                                                                                                  |
  
 === Callable commands === === Callable commands ===
Line 146: Line 152:
 This data was extracted from the javascript of the site. This data was extracted from the javascript of the site.
  
-^ Model     ^ Type  ^ SKU                   | Name                         +^ Model     ^ Type  ^ SKU                    | Name                               
-| BZ2       | uap   | UAP                   | Access Point                 +| BZ2       | uap   | UAP                    | Access Point                       
-| BZ2LR     | uap   | UAP-LR                | Access Point LR              | +| BZ2LR     | uap   | UAP-LR                 | Access Point Long-Range            
-| p2N       | uap   | PICOM2HP              | PicoStation M2               +| S216150   | usw   | US-16-150W             | Switch 16 PoE (150 W             
-| S216150   | usw   | US-16-150W            | Switch 16  (150W           +| S224250   | usw   | US-24-250W             | Switch 24 PoE (250 W             
-| S224250   | usw   | US-24-250W            | Switch 24  (250W           +| S224500   | usw   | US-24-500W             | Switch 24 PoE (500 W             
-| S224500   | usw   | US-24-500W            | Switch 24  (500W           +| S248500   | usw   | US-48-500W             | Switch 48 PoE (500 W             
-| S248500   | usw   | US-48-500W            | Switch 48  (500W           +| S248750   | usw   | US-48-750W             | Switch 48 PoE (750 W             
-| S248750   | usw   | US-48-750W            | Switch 48  (750W           +| S28150    | usw   | US-8-150W              | Switch 8 PoE (150 W              
-| S28150    | usw   | US-8-150W             | Switch 8  (150W            +| U2HSR     | uap   | UAP-Outdoor+           | Access Point Outdoor+              
-| U2HSR     | uap   | UAP-Outdoor+          | Access Point Outdoor+        +| U2IW      | uap   | UAP-IW                 | Access Point In-Wall               
-| U2IW      | uap   | UAP-IW                | Access Point In Wall         +| U2L48     | uap   | UAP-LR                 | Access Point Long-Range            
-| U2L48     | uap   | UAP-LR                | Access Point LR              +| U2Lv2     | uap   | UAP-LRv2               | Access Point Long-Range            
-| U2Lv2     | uap   | UAP-LRv2              | Access Point LR v2           +| U2M       | uap   | UAP-Mini               | Access Point Mini                  
-| U2M       | uap   | UAP-Mini              | Access Point Mini            +| U2O       | uap   | UAP-Outdoor            | Access Point Outdoor               
-| U2O       | uap   | UAP-Outdoor           | Access Point Outdoor         +| U2S48     | uap   | UAP                    | Access Point                       
-| U2S48     | uap   | UAP                   | Access Point                 +| U2Sv2     | uap   | UAPv2                  | Access Point                       
-| U2Sv2     | uap   | UAPv2                 | Access Point v2              +| U5O       | uap   | UAP-Outdoor5           | Access Point Outdoor 5             | 
-| U5O       | uap   | UAP-Outdoor5          | Access Point Outdoor 5G      | +| U6ENT     | uap   | U6-Enterprise          | Access Point WiFi 6 Enterprise     | 
-| U7E       | uap   | UAP-AC                | Access Point AC              +| U6EXT     | uap   | U6-Extender            | Access Point WiFi 6 Extender       | 
-| U7EDU     | uap   | UAP-AC-EDU            | Access Point AC EDU          +| U6IW      | uap   | U6-IW                  | Access Point WiFi 6 In-Wall        | 
-| U7Ev2     | uap   | UAP-AC                | Access Point AC v2           +| U6M       | uap   | U6-Mesh                | Access Point WiFi 6 Mesh           
-| U7HD      | uap   | UAP-AC-HD             | Access Point HD              +| U7E       | uap   | UAP-AC                 | Access Point AC                    
-| U7IW      | uap   | UAP-AC-IW             | Access Point AC In Wall      +| U7EDU     | uap   | UAP-AC-EDU             | Access Point AC EDU                
-| U7IWP     | uap   | UAP-AC-IW-Pro         | Access Point AC In Wall Pro  +| U7Ev2     | uap   | UAP-AC                 | Access Point AC                    
-| U7LR      | uap   | UAP-AC-LR             | Access Point AC LR           +| U7HD      | uap   | UAP-AC-HD              | Access Point AC HD                 
-| U7LT      | uap   | UAP-AC-Lite           | Access Point AC Lite         +| U7IW      | uap   | UAP-AC-IW              | Access Point AC In-Wall            
-| U7MP      | uap   | UAP-AC-M-Pro          | Access Point AC Mesh Pro     +| U7IWP     | uap   | UAP-AC-IW-Pro          | Access Point AC In-Wall Pro        
-| U7MSH     | uap   | UAP-AC-M              | Access Point AC Mesh         +| U7LR      | uap   | UAP-AC-LR              | Access Point AC Long-Range         
-| U7NHD     | uap   | UAP-nanoHD            | Access Point nanoHD          +| U7LT      | uap   | UAP-AC-Lite            | Access Point AC Lite               
-| U7O       | uap   | UAP-AC-Outdoor        | Access Point AC Outdoor      +| U7MP      | uap   | UAP-AC-M-Pro           | Access Point AC Mesh Pro           
-| U7P       | uap   | UAP-Pro               | Access Point Pro             +| U7MSH     | uap   | UAP-AC-M               | Access Point AC Mesh               
-| U7PG2     | uap   | UAP-AC-Pro            | Access Point AC Pro          +| U7NHD     | uap   | UAP-nanoHD             | Access Point nanoHD                
-| U7SHD     | uap   | UAP-AC-SHD            | Access Point SHD             +| U7O       | uap   | UAP-AC-Outdoor         | Access Point AC Outdoor            
-| UAE6      | uap   | U6-Extender           | 6 Extender                   +| U7P       | uap   | UAP-AC-Pro             | Access Point AC Pro                
-| UAIW6     | uap   | U6-IW                 | Access Point 6 In Wall       +| U7PG2     | uap   | UAP-AC-Pro             | Access Point AC Pro                
-| UAL6      | uap   | U6-Lite               | Access Point 6 Lite          +| U7SHD     | uap   | UAP-AC-SHD             | Access Point AC SHD                
-| UALR6     | uap   | U6-LR-EA              | Access Point 6 LR            +| UAE6      | uap   | U6-Extender-EA         Access Point WiFi 6 Extender       
-| UALR6v2   | uap   | U6-LR                 | Access Point 6 LR            +| UAIW6     | uap   | U6-IW-EA               | Access Point WiFi 6 In-Wall        
-| UALR6v3   | uap   | U6-LR                 | Access Point 6 LR            +| UAL6      | uap   | U6-Lite                | Access Point WiFi 6 Lite           
-| UAM6      | uap   | U6-Mesh               | Access Point 6 Mesh?         +| UALR6     | uap   | U6-LR-EA               | Access Point WiFi Long-Range     
-| UAP6      | uap   | U6-LR                 | Access Point 6 LR            | +| UALR6v2   | uap   | U6-LR                  | Access Point WiFi Long-Range     
-| UASXG     | uas   | UAS-XG                | Application Server XG        +| UALR6v3   | uap   | U6-LR                  | Access Point WiFi Long-Range     
-| UBB       | ubb   | UBB                   | Building-to-Building Bridge  +| UAM6      | uap   | U6-Mesh-EA             | Access Point WiFi 6 Mesh           
-UCK       uck   | UCK                   Cloud Key                    +| UAP6      | uap   | U6-LR                  | Access Point WiFi 6 Long-Range     | 
-UCKG2     uck   | UCK-G2                | Cloud Key Gen2               +| UAP6MP    | uap   | U6-Pro                 | Access Point WiFi Pro            | 
-UCKP      | uck   | UCK-G2-Plus           | Cloud Key Gen2 Plus          +| UASXG     | uas   | UAS-XG                 | Application Server XG              
-| UCK-v2    | uck   | UCK                   | Cloud Key                    +| UBB       | ubb   | UBB                    | Building-to-Building Bridge        
-| UCK-v3    | uck   | UCK                   | Cloud Key                    +UBBXG     ubb   | UBB-XG                 Building-to-Building Bridge XG     
-| UCMSH     | uap   | UAP-XG-Mesh           | Access Point MeshXG          +UCGMAX    ucg   | UCG-MAX                | Cloud Gateway Max                  
-| UCXG      | uap   | UAP-XG                | Access Point XG              +UCK       | uck   | UCK                    | Cloud Key                          
-| UDC48X6   | usw   | USW-Leaf              | Switch Leaf                  +| UCK-v2    | uck   | UCK                    | Cloud Key                          
-| UDM       | udm   | UDM                   | Dream Machine                +| UCK-v3    | uck   | UCK                    | Cloud Key                          | 
-| UDMB      | uap   | UAP-BeaconHD          | Access Point BeaconHD        +| UCKG2     | uck   | UCK-G2                 | Cloud Key Gen2                     | 
-| UDMPRO    | udm   | UDM-Pro               | Dream Machine Pro            +| UCKP      | uck   | UCK-G2-Plus            | Cloud Key Gen2 Plus                
-UDMSE     | udm   | UDM-SE                | Dream Machine Pro SE         +| UCMSH     | uap   | UAP-XG-Mesh            | Access Point Mesh XG               
-| UFLHD     | uap   | UAP-FlexHD            | Access Point Flex HD         +| UCXG      | uap   | UAP-XG                 | Access Point XG                    
-| UGW3      | ugw   | USG-3P                | Security Gateway 3P          +| UDC48X6   | usw   | USW-Leaf               | Switch Leaf                        
-| UGW4      | ugw   | USG-Pro-4             | Security Gateway 4P          +| UDM       | udm   | UDM                    | Dream Machine                      
-| UGWHD4    | ugw   | USG                   | Security Gateway HD          +| UDMB      | uap   | UAP-BeaconHD           | Access Point BeaconHD              
-| UGWXG     | ugw   | USG-XG-8              | Security Gateway XG 8        +| UDMPRO    | udm   | UDM-Pro                | Dream Machine Pro                  
-| UHDIW     | uap   | UAP-IW-HD             | Access Point In-Wall HD      +UDMPROSE  | udm   | UDM-SE                 | Dream Machine Special Edition      | 
-| ULTE      | uap   | U-LTE                 | LTE                          | +| UDR       | udm   | UDR                    | Dream Router                       | 
-| ULTEPEU   | uap   | U-LTE-Pro             | LTE Pro                      | +| UDW       | udm   | UDW                    | Dream Wall                         | 
-| ULTEPUS   | uap   | U-LTE-Pro             | LTE Pro                      | +| UDWPRO    | udm   | UDWPRO                 | Dream Wall Pro                     
-| UP1       | uap   | USP-Plug              | SmartPower Plug              +| UFLHD     | uap   | UAP-FlexHD             | Access Point FlexHD                
-| UP4       | uph   | UVP-X                 | Phone X                      +| UGW3      | ugw   | USG-3P                 | Security Gateway                   
-| UP5       | uph   | UVP                   | Phone                        +| UGW4      | ugw   | USG-Pro-4              | Security Gateway Pro               
-| UP5c      | uph   | UVP                   | Phone                        +| UGWHD4    | ugw   | USG                    | Security Gateway                   
-| UP5t      | uph   | UVP-Pro               | Phone Pro                    +| UGWXG     | ugw   | USG-XG-8               | Security Gateway XG                
-| UP5tc     | uph   | UVP-Pro               | Phone Pro                    +| UHDIW     | uap   | UAP-IW-HD              | Access Point In-Wall HD            
-| UP6       | uap   | USP-Strip             | SmartPower Strip             +| ULTE      | uap   | U-LTE                  UniFi LTE                          | 
-| UP7       | uph   | UVP-Executive         | Phone Executive              +| ULTEPEU   | uap   | U-LTE-Pro              UniFi LTE Pro                      | 
-| UP7c      | uph   | UVP-Executive         | Phone Executive              +| ULTEPUS   | uap   | U-LTE-Pro              UniFi LTE Pro                      | 
-| US16P150  | usw   | US-16-150W            | Switch 16 PoE (150W        +| UP1       | uap   | USP-Plug               | SmartPower Plug                    
-| US24      | usw   US-24-G1              | Switch 24                    +| UP4       | uph   | UVP-X                  | Phone                              
-| US24P250  | usw   | US-24-250W            | Switch 24 PoE (250W        +| UP5       | uph   | UVP                    | Phone                              
-| US24P500  | usw   | US-24-500W            | Switch 24 PoE (500W        +| UP5c      | uph   | UVP                    | Phone                              
-| US24PL2   | usw   | US-L2-24-PoE          | Switch 24 L2 PoE             +| UP5t      | uph   | UVP-Pro                | Phone Professional                 
-| US24PRO   | usw   | USW-Pro-24-PoE        | Switch Pro 24 PoE            +| UP5tc     | uph   | UVP-Pro                | Phone Professional                 
-| US24PRO2  | usw   | USW-Pro-24            | Switch Pro 24                +| UP6       | uap   | USP-Strip              | SmartPower Strip (6 ports)         
-| US48      | usw   | US-48-G1              | Switch 48                    +| UP7       | uph   | UVP-Executive          | Phone Executive                    
-| US48P500  | usw   | US-48-500W            | Switch 48 PoE (500W        +| UP7c      | uph   | UVP-Executive          | Phone Executive                    
-| US48P750  | usw   | US-48-750W            | Switch 48 PoE (750W        +| US16P150  | usw   | US-16-150W             | Switch 16 PoE (150 W             
-| US48PL2   | usw   | US-L2-48-PoE          | Switch 48 L2 PoE             +| US24      | usw   USW-24-G1              | Switch 24                          
-| US48PRO   | usw   | USW-Pro-48-PoE        | Switch Pro 48 PoE            +| US24P250  | usw   | US-24-250W             | Switch 24 PoE (250 W             
-| US48PRO2  | usw   | USW-Pro-48            | Switch Pro 48                +| US24P500  | usw   | US-24-500W             | Switch 24 PoE (500 W             
-| US624P    | usw   UniFi6 Switch 24      | Switch Enterprise 24 PoE     | +| US24PL2   | usw   | US-L2-24-PoE           | Switch 24 PoE                      
-| US6XG150  | usw   | US-XG-6PoE            | Switch 6XG PoE (150W)        +| US24PRO   | usw   | USW-Pro-24-PoE         | Switch Pro 24 PoE                  
-| US8       | usw   | US-8                  | Switch 8                     +| US24PRO2  | usw   | USW-Pro-24             | Switch Pro 24                      
-| US8P150   | usw   | US-8-150W             | Switch 8 PoE (150W         +| US48      | usw   | US-48-G1               | Switch 48                          
-| US8P60    | usw   | US-8-60W              | Switch 8 PoE (60W          +| US48P500  | usw   | US-48-500W             | Switch 48 PoE (500 W             
-| USC8      | usw   | US-8                  | Switch 8                     +| US48P750  | usw   | US-48-750W             | Switch 48 PoE (750 W             
-| USC8P150  | usw   | US-8-150W             | Switch 8 PoE                 +| US48PL2   | usw   | US-L2-48-PoE           | Switch 48 PoE                      
-| USC8P450  | usw   | USW-Industrial        | Switch Industrial            +| US48PRO   | usw   | USW-Pro-48-PoE         | Switch Pro 48 PoE                  
-| USC8P60   | usw   | US-8-60W              | Switch 8 (60W              +| US48PRO2  | usw   | USW-Pro-48             | Switch Pro 48                      
-| USF5P     | usw   | USW-Flex              | Switch Flex                  +| US624P    | usw   USW-Enterprise-24-PoE  | Switch Enterprise 24 PoE           | 
-| USL16LP   | usw   | USW-Lite-16-PoE       | Switch Lite 16 PoE           +| US648P    | usw   | USW-Enterprise-48-PoE  | Switch Enterprise 48 PoE           | 
-| USL16P    | usw   | USW-16-PoE            | Switch 16 PoE                +| US68P     | usw   | USW-Enterprise-8-PoE   | Switch Enterprise 8 PoE            
-| USL24     | usw   | USW-24-G2             | Switch 24                    +| US6XG150  | usw   | US-XG-6PoE             | Switch 6 XG PoE                    
-| USL24P    | usw   | USW-24-PoE            Swith 24 PoE                 +| US8       | usw   | US-8                   | Switch 8                           
-| USL48     | usw   | USW-48-G2             | Switch 48                    +| US8P150   | usw   | US-8-150W              | Switch 8 PoE (150 W              
-| USL48P    | usw   | USW-48-PoE            | Switch 48 PoE                +| US8P60    | usw   | US-8-60W               | Switch 8 (60 W                   | 
-| USL8A     | usw   | USW-Aggregation       | Switch Aggregation           +| USAGGPRO  | usw   | USW-Pro-Aggregation    | Switch Aggregation Pro             
-| USL8LP    | usw   | USW-Lite-8-PoE        | Switch Lite 8 PoE            +| USC8      | usw   | US-8                   | Switch 8                           
-| USL8MP    | usw   | USW-Mission-Critical  | Switch Mission Critical      +| USC8P150  | usw   | US-8-150W              | Switch 8 PoE (150 W)               
-| USMINI    | usw   | USW-Flex-Mini         USW Flex Mini                +| USC8P450  | usw   | USW-Industrial         | Switch Industrial                  
-| USPPDUP   | usw   | USP-Pro-PDU           | SmartPower Pro PDU           +| USC8P60   | usw   | US-8-60W               | Switch 8 (60 W                   
-| USPRPS    | usw   | USP-RPS               | Redundant Power System       +| USF5P     | usw   | USW-Flex               | Switch Flex                        | 
-| USXG      | usw   | US-16-XG              | Switch 16XG                  +| USFXG     | usw   | USW-Flex-XG            | Switch Flex XG                     
-| UXBSDM    | uap   | UWB-XG-BK             | WiFi BaseStation XG          +| USL16LP   | usw   | USW-Lite-16-PoE        | Switch Lite 16 PoE                 
-| UXGPRO    | uxg   | UXG-Pro               | Next-Generation Gateway Pro  +| USL16P    | usw   | USW-16-PoE             | Switch 16 PoE                      
-| UXSDM     | uap   | UWB-XG                | WiFi BaseStation XG          |+| USL24     | usw   | USW-24-G2              | Switch 24                          
 +| USL24P    | usw   | USW-24-PoE             Switch 24 PoE                      
 +| USL48     | usw   | USW-48-G2              | Switch 48                          
 +| USL48P    | usw   | USW-48-PoE             | Switch 48 PoE                      
 +| USL8A     | usw   | USW-Aggregation        | Switch Aggregation                 
 +| USL8LP    | usw   | USW-Lite-8-PoE         | Switch Lite 8 PoE                  
 +| USL8MP    | usw   | USW-Mission-Critical   | Switch Mission Critical            
 +| USMINI    | usw   | USW-Flex-Mini          Switch Flex Mini                   
 +| USPPDUP   | usw   | USP-PDU-Pro            | SmartPower PDU Pro                 
 +| USPRPS    | usw   | USP-RPS                SmartPower Redundant Power System  
 +| USXG      | usw   | US-16-XG               | Switch XG 16                       | 
 +| USXG24    | usw   | USW-EnterpriseXG-24    | Switch Enterprise XG 24            
 +| UXBSDM    | uap   | UWB-XG-BK              | WiFi BaseStation XG                
 +| UXGPRO    | uxg   | UXG-Pro                | Next-Generation Gateway Pro        
 +| UXSDM     | uap   | UWB-XG                 | WiFi BaseStation XG                | 
 +| p2N       | uap   | PICOM2HP               | PicoStation M2 HP                  |
  
 ^ DPI Category Code ^ Name ^ ^ DPI Category Code ^ Name ^
Line 385: Line 406:
 guest/s/{site}/hotspotpackages guest/s/{site}/hotspotpackages
  ??  ??
 +
 +# Get trafficrules
 +v2/api/site/{site}/trafficrules
 +also possible to add new rule with a POST request.
 +
 +# Edit trafficrules
 +v2/api/site/{site}/trafficrules/{id}/
 +PUT or DELETE request to update or delete traffic rule
 +GET is not allowed on specific trafficrules.
 +With PUT the result code is 201 and not 200 for successful change.
  
  
  • products/software/unifi-controller/api.1675806318.txt.gz
  • Last modified: 2025/05/12 13:37
  • (external edit)