RU

Custom server or bot

When your own code serves the subscription: SoloBot, Python, PHP, nginx.

1. Detecting nya

The User-Agent is nya/2.8.5/Android/722837263881; it always starts with lowercase nya/.

CheckWorks?
"NYA" in user_agentNo — case mismatch
user_agent.lower().startswith("nya/")Yes — recommended

2. Python example

Python
import base64

def b64(text: str) -> str:
    return "base64:" + base64.b64encode(text.encode("utf-8")).decode()

def subscription_headers(user_agent, project_name, subscription_info, subscription_userinfo, routing):
    ua = (user_agent or "").lower()
    if ua.startswith("nya/"):
        return {
            "Content-Type": "text/plain; charset=utf-8",
            "profile-update-interval": "3",
            "profile-title": b64(f"{project_name}\n{subscription_info}"),  # line 2 = announcement
            "announce-url": f"https://t.me/{USERNAME_BOT}",
            "support-url": SUPPORT_CHAT_URL,
            "renew-url": f"https://t.me/{USERNAME_BOT}?start=renew",
            "subscription-userinfo": subscription_userinfo,
            "routing": routing,  # happ://routing/onadd/<base64>
        }

3. Headers and details

HeaderFormatHow nya uses it
profile-titletext or base64:…First line = title; further lines become the announcement when announce is absent
subscription-userinfoupload=0; download=123; total=456; expire=1798761600Integers; expire in Unix seconds; total=0 unlimited, expire=0 no expiry
profile-update-intervalinteger hoursAuto-update, default 12
announcetext or base64:…Announcement above servers
announce-urlhttps:// or tg://Makes the announcement a link; without text nya shows “Service news and announcements”
support-url, renew-url, profile-web-page-urlURLSupport, Renew, website buttons
routinghapp://routing/onadd/<base64>Prefix doesn't matter; standard or URL-safe Base64
hide-settings0/1Server settings hidden by default; 0 shows them
Non-ASCII text and emoji only in Base64: headers travel as Latin-1.

4. Status codes

404 — “Subscription not found”; 502 — “Subscription server is not responding”; other errors — “temporarily unavailable (code N)”, cached servers keep working.

5. Check

Terminal
curl -sS -D - -o body.txt \
  -A "nya/2.8.5/Android/722837263881" \
  -H "x-hwid: 0123456789abcdef0123456789abcdef" \
  -H "x-device-os: Android" -H "x-ver-os: 14" -H "x-device-model: Pixel 8" \
  https://sub.example.com/sub/abc123