Runtime · Clash documentation

External Controller

Enable the RESTful API through external-controller, authenticate with a Bearer Token, and review endpoints for logs, traffic, configuration, nodes, rules, connections, proxy groups, and DNS.

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

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