CLI Reference
What the CLI Does
Section titled “What the CLI Does”The synctv binary can start the service and act as an administrative CLI.
It supports:
- Local operations: load configuration, validate configuration, run database migrations, and start the service.
- Management operations: manage users, rooms, providers, settings, and system state through the management gRPC endpoint.
- Helper operations: generate shell completions and print version information.
General help:
synctv --helpCommand help:
synctv --helpsynctv user --helpsynctv room playback --helpsynctv provider alist --helpSee Administration for operational semantics and Roles, Permissions, and Preferences for room roles, permission bits, room settings, and user preferences.
Global Flags
Section titled “Global Flags”--config <PATH>
Section titled “--config <PATH>”Explicit configuration file:
synctv --config /etc/synctv/synctv.yaml config validateThis has higher precedence than default search paths and SYNCTV_CONFIG_PATH.
--data-dir <PATH>
Section titled “--data-dir <PATH>”Override runtime data directory:
synctv --data-dir /var/lib/synctv serveThis affects management socket, HLS storage, slice cache, file logs, and similar runtime-owned paths. It does not affect *_file secret paths.
--no-dotenv
Section titled “--no-dotenv”Do not load .env:
synctv --no-dotenv config validateUseful for deployment automation, production scripts, and environments controlled entirely through explicit files and environment variables.
-v / --verbose
Section titled “-v / --verbose”Print more detailed configuration loading diagnostics:
synctv -v config validate--endpoint <ENDPOINT>
Section titled “--endpoint <ENDPOINT>”Management endpoint.
Unix socket:
synctv --endpoint unix:///var/lib/synctv/synctv.sock system statsTCP:
synctv --endpoint http://127.0.0.1:50052 system statsEnvironment variable:
SYNCTV_MANAGEMENT_ENDPOINT=http://127.0.0.1:50052--auth-token and --auth-token-file
Section titled “--auth-token and --auth-token-file”TCP management requires a bearer token.
synctv --endpoint http://127.0.0.1:50052 --auth-token "$TOKEN" system statsPrefer file input:
synctv --endpoint http://127.0.0.1:50052 --auth-token-file /run/secrets/management_token system statsEnvironment variables:
SYNCTV_MANAGEMENT_AUTH_TOKEN=...SYNCTV_MANAGEMENT_AUTH_TOKEN_FILE=/run/secrets/management_tokenOutput Formats
Section titled “Output Formats”Remote management commands commonly support:
--output human--output json--output yaml
Example:
synctv user list --output jsonConfiguration output supports:
--output yaml--output json--output toml
synctv config show --output jsonService Commands
Section titled “Service Commands”Start service:
synctv servesynctv serve --config synctv.yamlDry-run startup:
synctv serve --dry-runStop a running service through management:
synctv stopsynctv stop --force--force asks for faster shutdown and reduces drain waiting.
Configuration Commands
Section titled “Configuration Commands”Validate effective configuration:
synctv config validatesynctv --config /etc/synctv/synctv.yaml config validatesynctv --config /etc/synctv/synctv.yaml config validate --strict--strict rejects unsupported config-file keys and unsupported SYNCTV_ environment variables instead of only warning and ignoring them.
Show merged configuration with secrets redacted:
synctv config showsynctv config show --output jsonDatabase Commands
Section titled “Database Commands”Run embedded SQLx migrations without starting the service. Startup runs the same migrations automatically, so this command is mainly for deployment preflight, staging, and troubleshooting:
synctv db migrateCheck database connectivity and migration state:
synctv db statussynctv db status --output yamlUser Management
Section titled “User Management”Common commands:
synctv user listsynctv user get alicesynctv user delete alicesynctv user ban alice --reason "abuse"synctv user unban alicesynctv user set-role alice adminsynctv user require-password-reset alice --reason "support reset"synctv user set-username alice --username alice2synctv user rooms alicePreferences:
synctv user preferences get alicesynctv user preferences set alice --two-factor-enabled trueAdmin role:
synctv user admin grant alicesynctv user admin revoke alicesynctv user admin listBatch operations:
synctv user batch ban alice bob --reason "spam"synctv user batch delete alice bobPrivileged operations follow role hierarchy. A non-root admin cannot modify root or higher-privilege users’ sensitive settings.
Room Management
Section titled “Room Management”Rooms:
synctv room create "Movie Room" --username alicesynctv room listsynctv room get <ROOM_ID>synctv room set-password <ROOM_ID> --password "room-pass"synctv room transfer-owner <ROOM_ID> --username alice bobsynctv room ban <ROOM_ID> --reason "policy"synctv room unban <ROOM_ID>synctv room delete <ROOM_ID>Room settings:
synctv room settings get <ROOM_ID>synctv room settings update <ROOM_ID> --set requireApproval=true --set autoPlay.mode=shufflesynctv room settings update <ROOM_ID> --unset autoPlay.modesynctv room settings reset <ROOM_ID>Members:
synctv room member list <ROOM_ID>synctv room member add <ROOM_ID> alicesynctv room member set-permissions <ROOM_ID> alice --role adminsynctv room member kick <ROOM_ID> alice --kick-cooldown-seconds 300Playback:
synctv room playback get <ROOM_ID>synctv room playback start <ROOM_ID> --media-id <MEDIA_ID>synctv room playback play <ROOM_ID>synctv room playback pause <ROOM_ID>synctv room playback seek <ROOM_ID> --position 60synctv room playback speed <ROOM_ID> --speed 1.25synctv room playback stop <ROOM_ID>Streams:
synctv room stream list <ROOM_ID>Reviews and Bans
Section titled “Reviews and Bans”User registration review:
synctv review user-registration listsynctv review user-registration approve <REVIEW_ID>synctv review user-registration reject <REVIEW_ID> --reason "reason"Room creation review:
synctv review room-creation listsynctv review room-creation approve <REVIEW_ID>synctv review room-creation reject <REVIEW_ID> --reason "reason"Room join review:
synctv review room-join listsynctv review room-join approve <REVIEW_ID>synctv review room-join reject <REVIEW_ID> --reason "reason"Ban records:
synctv ban listPlaylists and Media
Section titled “Playlists and Media”Playlists:
synctv playlist list <ROOM_ID>synctv playlist get <ROOM_ID> <PLAYLIST_ID>synctv playlist create <ROOM_ID> --username alice "Weekend List"synctv playlist update <ROOM_ID> <PLAYLIST_ID> --name "New Title"synctv playlist move <ROOM_ID> <PLAYLIST_ID> --after-playlist-id <OTHER_PLAYLIST_ID>synctv playlist delete <ROOM_ID> <PLAYLIST_ID>Media:
synctv media list <ROOM_ID>synctv media add-url <ROOM_ID> --username alice "https://example.com/video.mp4" --name "Video"synctv media add <ROOM_ID> --username alice --source-provider direct-url --source-config-json '{"medias":[{"url":"https://example.com/video.mp4"}]}' --name "Video"synctv media update <ROOM_ID> <MEDIA_ID> --name "New Name"synctv media move <ROOM_ID> <MEDIA_ID> --after-media-id <OTHER_MEDIA_ID>synctv media delete <ROOM_ID> <MEDIA_ID>Provider-backed media:
synctv playlist provider alist <ROOM_ID> ...synctv playlist provider emby <ROOM_ID> ...synctv media provider alist <ROOM_ID> ...synctv media provider emby <ROOM_ID> ...synctv media provider bilibili video <ROOM_ID> ...synctv media provider bilibili pgc <ROOM_ID> ...synctv media provider bilibili live <ROOM_ID> ...Use --help for exact provider-specific arguments.
Parameter convention: primary command targets, including room IDs and resource URLs, use positional arguments. Filters, optional related IDs, Provider instance bindings, and connection settings use explicit --kebab-case options.
Provider Management
Section titled “Provider Management”Provider instances:
synctv provider-instance availablesynctv provider backends alistsynctv provider-instance listsynctv provider-instance create <NAME> <ENDPOINT> --provider alistsynctv provider-instance update <NAME> --instance-endpoint <ENDPOINT>synctv provider-instance enable <NAME>synctv provider-instance disable <NAME>synctv provider-instance reconnect <NAME>synctv provider-instance delete <NAME>Alist:
synctv provider alist login --username alice --server-endpoint https://alist.example --account-username alice --password 'pass' --instance-name alist-mainsynctv provider alist list --username alice --server-id <SERVER_ID> --path / --instance-name alist-mainsynctv provider alist search --username alice --server-id <SERVER_ID> --parent / --keywords movie --instance-name alist-mainsynctv provider alist me --username alice --server-id <SERVER_ID> --instance-name alist-mainsynctv provider alist binds --username alicesynctv provider alist logout --username alice --server-id <SERVER_ID>Emby:
synctv provider emby login --username alice --server-endpoint https://emby.example --account-username alice --password 'pass' --instance-name emby-mainsynctv provider emby list --username alice --server-id <SERVER_ID> --path / --instance-name emby-mainsynctv provider emby me --username alice --server-id <SERVER_ID> --instance-name emby-mainsynctv provider emby binds --username alicesynctv provider emby logout --username alice --server-id <SERVER_ID>Bilibili:
synctv provider bilibili parse "https://www.bilibili.com/video/..." --username alicesynctv provider bilibili login-qr --username alice --instance-name bilibili-mainsynctv provider bilibili check-qr --username alice --key <KEY> --instance-name bilibili-mainsynctv provider bilibili start-sms-login --username alice --instance-name bilibili-mainsynctv provider bilibili send-sms --username alice --phone 13800000000 --session-token <SESSION_TOKEN> --validate <VALIDATE>synctv provider bilibili login-sms --username alice --session-token <UPDATED_SESSION_TOKEN> --code 123456synctv provider bilibili me --username alice --instance-name bilibili-mainsynctv provider bilibili binds --username alicesynctv provider bilibili logout --username aliceRTMP:
synctv provider rtmp create-publish-key --room-id <ROOM_ID> <MEDIA_ID> --username alicesynctv provider rtmp get-stream-info --room-id <ROOM_ID> <MEDIA_ID>Provider service operations:
synctv provider acfun resolve <RESOURCE> --username alicesynctv provider cctv resolve <RESOURCE> --username alicesynctv provider douyu resolve <RESOURCE> --username alicesynctv provider huya resolve <RESOURCE> --username alicesynctv provider youtube resolve <RESOURCE> --username alicesynctv provider youtube unbind --server-id <SERVER_ID> --username alicesynctv provider cloudreve login --username alice --server-endpoint https://cloudreve.example --account-email [email protected] --password <PASSWORD>synctv provider fnos login --username alice --server-endpoint https://fnos.example --account-username nas-alice --password <PASSWORD>synctv provider nextcloud login --username alice --server-endpoint https://nextcloud.example --account-username cloud-alice --app-password <APP_PASSWORD>synctv provider qnap login --username alice --server-endpoint https://qnap.example --account-username nas-alice --password <PASSWORD>synctv provider seafile login --username alice --server-endpoint https://seafile.example --account-username files-alice --password <PASSWORD>synctv provider synology login --username alice --server-endpoint https://synology.example --account-username nas-alice --password <PASSWORD>synctv provider cloudreve me --server-id <SERVER_ID> --username alicesynctv provider cloudreve logout --server-id <SERVER_ID> --username alicesynctv provider nextcloud logout --server-id <SERVER_ID> --username alicesynctv provider qnap capabilities --server-id <SERVER_ID> --username alicesynctv provider seafile logout --server-id <SERVER_ID> --username alicesynctv provider synology logout --server-id <SERVER_ID> --username alicesynctv provider truenas logout --server-id <SERVER_ID> --username alicesynctv provider cloudreve list --username alice --server-id <SERVER_ID> --path /synctv provider synology movies --username alice --server-id <SERVER_ID> --library-id 1--username, --user-id, and --email select the SyncTV actor. Login commands use --server-endpoint for the provider account server and --account-username or --account-email for provider account identity.
Runtime Settings
Section titled “Runtime Settings”Runtime settings are changed through the management endpoint. They are not the same as YAML startup configuration.
synctv settings listsynctv settings get emailsynctv settings update --set email.whitelistEnabled=true --set 'email.whitelistDomains=["example.com"]'synctv settings update --unset email.smtpProxysynctv settings export --file runtime-settings.jsonsynctv settings import runtime-settings.json --dry-runsynctv settings import runtime-settings.json--set PATH=VALUE and --unset PATH are repeatable, and the CLI builds the FieldMask. --request-json accepts the standard UpdateSettingsRequest ProtoJSON shape and is mutually exclusive with set/unset mode.
settings export produces a complete, versioned JSON snapshot with formatVersion. The snapshot contains OAuth client secrets, SMTP passwords, and proxy passwords. File output is atomic, uses mode 0600 on Unix, and requires --force to replace an existing file. Omitting --file writes the snapshot to stdout.
settings import reads a snapshot from a file; use - for stdin. The server validates the format version, complete credentials, and every runtime business rule before replacing all runtime settings in one transaction. --dry-run reports the planned changed sections while preserving the stored values.
Export and import require root authorization. The management CLI uses its local root actor identity and still requires a valid management token.
See Runtime Settings Reference for all keys, defaults, and validation rules.
SMTP host, port, credentials, SOCKS5 proxy, and sender identity are managed through the email runtime settings. settings test-email uses the current hot-reloaded configuration. Regular settings reads redact SMTP and proxy passwords; export snapshots retain complete credentials for restoration.
Security note: do not expose the management TCP endpoint publicly. Use strong tokens and prefer internal networks or VPNs.
System and Slice Cache
Section titled “System and Slice Cache”System state:
synctv system statssynctv system stream listsynctv system stream kick <STREAM_ID>Slice cache operations:
synctv slice-cache statssynctv slice-cache evict-expiredsynctv slice-cache purgeSlice cache enablement is controlled by startup config proxy_slice_cache.enabled. CLI operations only provide stats, cleanup, and expiration eviction.
Shell Completions
Section titled “Shell Completions”synctv completion bash > synctv.bashsynctv completion zsh > _synctvsynctv completion fish > synctv.fishInstallation paths depend on the shell and OS distribution.
Version
Section titled “Version”synctv version