Templates
A template determines what exactly the client receives over the subscription link. The panel can serve several formats, and each format has its own template.
Template types
| Type | Format | For whom |
|---|---|---|
XRAY_JSON | JSON | Xray-core clients (Happ, INCY, and others) |
XRAY_BASE64 | base64 string | a universal format for most clients |
MIHOMO | YAML | Mihomo / Clash Meta |
CLASH | YAML | Legacy Clash |
STASH | YAML | Stash |
SINGBOX | JSON | Sing-box |
For each type there is a template named Default. It cannot be renamed or
deleted — it is the fallback point if a custom template is broken.
Xray config
A template of type XRAY_JSON is the skeleton of the client config. A host can
reference its own Xray JSON template (xrayJsonTemplateUuid), while other hosts
use the default template. A routing rule can force its own template and ignore
the host flag ignoreHostXrayJsonTemplate.
{
"log": { "loglevel": "warning" },
"outbounds": [
{ "protocol": "vless", "tag": "proxy" }
]
}
Subscription and client config templates
The MIHOMO, CLASH, and STASH templates are YAML with mandatory markers that
the panel fills with proxies and groups:
proxies: # LEAVE THIS LINE!
proxy-groups:
- name: '→ XLADA'
type: 'select'
proxies: # LEAVE THIS LINE!
rules:
- MATCH,→ XLADA
The # LEAVE THIS LINE! markers must not be removed. SINGBOX and XRAY_JSON
are stored as JSON, while XRAY_BASE64 is the same Xray config encoded in base64.
Substitution variables
Custom texts in the subscription are assembled from variables of the form
{{KEY}}. They work in the host remark (remark), in customRemarks, and in
custom response headers:
Left {{TRAFFIC_LEFT}} of {{TOTAL_TRAFFIC}}, days: {{DAYS_LEFT}}
Subscription: {{SUBSCRIPTION_URL}}
Reset: {{NEXT_TRAFFIC_RESET_AT:format=DD.MM.YYYY}}
| Variable | Value |
|---|---|
USERNAME, EMAIL, TELEGRAM_ID, TAG, DESCRIPTION | user data |
STATUS | status (ACTIVE, LIMITED, …) |
TRAFFIC_USED, TRAFFIC_LEFT, TOTAL_TRAFFIC | traffic in human-readable form |
TRAFFIC_USED_BYTES, TRAFFIC_LEFT_BYTES, TOTAL_TRAFFIC_BYTES, LIFETIME_USED_BYTES | traffic in bytes |
DAYS_LEFT, EXPIRE_UNIX | expiration date |
SUBSCRIPTION_URL, SHORT_UUID, ID | link and identifiers |
RESET_STRATEGY | traffic reset period |
CREATED_AT_UNIX, LAST_TRAFFIC_RESET_AT, NEXT_TRAFFIC_RESET_AT | dates |
SS_HWID_LIMIT | device limit |
STATUS, RESET_STRATEGY, LAST_TRAFFIC_RESET_AT, and NEXT_TRAFFIC_RESET_AT
have arguments — for example, {{STATUS:ACTIVE=All good}} or
{{NEXT_TRAFFIC_RESET_AT:format=DD.MM.YYYY}}. The rwEncodeBase64: prefix at the
start of a value encodes the result in base64.
Variables in headers and customRemarks let you show the remaining traffic right
in the subscription name without opening the panel. This is configured in the
subscription settings section.
An unknown key stays in the text as is. Check the result in the client before rolling the template out to everyone.
What's next
- Routing rules — which template to serve to the client.
- Hosts — binding an Xray JSON template to a host.
- Mihomo template — a ready-made example.
- Clients — which apps support what.