Local configuration HTTP API
Desktop only: validate and preview Xray configurations from your own tools.
Enable
Open Xray → Local API and turn on Enable local API. It listens only on 127.0.0.1, port 18587 by default. Use Copy token to give the access token to a trusted tool; Reset token revokes the old one.
Requests
Every request needs Authorization: Bearer <token>.
| Request | Result |
|---|---|
GET /api/v1/info | API, app and core versions and the platform |
POST /api/v1/config/validate | Validates a configuration |
POST /api/v1/config/compile | Previews the runtime configuration Tunnix would generate |
POST bodies are JSON with kind (outbound, routing, advanced-routing or raw) and text, the original JSON as a string.
curl -s http://127.0.0.1:18587/api/v1/info \
-H "Authorization: Bearer $TUNNIX_TOKEN"
Limits
The API does not import, save or select servers and cannot start or stop the VPN. HTTP 200 with status: failed means the request ran but the configuration did not pass.
Never put the token in URLs, command-line history or AI prompts. Anyone with the token can use the API on this computer.