List Sites
GET
/v1/sites

Description

Retrieves a list of all sites (from hosts running the UniFi Network application) associated with the UI account making the API call.

Note: The structure of the meta and statistics fields may vary depending on the UniFi Network version. The example provided is based on UniFi OS 4.1.13.

Parameters

pageSize
string
Optional
query
Number of items to return per page
nextToken
string
Optional
query
Token for pagination to retrieve the next set of results
Example
curl -X GET 'https://api.ui.com/v1/sites?pageSize=10&nextToken=602232A870250000000006C514FF00000000073DD8DB000000006369FDA2:1467082514' \
  -H 'Accept: application/json' \
  -H 'X-API-Key: API_KEY'

Responses

200
ok
code
Error code from upstream
data
array
Generic response data, specific schema depends on the endpoint
siteId
string
Unique identifier of the site
hostId
string
Unique identifier of the host device managing this site
meta
Site metadata including name, description, timezone, and gateway MAC address. Structure may vary depending on the UniFi Network version
statistics
Site statistics including device counts, client counts, and network performance metrics. Structure may vary depending on the UniFi Network version
permission
string
Permission level of the current user for this site (admin, readonly, etc.)
isOwner
boolean
Indicates if the current user is the owner of this site
httpStatusCode
integer
HTTP status code
traceId
string
Request trace identifier
nextToken
string
Pagination token for fetching the next set of results
Example Response
{
  "data": [
    {
      "siteId": "661de833b6b2463f0c20b319",
      "hostId": "900A6F00301100000000074A6BA90000000007A3387E0000000063EC9853:123456789",
      "meta": {
        "desc": "Default",
        "gatewayMac": "70:a7:41:97:83:ed",
        "name": "default",
        "timezone": "Asia/Taipei"
      },
      "statistics": {
        "counts": {
          "criticalNotification": 0,
          "gatewayDevice": 1,
          "guestClient": 0,
          "lanConfiguration": 1,
          "offlineDevice": 0,
          "offlineGatewayDevice": 0,
          "offlineWifiDevice": 0,
          "offlineWiredDevice": 0,
          "pendingUpdateDevice": 0,
          "totalDevice": 1,
          "wanConfiguration": 2,
          "wifiClient": 0,
          "wifiConfiguration": 0,
          "wifiDevice": 0,
          "wiredClient": 0,
          "wiredDevice": 0
        },
        "gateway": {
          "hardwareId": "e5bf13cd-98a7-5a96-9463-0d65d78cd3a4",
          "inspectionState": "off",
          "ipsMode": "disabled",
          "ipsSignature": {
            "rulesCount": 53031,
            "type": "ET"
          },
          "shortname": "UDMPRO"
        },
        "internetIssues": [],
        "ispInfo": {
          "name": "Chunghwa Telecom",
          "organization": "Data Communication Business Group"
        },
        "percentages": {
          "wanUptime": 100
        }
      },
      "permission": "admin",
      "isOwner": true
    }
  ],
  "httpStatusCode": 200,
  "traceId": "a7dc15e0eb4527142d7823515b15f87d",
  "nextToken": "ba8e384e-3308-4236-b344-7357657351ca"
}

Responses

401
unauthorized
code
Error code from upstream
httpStatusCode
integer
HTTP status code
message
string
Error message
traceId
string
Request trace identifier
Example Response
{
  "code": "unauthorized",
  "httpStatusCode": 401,
  "message": "unauthorized",
  "traceId": "a7dc15e0eb4527142d7823515b15f87d"
}

Responses

429
rate limit
code
Error code from upstream
httpStatusCode
integer
HTTP status code
message
string
Error message
traceId
string
Request trace identifier

Headers

Retry-After
string
example: 5
Example Response
{
  "code": "rate_limit",
  "httpStatusCode": 429,
  "message": "rate limit exceeded, retry after 5.372786998s",
  "traceId": "a7dc15e0eb4527142d7823515b15f87d"
}

Responses

500
failed to list sites
code
Error code from upstream
httpStatusCode
integer
HTTP status code
message
string
Error message
traceId
string
Request trace identifier
Example Response
{
  "code": "server_error",
  "httpStatusCode": 500,
  "message": "failed to list sites",
  "traceId": "a7dc15e0eb4527142d7823515b15f87d"
}

Responses

502
bad gateway
code
Error code from upstream
httpStatusCode
integer
HTTP status code
message
string
Error message
traceId
string
Request trace identifier
Example Response
{
  "code": "bad_gateway",
  "httpStatusCode": 502,
  "message": "bad gateway",
  "traceId": "a7dc15e0eb4527142d7823515b15f87d"
}