Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

import

Import a subscription URL, file, or raw text into the database.

xrat import <input> [--name <name>]

Arguments

ArgumentDescription
inputSubscription source: a URL, local file path, or raw subscription text

Options

OptionDescription
-n, --name <name>Name for the imported subscription source

Input Formats

xrat automatically detects the input format:

FormatDetection
Subscription URLStarts with http:// or https://
Local filePath to an existing file on disk
Single share linkSingle line starting with a supported protocol scheme
Base64 subscriptionMulti-line or single-line base64-encoded text
Plain link listMultiple lines, each a valid share link
SIP008 JSONJSON with "servers" array
Xray JSONJSON with "version" or "inbounds" fields

Examples

Import from a subscription URL:

xrat import https://example.com/sub.txt

Import and name a subscription:

xrat import https://example.com/sub.txt --name "Work VPN"

Import from a local file:

xrat import ./nodes.txt

Import raw base64 subscription text:

xrat import "dmxlc3M6Ly91dWlkQGV4YW1wbGUuY29tOjQ0Mw=="

Import a single share link:

xrat import "vless://uuid@example.com:443?type=ws&security=tls#MyNode"

Behavior

  1. Reads input from the specified source
  2. Detects format automatically
  3. Parses and normalizes each node
  4. Deduplicates against existing configs using a versioned key
  5. Persists new configs to the database
  6. Creates or updates the subscription source record and applies --name when provided
  7. Reconciles the source: configs attached to the same subscription that are absent from this payload are soft-deleted (recoverable). A later import that brings them back restores them. An empty payload removes nothing.
  8. Prints an import summary, including the count of removed configs
  • add — add a single config URI without subscription tracking
  • list configs — view imported configs

add

Add a single config URI directly to the database.

xrat add <input>

Arguments

ArgumentDescription
inputConfig URI: vless://..., vmess://..., ss://..., trojan://..., hysteria2://..., etc.

Examples

xrat add "vless://uuid-123@example.com:443?type=ws&security=tls&sni=cdn.example.com#Node"
xrat add "ss://YWVzLTI1Ni1nY206c2VjcmV0@example.com:8388#SS%20Node"

Behavior

Unlike import, add does not create a subscription source record. It parses the single URI, normalizes it, deduplicates, and persists directly.

For the full config-management command set, see config management.