UniClipboard
CLI & Headless Service

Command Reference

All unic subcommands, aliases, flags, JSON output, and exit codes.

Edit on GitHub

This page is compiled from the command table in the unic source. Run unic help for brief help, or unic help --json for machine-readable command declarations.

Conventions

  • Command aliases: s = send, r = recv, h = history, -h / --help = help. history list can be written history ls, and history delete can be written history rm. Legacy command names have been removed with no compatibility aliases.
  • uniclip: alias for unic included in release packages, with identical behavior.
  • Service requirement: each command declares one requirement:
RequirementMeaning
localNever connects to the service
serviceReuses a running unicd, or starts one temporarily
service+clipboardSame as above, and requires the clipboard adapter provided by Desktop
offlineRequires no running service for the target data directory
  • --json: commands supporting --json output JSON. On error, if --json is present on the command line, the error is written to stderr as {"error": "...", "reason": "..."}.
  • ref: a history item reference, either an item ID or @N (Nth newest, @1 is the latest).
  • Styled output and progress in a terminal go to stderr; when output is redirected, or NO_COLOR or TERM=dumb is set, plain text is used.

Exit Codes

Exit CodeMeaning
0Completed
1Failed
2Usage error
3Migration partially completed
4Committed but incomplete (send, approval, or wait window did not complete; one-off transfer cancelled or undelivered)
5Command completed, but stopping the temporary unicd failed
6Initialization required (migration_required); run unic init or unic migrate

Currently some general syntax errors and ticket type errors return 1 instead of 2. Do not rely solely on 2 in scripts to detect usage errors.

send

unic send [TEXT...] [--to all|DEVICE] [-f] [--png PATH] [--request-id KEY] [--json]

Requirement: service. Provide content using exactly one of: text arguments, -f followed by files/directories, or --png. Without text arguments, content is read from stdin (up to 64 MiB).

FlagDescription
--to all|DEVICESend to all paired devices, or a specific device by ID or name. Omit for a one-off transfer
-fTreat positional arguments as files or directories (only regular files and directories are accepted)
--png PATHSend a PNG image
--request-id KEYIdempotency key, only used with --to; auto-generated if omitted
--jsonOutput submission and network results

Sending to paired devices (--to): stderr prints request_id=… first so you can query it later with unic dev submission if interrupted. The command only observes the current send and reports success, partial, failed, superseded, timeout, interrupted, or none on completion. Text output is a single line request_id=… history_id=… phase=… sync=… send=…; --json outputs {"submission": {...}, "send": {"outcome": "...", "operation": {...}}}. Exit code is 4 if content was committed but sending did not fully succeed.

One-off transfer (without --to): prints a 6-digit code and link, waiting for a single receiver until delivered, failed, or expired; Ctrl+C cancels. With --json, the first JSON line carries the code and link, and a final status line is printed on completion. Exit code is 4 if undelivered or cancelled. Directories cannot be sent via one-off transfer; --to is required.

recv

unic recv CODE|LINK [--json]
unic recv [list]
unic recv show ID [PART]
unic recv dismiss ID

Requirement: service.

  • recv CODE|LINK: receive from a one-off transfer. Spaces or hyphens are allowed in the 6-digit code. Text content is written to stdout; other content reports name and size to stderr; content is saved to history. --json outputs the receive result. Pairing codes cannot be used with recv.
  • recv / recv list: list recently received items as JSON.
  • recv show ID [PART]: write a part (default 0) of a received item to stdout.
  • recv dismiss ID: remove an item from the received list.

history (h)

Requirement: service; use requires service+clipboard, and action --apply also elevates to service+clipboard. unic history help is local.

SubcommandUsageDescription
list (ls)list [--type text,image,files] [--tag T] [--origin O,...] [-n|--limit N] [--json]Newest first, without content; 20 items by default
showshow [ref] [--part N] [--json]Print content, defaulting to the newest item and first text part; --json outputs item details
sendsend ref [--to DEVICE|all] [--request-id KEY] [--json]Resend source or retained snapshot; --to defaults to all; does not write to local clipboard
useuse ref [--request-id KEY] [--json]Restore to local clipboard; whether it syncs follows sync.on_restore; --json separates local and network results
delete (rm)delete ref... [-y|--yes]Delete items; prompts for confirmation when run in a terminal
tagtag ref [--add a,b] [--remove c] [--set a,b]Add or remove tags; --set replaces all
expireexpire ref DURATION|nevere.g. 24h, 7d, never
exportexport ref --output DIRWrite user-owned copies without overwriting existing files
actionaction ref [KEY] [--apply] [--request-id KEY]Run a plugin Action; omit KEY to list available Actions; --apply writes the result to the clipboard

