Skip to content
rhoopr edited this page Jun 1, 2026 · 9 revisions

sync

Download photos from iCloud. Running kei without a subcommand does the same thing as kei sync.

Usage

kei config setup
kei sync

# Use a specific config file
kei sync --config /path/to/config.toml

# Preview one run
kei sync --dry-run

# One-run scope
kei sync --recent 100
kei sync --skip-created-before 30d

A minimal config:

[auth]
username = "you@example.com"

[download]
directory = "/photos"

How it works

Assets stream from iCloud's API into the download pipeline. Downloads start as soon as the first page of results arrives. On later runs, stored CloudKit sync tokens detect changes in 1-2 API calls when nothing changed.

Files download concurrently, resume from partial .kei-tmp files via HTTP Range, and go through a cleanup pass that re-fetches expired CDN URLs for failures.

See Download Pipeline, Retry & Resilience, and State Tracking.

Config model

Persistent sync settings live in TOML. Common examples:

Setting TOML
Download directory [download].directory
Albums [filters].albums
Libraries [filters].libraries
Media types [filters].media
Size/resolution [photos].resolution
Live photo handling [photos].live_photo_mode
RAW policy [photos].raw_policy
Watch interval [watch].interval
Report JSON [report].json
HTTP metrics server [server].bind, [server].port
Notification script [notifications].script

Use Configuration for the TOML reference and v0.20 Migration for old flag mappings.

Full enumerations are reported with a bounded full_enumeration_reason when kei can explain why it did not use incremental sync. Common reasons include no stored token, retry or pending rows, metadata backfill, album relation hydration, explicit --retry-failed, and config drift that affects enumeration or paths.

Runtime flags

These flags still belong on the command line because they describe this run:

Flag Description
--config TOML config file path
-p, --password iCloud password for this process. Prefer a safer source when possible
--password-file Read password from a file
--password-command Run a command to get the password
--save-password Persist password to credential store after auth
--dry-run Preview without writing files or state
--only-print-filenames Print planned paths for scripting
--retry-failed Re-sync only previously failed assets
--no-progress-bar Disable progress bar for this run
--recent Limit to N recent assets or a days window like 30d
--recent-scope Choose global or per-filter scope for count-form --recent N
--skip-created-before Skip assets older than a date or interval
--skip-created-after Skip assets newer than a date or interval
--friendly, --no-friendly Force terminal UI mode on or off
--log-level, -v Logging controls

Related

Commands

Getting Started

Features

Clone this wiki locally