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 Tokensfor access authentication.- Pass credentials in the
Authorization: Bearer <Your Secret>request header.
- Pass credentials in the
RESTful API documentation
Logs
/logs- Method:
GET- Full path:
GET /logs - Description: Get real-time logs
- Full path:
- Method:
Traffic
/traffic- Method:
GET- Full path:
GET /traffic - Description: Get real-time traffic data
- Full path:
- Method:
Version
/version- Method:
GET- Full path:
GET /version - Description: Get the Clash version
- Full path:
- Method:
Configuration
/configsMethod:
GET- Full path:
GET /configs - Description: Get the base configuration
- Full path:
Method:
PUT- Full path:
PUT /configs - Description: Reload the configuration file
- Full path:
Method:
PATCH- Full path:
PATCH /configs - Description: Update the configuration incrementally
- Full path:
Nodes
/proxies- Method:
GET- Full path:
GET /proxies - Description: Get information for all nodes
- Full path:
- Method:
/proxies/:nameMethod:
GET- Full path:
GET /proxies/:name - Description: Get information for a specified node
- Full path:
Method:
PUT- Full path:
PUT /proxies/:name - Description: Change the selected node in a Selector
- Full path:
/proxies/:name/delay- Method:
GET- Full path:
GET /proxies/:name/delay - Description: Get latency-test information for a specified node
- Full path:
- Method:
Rules
/rules- Method:
GET- Full path:
GET /rules - Description: Get rule information
- Full path:
- Method:
Connections
/connectionsMethod:
GET- Full path:
GET /connections - Description: Get connection information
- Full path:
Method:
DELETE- Full path:
DELETE /connections - Description: Close all connections
- Full path:
/connections/:id- Method:
DELETE- Full path:
DELETE /connections/:id - Description: Close a specified connection
- Full path:
- Method:
Proxy providers
/providers/proxies- Method:
GET- Full path:
GET /providers/proxies - Description: Get proxy information for all providers
- Full path:
- Method:
/providers/proxies/:nameMethod:
GET- Full path:
GET /providers/proxies/:name - Description: Get proxy information for a specified provider
- Full path:
Method:
PUT- Full path:
PUT /providers/proxies/:name - Description: Update a specified provider
- Full path:
/providers/proxies/:name/healthcheck- Method:
GET- Full path:
GET /providers/proxies/:name/healthcheck - Description: Get proxy information for a specified provider
- Full path:
- Method:
DNS queries
/dns/queryMethod:
GETFull 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 querytype(optional): the DNS record type to query (for example, A, MX, or CNAME). If omitted, it defaults toA.
Example:
GET /dns/query?name=example.com&type=A
