Skip to main content
The topology tools build a complete map of your UniFi network — every device, every client, and every connection between them. You can retrieve the graph as structured data, export it to standard formats for visualization tools, or drill into the connections of a single device. All topology tools are read-only and derive their data by combining the device list and client list from the UniFi Integration API.

get_network_topology

Retrieves the complete network topology graph for a site. The response includes all adopted devices and connected clients as nodes, all uplink and client connections as edges, and summary statistics about the graph.

Parameters

string
required
The site identifier. Use "default" for single-site deployments.
boolean
default:"false"
When true, the tool calculates position coordinates for each node, which can be used to lay out a visual diagram. When false (the default), coordinates are omitted for a smaller response payload.

Response

string
The resolved site identifier used for the query.
string
ISO 8601 timestamp indicating when the topology was captured.
object[]
All devices and clients in the topology.
object[]
All edges in the topology graph.
number
Count of device nodes in the graph.
number
Count of client nodes in the graph.
number
Count of edges in the graph.
number
Maximum uplink depth across all device nodes. Indicates how many switch hops exist between the furthest device and the gateway.

Example response (abbreviated)


export_topology

Exports the network topology in a standard graph format as a formatted string. Use this tool when you want to load your topology into an external visualization or analysis tool.

Parameters

string
required
The site identifier.
string
required
Export format. One of three values:
  • "json" — Full topology as a pretty-printed JSON string. Suitable for programmatic processing or archival.
  • "graphml" — XML-based GraphML format. Import into Gephi or yEd for visual network diagrams.
  • "dot" — Graphviz DOT language format. Render with dot, neato, or other Graphviz tools to produce SVG or PNG diagrams.

Response

Returns the topology data as a plain string in the requested format. The string can be written directly to a file or piped into a visualization tool.

Format comparison

If you pass any value other than "json", "graphml", or "dot", the tool raises ValidationError. The format parameter is case-sensitive.

get_device_connections

Returns only the connection records that involve a specific device, or all connections if no device is specified. Use this tool when you want to understand what a particular switch or access point is connected to without processing the full topology graph.

Parameters

string
required
The site identifier.
string
The device’s unique identifier. When provided, only connections where the device appears as either the source or target are returned. When omitted or null, all connections in the topology are returned.

Response

Returns an array of connection objects in the same format as the connections array in get_network_topology.

get_port_mappings

Returns a port-level view of which devices and clients are connected to each physical port on a specific device. This is particularly useful for auditing switch port usage.

Parameters

string
required
The site identifier.
string
required
The device’s unique identifier. Typically a switch — access points and gateways may have fewer connections to map.

Response

string
The device that was queried.
object
A dictionary keyed by port index number. Each value describes what is connected to that port.

Example response


get_topology_statistics

Returns a lightweight summary of the topology — device count, client count, connection count, and maximum network depth — without transferring the full node and edge data. Use this when you need a quick health check rather than the complete graph.

Parameters

string
required
The site identifier.

Response

string
The site that was queried.
number
Number of adopted devices in the topology.
number
Number of connected clients in the topology.
number
Total number of edges in the topology graph.
number
Maximum uplink depth. A value greater than 2 indicates devices more than two switch hops from the gateway, which may affect latency-sensitive applications.
string
ISO 8601 timestamp of when the underlying topology was captured.

Example response

get_topology_statistics builds a complete topology internally and then discards the node and edge data, returning only the summary. It makes the same number of API calls as get_network_topology, so it is most useful when you only need the summary numbers and want to avoid transmitting large node lists.