use and action --apply require the Desktop clipboard adapter and report unavailable in a pure headless environment. See Tags and Actions and Search Syntax.

device

Requirement: service.

SubcommandUsageDescription
addadd [CODE|ADDRESS] [--backend INSTANCE]Without arguments, displays a pairing code and keeps the service running for a limited window; with an argument, initiates pairing and waits for approval
addraddr [--backend INSTANCE]Print this device's address. Addresses are secret; do not share publicly
listlist [--refresh] [--json]List paired and pending devices. Use --refresh to check connections first. JSON includes binding IDs, revisions, and connection state.
approveapprove ID FINGERPRINTApprove after verifying the fingerprint shown on the peer device
rejectreject IDReject a pending device
removeremove IDForget a device and revoke all its paths
backendsbackendsList sync backend instances and their status
pathpath pause|resume|remove BINDING_ID REVISIONManage an individual device–backend path
suggestionssuggestionsDevices suggested by your other devices
suggest-pairsuggest-pair ID BACKENDPair a suggested device
suggest-ignoresuggest-ignore IDIgnore a suggestion
suggest-restoresuggest-restore IDRestore an ignored suggestion
channel-addchannel-add INSTANCE NAMEAuthorize an external backend instance to use a named local channel
channelchannel pause|resume|remove ID REVISIONPause, resume, or remove an external channel

Devices joining via a pairing code always require approval. See Devices and Pairing.

channel

unic channel pair INSTANCE [--resume]

Requirement: service. Pair an external clipboard channel; see External Channels.

status

unic status

Requirement: service. Show local device name and ID, peers, and pending devices.

config

unic config [--json]
unic config set KEY TOML-VALUE
unic config apply FILE
unic config path
  • config: print the active settings (TOML) and file path; if the last edit was invalid, reports the error and shows the last valid settings; lists keys that require restarting unicd. --json outputs full status. Requirement: service.
  • config set: update a single key from the redacted snapshot via PUT /v1/config; value is parsed as TOML, e.g. unic config set sync.directories.automatic true (changing sync.relay.url omits and clears any prior saved sync.relay.access_key).
  • config apply: replace the configuration from a file via PUT /v1/config (omitting sync.relay.access_key on URL change clears the prior key; any access_key line present in the file is saved explicitly). Only direct on-disk config.toml edits reload verbatim (Reload()).
  • config path: print the config file path only, without connecting to the service (local).

See Configuration Reference for keys and defaults.

cloud

unic cloud login [--cloud-url URL] [--no-browser] [--no-relay] [--json]
unic cloud status [--json]
unic cloud logout [--keep-relay] [--json]

