Skip to main content

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​

TypeFormatFor whom
XRAY_JSONJSONXray-core clients (Happ, INCY, and others)
XRAY_BASE64base64 stringa universal format for most clients
MIHOMOYAMLMihomo / Clash Meta
CLASHYAMLLegacy Clash
STASHYAMLStash
SINGBOXJSONSing-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}}
VariableValue
USERNAME, EMAIL, TELEGRAM_ID, TAG, DESCRIPTIONuser data
STATUSstatus (ACTIVE, LIMITED, …)
TRAFFIC_USED, TRAFFIC_LEFT, TOTAL_TRAFFICtraffic in human-readable form
TRAFFIC_USED_BYTES, TRAFFIC_LEFT_BYTES, TOTAL_TRAFFIC_BYTES, LIFETIME_USED_BYTEStraffic in bytes
DAYS_LEFT, EXPIRE_UNIXexpiration date
SUBSCRIPTION_URL, SHORT_UUID, IDlink and identifiers
RESET_STRATEGYtraffic reset period
CREATED_AT_UNIX, LAST_TRAFFIC_RESET_AT, NEXT_TRAFFIC_RESET_ATdates
SS_HWID_LIMITdevice 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.

tip

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.

warning

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​