Runtime · Clash documentation

External Controller

To control Clash from a Dashboard or script, configure external-controller and Bearer Token authentication. Use the RESTful API to read logs, traffic, and configuration, and manage nodes and connections.

  • external-controller
  • RESTful API
  • Bearer Tokens
  • /proxies
  • DNS queries
Runtime
On this page

Scope of this historical document

This document preserves historical instructions for original Clash / Clash Premium to help interpret older configurations. References to “Premium only”, unsupported features, or platform limits do not describe current Mihomo capabilities. Do not use them to overwrite your current client configuration or run permission-related commands.

For Mihomo, consult current Mihomo configuration documentation. For the graphical interface, installation, and permissions, follow the documentation for your specific client.

Introduction

External control lets users manage Clash through an HTTP RESTful API and is the foundation for third-party Clash GUIs. Enable it by specifying an address in external-controller.

Authentication

  • The external controller accepts Bearer Tokens for access authentication.
    • Pass credentials in the Authorization: Bearer <Your Secret> request header.

RESTful API documentation

Logs

  • /logs
    • Method: GET
      • Full path: GET /logs
      • Description: Get real-time logs

Traffic

  • /traffic
    • Method: GET
      • Full path: GET /traffic
      • Description: Get real-time traffic data

Version

  • /version
    • Method: GET
      • Full path: GET /version
      • Description: Get the Clash version

Configuration

  • /configs
    • Method: GET

      • Full path: GET /configs
      • Description: Get the base configuration
    • Method: PUT

      • Full path: PUT /configs
      • Description: Reload the configuration file
    • Method: PATCH

      • Full path: PATCH /configs
      • Description: Update the configuration incrementally

Nodes

  • /proxies

    • Method: GET
      • Full path: GET /proxies
      • Description: Get information for all nodes
  • /proxies/:name

    • Method: GET

      • Full path: GET /proxies/:name
      • Description: Get information for a specified node
    • Method: PUT

      • Full path: PUT /proxies/:name
      • Description: Change the selected node in a Selector
  • /proxies/:name/delay

    • Method: GET
      • Full path: GET /proxies/:name/delay
      • Description: Get latency-test information for a specified node

Rules

  • /rules
    • Method: GET
      • Full path: GET /rules
      • Description: Get rule information

Connections

  • /connections

    • Method: GET

      • Full path: GET /connections
      • Description: Get connection information
    • Method: DELETE

      • Full path: DELETE /connections
      • Description: Close all connections
  • /connections/:id

    • Method: DELETE
      • Full path: DELETE /connections/:id
      • Description: Close a specified connection

Proxy providers

  • /providers/proxies

    • Method: GET
      • Full path: GET /providers/proxies
      • Description: Get proxy information for all providers
  • /providers/proxies/:name

    • Method: GET

      • Full path: GET /providers/proxies/:name
      • Description: Get proxy information for a specified provider
    • Method: PUT

      • Full path: PUT /providers/proxies/:name
      • Description: Update a specified provider
  • /providers/proxies/:name/healthcheck

    • Method: GET
      • Full path: GET /providers/proxies/:name/healthcheck
      • Description: Get proxy information for a specified provider

DNS queries

  • /dns/query
    • Method: GET

    • Full path: GET /dns/query?name={name}[&type={type}]

    • Description: Get DNS query data for a specified domain name and type

    • Parameters:

      • name (required): the domain name to query
      • type (optional): the DNS record type to query (for example, A, MX, or CNAME). If omitted, it defaults to A.
    • Example: GET /dns/query?name=example.com&type=A