Requirement: local (reads and updates cloud-session.json and config.toml directly; --json never prints raw tokens or managed credentials).

  • login: completes browser OAuth 2.0 + PKCE sign-in (--no-browser prints the URL without launching a browser, while unic still runs a local 127.0.0.1 loopback callback that the browser must be able to reach), saves cloud-session.json (0600), and—only when saved TOML sync.relay.url is empty (ignoring unicd's UNIC_RELAY_URL) and --no-relay is omitted—provisions a uc_dc_... device credential and sets sync.relay.enabled = true (without enabling global sync.enabled).
  • status: prints the active Cloud account, whether re-authentication is required, and the managed credential prefix (no secrets).
  • logout: when an active session exists, first attempts best-effort remote credential/session revocation under a 10s request context (10s bounds the remote calls only, not total command duration; Cloud D1 updates only when Cloud processes the request, and downstream UniClipboard/relay uses a configurable positive verify cache defaulting to 60s), then attempts to remove local cloud-session.json and clear the session snapshot even if the remote attempt fails (local lock, read, or delete errors can still fail the command; the snapshot is cleared only after file removal succeeds). After local cleanup succeeds, disables official sync.relay.enabled unless --keep-relay is passed, config.toml has a non-empty sync.relay.url / sync.relay.access_key, or the CLI process has UNIC_RELAY_ACCESS_KEY (--keep-relay only skips the CLI's write—a running unicd evaluates its own host UNIC_RELAY_URL and UNIC_RELAY_ACCESS_KEY independently and may still disable official relay once cloud-session.json is deleted; never deletes sync.relay.access_key or disables self-hosted sync.relay.url).

See Hybrid Relay & Self-Hosting.

plugin

Requirement: local (operates directly on files without the service), except settings subcommands.

unic plugin install URL [--ref REF] [--path DIR] [--build] [--replace] [--enable]
unic plugin instance add IMPLEMENTATION ID
unic plugin list            # alias ls
unic plugin enable ID
unic plugin disable ID
unic plugin uninstall ID
unic plugin rollback ID
unic plugin settings show ID
unic plugin settings save ID JSON-FILE|-
  • install: install from a public GitHub repository and pin to a commit; prefers verified release assets and only builds from source when --build is passed. Install timeout is 5 minutes.
  • instance add: create a disabled-by-default instance with independent settings for an installed Go sync backend.
  • enable / disable: writes to config; takes effect after restarting unicd.
  • uninstall: remove a GitHub installation; rollback: switch back to the previous installed commit.
  • settings show: output Schema and redacted settings; settings save reads {"values": {...}} from a file or stdin (-). Both commands require the service.

See Plugin Marketplace.

init

unic init [--name NAME] [--fresh [--discard-pending]] [--json]

Requirement: offline. Initializes the active profile for first use. In an interactive terminal, if v1 data is detected, prompts to import v1 history or start fresh; non-interactive or --json invocations refuse with source_present.

FlagDescription
--name NAMESet this device's display name in config.toml
--freshStart a fresh empty profile even if v1 data exists
--discard-pendingWith --fresh, abandon an incomplete pending migration (preserves existing data; asks y/N in interactive TTY)
--jsonOutput result as JSON

migrate

unic migrate [--source DIR] [--target DIR] [--service NAME] [--dry-run] [--passphrase-stdin] [--json]
unic migrate --initialize-empty [--target DIR] [--json]

Requirement: offline. Imports in-process without starting networking or clipboard. Runs directly with the default source and target when called without arguments; -h / --help (and unic help migrate) print concise usage guidance.

FlagDescription
--source DIRv1 data directory, defaulting to the local Desktop config; required for custom or portable v1 configs
--target DIRv2 data directory, defaulting to UNIC_HOME or the default directory
--service NAMELegacy credential service name, defaulting to UniClipboard; named profiles use UniClipboard-PROFILE
--dry-runRead and validate content without modifying the target
--passphrase-stdinRead a single line of the legacy passphrase from stdin. Do not pass passphrases in arguments or environment variables
--initialize-emptyExplicitly initialize when there is no v1 data; can only be combined with --target and --json
--jsonOutput JSON progress and final report

Exit codes: 0 completed, 3 partially completed, 1 failed, 2 usage error. Target creation and pending state happen only after unlock succeeds; re-running the same command is idempotent to resume or repair. See Migrate from v1.

dev

Development and diagnostic commands. Running unic watch, unic copy, etc. directly prompts you to use unic dev ….

SubcommandRequirementDescription
dev helplocalPrint usage
dev submission REQUEST_IDserviceQuery a submission (JSON)
dev capabilitiesserviceService capabilities (JSON)
dev watchserviceStream events until stopped
dev logs level [debug|info|warn|error|reset] [--target local|remote] [--for 15m]serviceTemporarily adjust log level; --target defaults to local, --for defaults to 15m; keeps the service running during the window
dev logs export [--output FILE]localExport local retained logs as tar.gz (with SHA-256 manifest) without the service; does not overwrite existing files
dev logs helplocalPrint logs usage
dev diagnostics telemetryserviceEffective state of each telemetry signal (JSON)
dev cache [--json]serviceCache usage
dev copy [TEXT], dev copy -f FILE...service+clipboardWrite to system clipboard
dev pasteservice+clipboardRead from system clipboard

See Diagnostics.

Version

unic --version --json

Does not start the service and requires no initialization. unic daemon does not exist: the background service is the standalone unicd binary.

On this page