The External Controller
Introduction
External Controller enables users to control Clash programmatically with the HTTP RESTful API. The third-party Clash GUIs are heavily based on this feature. Enable this feature by specifying an address in external-controller
.
Authentication
- External Controllers Accept
Bearer Tokens
as access authentication method.- Use
Authorization: Bearer <Your Secret>
as your request header in order to pass credentials.
- Use
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 clash version
- Full Path:
- Method:
Configs
/configs
Method:
GET
- Full Path:
GET /configs
- Description: Get base configs
- Full Path:
Method:
PUT
- Full Path:
PUT /configs
- Description: Reloading base configs
- Full Path:
Method:
PATCH
- Full Path:
PATCH /configs
- Description: Update base configs
- Full Path:
Proxies
/proxies
- Method:
GET
- Full Path:
GET /proxies
- Description: Get proxies information
- Full Path:
- Method:
/proxies/:name
Method:
GET
- Full Path:
GET /proxies/:name
- Description: Get specific proxy information
- Full Path:
Method:
PUT
- Full Path:
PUT /proxies/:name
- Description: Select specific proxy
- Full Path:
/proxies/:name/delay
- Method:
GET
- Full Path:
GET /proxies/:name/delay
- Description: Get specific proxy delay test information
- Full Path:
- Method:
Rules
/rules
- Method:
GET
- Full Path:
GET /rules
- Description: Get rules information
- Full Path:
- Method:
Connections
/connections
Method:
GET
- Full Path:
GET /connections
- Description: Get connections 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 specific connection
- Full Path:
- Method:
Providers
/providers/proxies
- Method:
GET
- Full Path:
GET /providers/proxies
- Description: Get all proxies information for all proxy-providers
- Full Path:
- Method:
/providers/proxies/:name
Method:
GET
- Full Path:
GET /providers/proxies/:name
- Description: Get proxies information for specific proxy-provider
- Full Path:
Method:
PUT
- Full Path:
PUT /providers/proxies/:name
- Description: Select specific proxy-provider
- Full Path:
/providers/proxies/:name/healthcheck
- Method:
GET
- Full Path:
GET /providers/proxies/:name/healthcheck
- Description: Get proxies information for specific proxy-provider
- Full Path:
- Method:
DNS Query
/dns/query
Method:
GET
Full Path:
GET /dns/query?name={name}[&type={type}]
Description: Get DNS query data for a specified name and type.
Parameters:
name
(required): The domain name to query.type
(optional): The DNS record type to query (e.g., A, MX, CNAME, etc.). Defaults toA
if not provided.
Example:
GET /dns/query?name=example.com&type=A