API reference: the peer protocol
Chapter 10 of 14 · Contents
The peer protocol is how Space Backup devices of one company talk to each other directly: computers back up to each other's drives, copy backups between themselves, serve albums, and let phones browse and read their backups. This chapter describes every request a computer serves, the byte layout of the connection, the capabilities and their versions, and the local contract between the apps and the Photos viewer.
This is a reference for integrators: people writing a client (the iPhone app is one), a test tool, or a monitor. Nothing here is needed to use Space Backup. Field names, sizes and error texts are exact; when a value is a default, the chapter says so.
Overview#
Every Space Backup computer (Windows, macOS and Linux alike) runs a peer server. Other devices of the same company connect to it to:
- back up into its destinations (drives),
- read back what is stored there (browse, view, restore),
- ask it to copy a backup on to other computers (replication, rearranging),
- create, fill, read and change albums kept on its drives,
- measure its Google Drive download speed.
| Who | Connects to others | Accepts connections | Notes |
|---|---|---|---|
| Windows PC (tray app) | yes | yes, TCP port 47800 | the shared engine |
| Mac (menu-bar app) | yes | yes, TCP port 47800 | the Mac runs the Linux daemon |
| Linux PC (daemon) | yes | yes, TCP port 47800 | the shared engine |
| iPhone / iPad | yes | never | "outgoing only": no peer server, no destinations |
| A guest's device (another company) | only the guest channel, to the album's PCs | never | see The guest channel |
All computers serve the same requests because they share one engine: a request that works against a Linux PC works against a Windows PC or a Mac.
Ports#
| Port | Protocol | Use |
|---|---|---|
| 47800 | TCP | The peer server. Default; change it with the CLI settings key port (restart to apply). |
| 47801 | UDP | LAN discovery: announcements (multicast group 239.255.47.80 and broadcast). |
The firewall rules the apps create cover both ports (see Firewall and ports).
LAN discovery#
Every computer sends an announcement about every 30 seconds, and at once when its destinations change or when it sees a peer that is new or restarted:
- to the multicast group
239.255.47.80:47801on every IPv4 interface (TTL 1), and as a broadcast on each interface's broadcast address and on255.255.255.255; - sealed with the company key, so only devices of the same company can read it; packets that do not open with this PC's key are ignored.
Sealed packet layout:
| Bytes | Content |
|---|---|
| 4 | ASCII SBA1 |
| 12 | random nonce |
| n | AES-256-GCM ciphertext of the announcement JSON (key: the company key's announce key; additional data: SBA1) |
| 16 | GCM tag |
The announcement JSON (property names are PascalCase here, unlike the requests):
{
"Inst": "5f0c2a9e8b7d4c31a6e2f90d14b7c3a8",
"Name": "OFFICE-NAS",
"Port": 47800,
"Boot": "a41c09e27f3b",
"Ver": "0.12.3",
"Dests": [
{"Id": "3F9A1C07B2E4", "Path": "/mnt/backup1", "Root": "/mnt/backup1/SpaceBackup", "Free": 1873415372800,
"Online": true, "Disk": "WD-WX12A3456789", "Speed": 182.4, "Kind": "external", "Keep": 10,
"Lan": "\\\\OFFICE-NAS\\SpaceBackup", "full": false, "freeBytes": 1873415372800, "totalBytes": 4000787030016,
"fullSince": null}
],
"Gd": null
}
| Field | Meaning |
|---|---|
Inst | The install's instance id: stable, unique per install. Peers are told apart by it, not by name. |
Name | The machine name: the folder its backups go into on every destination. |
Port | Its peer server's TCP port. 0: not listening (a phone, or a PC whose port is taken). |
Boot | Random per process start. A peer seeing a new value answers at once, so a restarted PC finds its peers within seconds. |
Ver | App version (since v0.7.0). Phones send ios-<version>. A PC whose peer announces a newer plain x.y.z checks for an update at once. |
Dests[] | Its destinations: Id (destination id), Path (as on that PC), Root (its effective backup root, shown verbatim; absent from older versions), Free (bytes), Online, Disk (physical disk id, since v0.5.9), Speed (measured write speed in MB/s, 0 = not measured), Kind (internal, external or network; absent when not detected), Keep (that PC's max number of backups, which it also keeps over other machines' dates on its drives, see replication.md "The PC's keep count"; absent from older versions), Lan (its backup root as another computer on the LAN opens it, \\PC\Share[\folder]: the SMB share holding it or what the user set, see lan-path.md; absent or null when not shared and from older versions; a phone joins it with \<device>\<date>\<file>), Forms (the form of each phone's backups on it: device name → encrypted, plain or mixed, see forms; absent from older versions and before the first scan), and (0.16.10, camelCase like everywhere else these four appear) full (nearly full: free below max(5 %, 20 GB), until above max(8 %, 30 GB); nothing new is written there, see nearly-full.md), freeBytes, totalBytes (the drive's size), fullSince (when it became nearly full, ISO time UTC; null while it is not); absent from older versions and before the drive was first measured. |
Gd | Google Drive records (which PC backs up which Google account). Older peers ignore it. |
A peer not heard from for 100 seconds is offline. A peer seen on the LAN is always reached on the LAN.
Reaching a PC at another site#
Computers at different sites meet through Space Relay (see Space Relay and its relay protocol). The relay passes each PC's sealed announcement on unread, so destinations and free space are known before any connection. To connect to a peer, a device tries, in order:
- LAN: the peer is seen on the LAN → its LAN address.
- Same site: the relay reports the same public IP, or one of the peer's LAN addresses is on one of this device's own IPv4 networks (address and mask of its interfaces) → those LAN addresses (1.5 s timeout each).
- Relayed: a pipe through the relay (
relay-connect, then both endsattach).
A route that answered as the wrong PC is avoided for 10 minutes; the last route that worked is tried first when it is a LAN address (the relay never goes first). A peer is never dialled at its public address. A change of the device's networks forgets the remembered routes and closes the idle reading connections. Whatever the route, the same handshake and encrypted frames run end to end inside it: the relay cannot read or change anything.
Devices that only connect out (Port 0 and no destinations, or a version starting ios-) are never connected to.
Destination ids#
A destination is named on the wire by its destination id: the first 12 hex digits (upper case) of SHA-256 of the UTF-8 string MACHINE|path, where MACHINE is the PC's machine name in upper case and path the destination path in lower case. Example: 3F9A1C07B2E4. These are the ids peers announce in Dests[].Id; they are not the machine:path ids that dest list prints.
Conventions used by every request#
| Item | Rule |
|---|---|
dest | A destination id of the PC you are talking to. |
cf | "Computer name first": the sender's layout setting. true (default): <root>/; false: <root>/. Send the same value you back up with. |
<root> | The destination's backup root: the destination itself when its folder is named SpaceBackup (any case), else its SpaceBackup subfolder. |
date | A date folder name, yyyy-MM-dd. Anything else is refused ("Invalid date folder"). |
rel | A path inside the date folder. / or \ are accepted; answers use \ on every platform. Refused: absolute paths, drive letters, ., .., empty components, :, invalid characters, reserved device names, components ending in a dot or space, more than 4,000 characters, anything that leaves the folder. |
| Machine names | 1–64 characters, ASCII letters, digits, -, _ and .; starting with a letter or digit, not ending with ., no .., not a reserved name. |
mtime | File modification time in .NET ticks, UTC (100-ns intervals since 0001-01-01). Example: 639278252430000000 is 2026-10-17 09:14:03 UTC. |
hash | XxHash128 of the file content, 32 hex digits. |
| Times in text | ISO 8601 UTC, e.g. 2026-10-17T10:00:00Z. |
| Drive names in messages | As dest list shows them, PC and drive: CHIA2 G:, OFFICE-NAS /mnt/backup1; never an id. A drive known nowhere: an unknown drive of CHIA2. |
A peer can only ever touch its own folder (<root>/) for writing. Reading another machine's folder needs a grant; albums need an album ticket.
Connection and authentication#
Membership: the company key#
All devices of a company hold the company key (handed over end to end when a device joins; see The company key). The company key is membership and transport only: it opens the channel, it decrypts no backup. From the key's passphrase the apps derive:
master= PBKDF2-SHA256(passphrase with surrounding spaces trimmed, salt UTF-8SpaceBackup company key v1, 200,000 iterations, 32 bytes);- per purpose, HKDF-Expand(SHA-256,
master, 32 bytes, info = the purpose's name):auth(handshake MACs),session(channel keys),announce(LAN announcements),relay(the relay group).
A PC without a company key accepts no peer connections (they are closed at once).
The company channel handshake#
The client proves first. The four handshake messages are plain frames (4-byte big-endian length, then UTF-8 JSON, at most 4,096 bytes):
- Client → server:
{"v":1, "name":<client machine name>, "inst":<client instance id>, "nonce":<32 random bytes, base64>} - Server → client:
{"v":1, "name":<server machine name>, "inst":<server instance id>, "nonce":<32 random bytes, base64>}, or{"error":"…"}and the connection ends. - Client → server:
{"mac": base64(HMAC-SHA256(authKey, "client\ n" ‖ T))} - Server → client:
{"mac": base64(HMAC-, orSHA256(authKey, "server\ n" ‖ T))} {"error":"company key does not match"}and the end.
T, the transcript, is the concatenation of length-prefixed fields (each: 4-byte big-endian length, then the bytes):
L("SpaceBackup v1") | L(nc) | L(ns) | L(clientName) | L(clientInst) | L(serverName) | L(serverInst)
with nc/ns the client's and server's raw 32-byte nonces and the names and instance ids in UTF-8. Both sides compare MACs in constant time. Only a holder of the same company key can produce either MAC, so each side knows the other is in the company, and the names and nonces cannot be swapped.
Refusals the server sends in step 2:
error | Why |
|---|---|
invalid machine name | The client's name breaks the machine name rule. |
<NAME> is this PC's own name | A client may not use the server's own name. |
this PC serves no guests | A guest hello reached a PC that has no album host. |
A hello whose v is not 1, or whose nonce is not 32 bytes, closes the connection without an answer ("Unsupported protocol version", "Bad nonce" in the log).
Session keys and encryption#
After step 4 both sides switch to encrypted frames. With salt = nc ‖ ns:
- client-to-server key = HKDF-SHA256(ikm = sessionKey, salt, info =
c2s, 32 bytes) - server-to-client key = HKDF-SHA256(ikm = sessionKey, salt, info =
s2c, 32 bytes)
Each direction is AES-256-GCM with its own frame counter as nonce (see Frame format), so frames cannot be read, altered, replayed, dropped or reordered without the connection failing.
Who the peer is#
After the handshake, the server knows the client's machine name (name) and instance id (inst); the client checks it reached the instance it meant (the instance in the peer's announcement) and drops the connection otherwise ("… is not the expected peer").
Every request is served as that machine: a peer writes only its own folder, a replicate is accepted only from the machine its grant names, a read ticket only from the device it was given to.
The company key proves membership, but every company device holds it. So for anything beyond a device's own backups the server asks for more proof:
| Proof | Issued by | Used for | Checked how |
|---|---|---|---|
Read ticket (grant) | Account service, POST / | Reading another machine's backups (a share or an approved restore) | The PC asks POST / |
Album ticket (ticket in every album.*) | Account service, POST / (1 h) or a relay ticket (30 days) | Every album request | The PC asks POST / |
Replication / rearrange grant (grant) | The source device itself, signed with its registered device key | replicate, rearrange, replica.* | ECDSA P-256 signature against the key the account service has for that device (GET /) |
| Device key (guest channel) | Registered with the account service | A guest's connection | ECDH with the registered keys, see The guest channel |
The account service endpoints are described in Account service API. Ticket checks are cached on the PC (per ticket, shared by all connections): a yes for 5 minutes (never past the ticket's expiry), a no for 1 minute. When the service cannot be reached, a yes still within its 5 minutes is used; after that the request fails without refused (retry later): nothing is ever served unconfirmed.
Limits and timeouts#
| Limit | Value |
|---|---|
| Connections a PC serves at once | 16 per device (hello name + inst), 128 in all; a hello past either is answered {"error":"busy","retry":5} (logged once a minute per device), never closed silently |
| Space Relay pipes a PC serves at once | A pool apart from the LAN's (neither crowds the other out): 8 per device, 48 in all, answered busy past either; a relay pipe waiting 2 min for a request is closed (a LAN connection: 15 min) |
| A socket past every slot | LAN 128 + 32 still in their hello, relay 48 + 16: answered {"error":"busy","retry":5} at once, its hello read, then closed cleanly (no reset) |
| A device connecting again | its connections idle (waiting for a request) for 60 s or more are closed first; at a cap, the longest idle connection (the device's own first) makes room |
| Sockets still in their hello | 32 more; past them a connection is closed unread (logged once a minute with who holds the slots) |
| Handshake reads (server) | 15 s each |
| Idle connection (server) | 15 min without a request, then closed |
| Server writes | 60 s |
| Client reads and writes (engine clients) | 10 min |
| Engine clients reuse an idle connection | up to 4 min, then they reconnect |
| TCP connect timeout | 5 s on the LAN; 1.5 s / 3 s for same-site and direct routes |
| Peers' backups served at once | 2 job slots (see prepare) |
| Guest connections per PC | 8 |
Frame format#
A connection is a sequence of frames in each direction. First come the four plain handshake frames, then encrypted frames until the connection ends.
Handshake frames#
| Bytes | Content |
|---|---|
| 4 | Length n of the JSON, signed 32-bit big-endian, 0 ≤ n ≤ 4,096 |
| n | UTF-8 JSON object |
Encrypted frames#
| Bytes | Content |
|---|---|
| 4 | Length L of what follows, signed 32-bit big-endian. L = 1 + body length + 16; 17 ≤ L ≤ 4,194,320 |
| L − 16 | AES-256-GCM ciphertext of the plaintext type ‖ body |
| 16 | GCM tag |
- Plaintext: 1 type byte, then the body. Type
0= JSON message (UTF-8 JSON object), type1= data (raw bytes). - Nonce (12 bytes, not sent): 4 zero bytes, then the frame counter as an unsigned 64-bit big-endian integer. Each direction has its own counter, starting at 0 with the first encrypted frame and incremented by one per frame.
- No additional data.
- Maximum: type byte plus body at most 4 MiB (4,194,304 bytes), so a body of at most 4,194,303 bytes and
Lat most 4,194,320. A sender never makes a bigger frame; a receiver drops the connection on anLoutside 17 to 4,194,320 ("Bad frame length") or a tag that does not verify ("Frame failed authentication"). (Earlier PC versions and the iPhone app accept anLone byte longer, which no sender produces.)
JSON messages#
- A request is a JSON frame with
op, the request name, and its fields:{"op":"status","dest":"3F9A1C07B2E4"}. - An answer is a JSON frame with
ok(trueorfalse) and its fields. Fields set to null may be present asnullor absent; treat both alike. Unknown fields are to be ignored. - Field names in requests and answers are camelCase as written in this chapter (only the LAN announcement uses PascalCase).
+is escaped. The PC's JSON writer (.NET's default encoder) sends every+inside a JSON string as the six characters\u002B, in the handshake frames too. Any JSON parser reads it back as+, and you may send a plain+yourself; but count it when you size a frame: a base64 value (a nonce, a MAC, a signature, a grant'spayloadandsig, a ticket) grows 5 bytes for every+in it.<,>,&,'and non-ASCII characters are escaped the same way (\u003C, …).- Some requests have several answer frames:
list(chunks), progress frames (progress: true), file heads and end frames around data. Each op below says which.
Data frames and streaming#
File contents travel as data frames (type 1), never inside JSON (one exception: the month index of remove and move is base64 inside its JSON). Senders use chunks of up to 1 MiB. A stream of data frames is always bracketed by JSON frames:
- Uploads (
put,replica.put,album.put): the request, the server's answer, then data frames, then an end message from the sender ({"op":"commit"},{"op":"end"},{"op":"abort"}), then the server's final answer. - Downloads (
read,readmany,fetch,album.read,album.readmany): a head ({"ok":true, "size", …}), data frames, then an end frame ({"ok":true, "done":true, "sent":<bytes>}).sentis what was really sent: less than announced means the file got shorter while it was read. putsmall: the request is followed by exactly one data frame (the whole file), answered once.- A lent data key (
album.addwithkey: true) is one data frame of 32 bytes right after the request.
Order, pipelining and connections#
- Answers come in the order of the requests. A client may send several requests before reading answers ("pipelining");
putsmallbatches,readandreadmanyare made for it. - One connection handles one request at a time; parallelism comes from several connections (the engine opens up to 4 per peer destination for transfers; the Photos viewer up to 6 for thumbnails).
cancelis the only message read while an answer is being sent (it stops areadmany).- A connection stays usable after any
{ok:false}answer.
Errors#
| Answer | Meaning | What to do |
|---|---|---|
{"ok":false, "error":"…"} | The request failed (unknown or offline destination, bad path, disk error, a finished date, …). The connection is fine. | Read error; fix or retry. |
{"ok":false, "error":"Unknown request <op>"} | The PC does not know this op (older version, or the feature is off on it). | Check caps; fall back. |
{"ok":false, "refused":true, "error":"…"} | Not allowed: a ticket or grant the service or the signature does not confirm, another machine's folder, an album you may not change. | Do not retry the same request; get a new ticket if it expired. |
{"ok":false, "refused":true, "needsGrant":true, "error":"…"} | Another machine was asked for without a grant on this connection. | Send grant with a read ticket first. |
{"ok":false, "refused":true, "superseded":true, "error":"…"} | A replica.* request under a rearrange grant older than the PC's own rearrangement of that machine (rearrange). | The asking primary ends its job. |
{"ok":false, "busy":true, "retry":<s>, "error":"…"} | All job slots are taken (prepare), or a guest sends too fast (retry: 1). | Wait retry seconds and ask again. |
{"ok":false, "missing":true, "error":"…"} | The file asked for is not there (read, readmany, album reads). | Treat as absent. |
{"ok":false, "full":true, "error":"…"} | The target drive has no room (replica.files). | The date does not fit there. |
{"ok":false, "full":true, "nearlyFull":true, "error":"…"} | The drive is nearly full (nearly-full.md): a new date (mark) or something to copy (replica.files). | Skip that drive, no failure; try again once its announcement says full: false. |
{"ok":false, "verify":true, "error":"…"} | What was written and read back does not have the expected hash (replica.put). | The copy is not kept; send it again or give up. |
| Connection closed | Handshake refused, a frame that does not authenticate, a length out of range, malformed JSON, a data frame where a request was expected (or the other way round), an unexpected internal error. | Reconnect. |
Errors whose meaning depends on the op are listed with each op.
Capabilities and versions#
How a peer learns the other's capabilities#
There is one protocol version (v: 1 in the handshake, SpaceBackup v1 in the transcript). Features added since are announced as capabilities: after the handshake, send caps and read the answer. Clients ask once per connection, before using a feature that needs one. A key that is missing means 0 / false. The older keys are booleans; newer ones are integers that grow with each addition.
{"op":"caps"}
{"ok":true, "putsmall":true, "dated":true, "jobs":true, "fanout":true, "resume":true, "e2e":true, "fetch":true,
"placement":true, "gdrive":1, "read":3, "album":9, "replicate":2, "rearrange":3, "remove":1, "partial":1}
The PC never checks capabilities itself: a client that sends an op the PC does not know gets Unknown request <op>.
Every capability#
| Key | Current | Version | Since | What it added |
|---|---|---|---|---|
putsmall | true | true | v0.4.0 | putsmall: small files in pipelined batches. |
dated | true | true | v0.5.0 | Dated folders: every request but status and caps names a date and cf; prepare (re-homes the other layout, moves a v0.4 mirror into today's folder), link and prunedate. |
jobs | true | true | v0.5.3 | Job slots: prepare takes one (busy/retry when all are taken), release frees it. |
fanout | true / false | true | v0.5.4 | dests on put and putsmall (one copy for several drives of that PC), recheck in prepare. false on a PC without a fan-out queue. |
resume | true | true | v0.5.5 | resume: true on put and the from frame (big files resume from verified blocks); mark / unmark; incomplete in prepare. |
e2e | true | true | v0.5.6 | hash on putsmall and in put's commit: the PC keeps only data whose read-back hash is the sender's. |
fetch | true | true | v0.5.6 | fetch: a file by its hash, for self-repair. |
placement | true | true | v0.5.9 | placement (where each folder's copies live) and prunefolder. |
gdrive | 1 | 1 | 2026-10-12 | gdrive-speed: Google Drive download speed test. 0 on a PC without the Google Drive service. |
read | 3 | 1 | 2026-10-13 | dates; machine on list and stat; read (byte ranges). |
| 2 | 2026-10-13 | grant: another machine is served only under a confirmed read ticket. | ||
| 3 | 2026-10-16 | readmany (up to 64 files in one request) and cancel. | ||
album | 15 | 1 | 2026-10-15 | album.add, album.put, album.list, album.read, album.remove, album.delete. |
| 2 | 2026-10-15 | Transfer jobs: album.copy, album.status, relay tickets, queued on album.put, state on each pushed drive. | ||
| 3 | 2026-10-17 | album.clone. | ||
| 4 | 2026-10-17 | album.readmany and guests (the guest channel). | ||
| 5 | 2026-10-17 | album.caption (and caption carried by album.put). | ||
| 6 | 2026-10-20 | album.put from the owning device into its public album (meta, as the backup put). | ||
| 7 | 2026-10-20 | album.add and album.clone as PC-side jobs: they run to the end without the caller; detach: true, album.job, jobs in album.status, job in their frames. | ||
| 8 | 2026-10-22 | Items keep their source's index fields (album.add items, album.put, album.list). | ||
| 9 | 2026-10-23 | (0.14.3, iOS request #67) album.put with meta from a device of the member who owns an ordinary album, not only into a public album. | ||
| 10 | 2026-11-01 | (0.16.59, iOS request #97) An album's Deleted area: album.remove and album.delete keep what they take 30 days; album.deleted, album.restore, album.purge. | ||
| 11 | 2026-11-02 | (0.16.72, iOS request #103) An item the album already has without a thumbnail takes the one brought: album.add sent again (thumbs in its answer), album.copy and album.put with fillThumb. | ||
| 12 | 2026-11-03 | A large put's items as one batch on the PC that takes them: album.put with batch: true (album.json written once per batch there, not once an item) and album.flush at the put's end. An older PC ignores batch and answers album.flush "Unknown request"; nothing else changes. | ||
| 13 | 2026-11-08 | album.merge: every item of two of the owner's albums into a new one, duplicates once (albums.md, Merging two albums). | ||
| 14 | 2026-11-08 | The album's Excluded folder (albums.md, Excluded items): an assistant's add puts a work item (index field work, conf 0.6 or more) into Excluded/ (album.json excluded, returned items in kept); album.put's item carries excluded {conf, why}; album.list carries them, their files as Excluded/<name>; album.excluded, album.return; album.remove of an excluded item moves it to the Deleted area. | ||
| 15 | 2026-11-08 | The user's work mark (albums.md, The user's work mark): an assistant's add (AutoAdd, CloneForJob of a job that excludes work) is written "auto": true in album.json and album.put's item carries auto; the assistant's adds use the mark first (not work: never excluded; work: excluded unless the album keeps it); each PC's albums follow a mark on its own drives (not work: back from Excluded, kept; work: an assistant's add into Excluded with the label {conf: 1, why, user: true}, its kept entry dropped; an item added by hand never moves). | ||
replicate | 2 | 1 | 2026-10-17 | replicate, replicas, replica.begin, replica.files, replica.put, replica.end. |
| 2 | 2026-10-23 | (0.14.0, iOS request #66) Catch-up: copies and the reads for them under a grant past its expires, up to 90 days after it was issued; replica.has, replica.list, replica.read under a replication grant; the Replica state resend. | ||
rearrange | 3 | 1 | 2026-10-18 | rearrange, replicas {rearrange: true}, replica.dates, replica.has, replica.drop, date on replica.begin. 2: replica.list, replica.read. 3 (2026-10-22, iOS request #54): the form check before replica.drop {form} (missing in the answer), replica.list {any}. |
| 2 | 2026-10-19 | replica.list, replica.read: the primary copies a date from another PC's drive of the grant. | ||
forms | 1 | 1 | 2026-10-26 | forms: the forms a PC asks the calling phone for on a drive (Encrypt… / Don't encrypt…), and the phone's answers. |
remove | 1 | 1 | 2026-10-18 | remove: files and the new month index of a date in one request. |
move | 1 | 1 | 2026-10-21 | move: renames inside a date and its new month index files in one step (iOS request #49). |
changes | 0 / 1 / 2 / 3 | 3 | 2026-10-25 | (#70) 1: backups.changes and album.changes: the moves in a device's backups and an album's adds and removes made on this PC, as numbered change records since a counter. 2: also changes.watch (an open app hears every change at once) and changes.push (PC to PC), album adds and removes recorded. 3 (after 0.14.6): move and remove take ids (and a move its group), so an encrypted date's moves are recorded as moved/gone instead of full. 0 on a PC that keeps no change log. |
partial | 1 | 1 | 2026-10-20 | unmark {partial: true}: a date closed after a stopped run; partial in prepare, dates, replica.dates, replica.list; partial on replica.begin. |
upload | 1 | 1 | 2026-10-28 | Takes uploads through the relay's HTTPS door (iOS request #77) and mark {uploads: true}. |
multidrive | 2 | 1 | 2026-11-07 | prepare and link take drives: [id, …] instead of dest and answer per drive (drives: {id: answer}): one round trip for all of a device's drives on this PC. 2 (iOS #160, 2026-11-07): list, mkdir, status and mark too. An older PC ignores drives; send it to an op only when the cap says that op takes it. |
work-mark | 0 / 1 | 1 | 2026-11-08 | photos.work: a phone's work marks forwarded by the PC to the account service as its member. 0 on a PC that does not forward them. |
photoreq | 1 / 2 | 2 | 2026-11-05 | photos.requests: what a PC's Photos window asks the calling phone to do with its own items (Delete, a caption, a public link), and the phone's answers. 2: also archive and unarchive (the window's Archive / Unarchive). 0 on a PC that keeps no such requests. |
arrival | 1 | 1 | 2026-11-10 | Every copy is checked as it lands (Backing up › Every file is checked as it arrives): put and putsmall answer checked: true (the sender's hash matched and a photo or video decodes) or checked: false with damaged and resend (it arrived cut short or does not decode; kept, and a re-send request filed at once). Treat an item as backed up only on checked: true; send hash with every file. |
resend | 1 | 1 | 2026-11-10 | A damaged backup copy is sent again by its origin (Re-sending a damaged copy): prepare answers resend, photos.requests lists op resend, and resend.answer takes a computer source's answers. |
links | 3 | 1 | 2026-10-21 | Serves public links to the account service: on the guest channel with an lk_… ticket (access: "link"), only link.list → {items: [{i, name, kind, size, mtime, thumb} or {i, missing}]} and link. → a head {name, kind, size, offset, length, mtime}, data frames, {done, sent}; never anything of a date holding an encrypted tree. 2 (iOS request #47): a whole album's link, link. → {total, hidden, offset, items: [{key, name, kind, size, mtime, thumb}]} (what the album holds now on this PC; hidden: items with no plain copy here; items deleted or archived on their phone left out) and link.. 3 (iOS request #48): link. sends a HEIC/HEIF/TIFF/RAW photo as a full-size JPEG made with ImageMagick (head name = <stem>.jpg, jpeg: true; cached on the PC), and link.album items carry taken. |
vision | 0 / 1 | 1 | 2026-10-19 | Space Vision host (a phone's newest complete plain date on this PC): vision.status, vision.search, vision.get (Space Vision). 0 on a PC with none. |
analyze | as vision | 1 | 2026-10-19 | The same as vision, under the phone's name for it (iOS request #40). |
vision-worker | 0 / 1 | 1 | 2026-10-19 | This PC runs a Space Vision worker (a usable NVIDIA graphics card, runtime and models installed, not paused). |
vision-lease | 0 / 1 | 1 | 2026-10-21 | Space Vision phase 2: workers on other PCs of the company may lease this host's plain dates (vision.challenge, vision.hello, vision.pending, vision.lease, vision.unlease, vision.put). |
vision-select | 0 / 2 | 2 | 2026-10-22 | Space Vision selection (iOS request #51): vision.select and vision.job: a worker judges the phone's candidates against the user's words. 2 (iOS request #60): the host settles analysed candidates itself from their stored vectors first; vision.job answers partial while a worker judges the rest, and timings. |
vision-search | 0 / 1 | 1 | 2026-10-22 | vision.search {query}: the machine's analysed items ranked by the words and their stored vectors, from the host's index alone (iOS request #60). |
search-index | 0 / 1 | 1 | 2026-11-06 | search.index: a device's search index on this PC in one answer, instead of its month files read one by one (Space Vision). |
geo | 0 / 1 | 1 | 2026-11-08 | geo.resolve, geo.places, geo.names, the geo filter of vision.search and assistant.job, and each hit's compact geo (geography). |
vision-embed | 0 / 1 | 1 | 2026-10-22 | vision.embed: this PC makes a query's vector for a host (the Space Vision runtime and SigLIP 2 installed; no graphics card needed). |
assistant-job | 0 / 1 / 2 / 3 / 4 | 1 | 2026-10-22 | assistant.job and assistant.job.status: this PC finishes a phone's assistant request: candidates, selection, the album with its filter and shares, the alert (iOS request #61). On a Space Vision host (vision: 1) that keeps albums. Without it the phone runs the request itself. |
| 2 | 2026-10-23 | (0.14.0, iOS request #64) The reading's shared albums are searched and their matches cloned into the album made; no consent refusal (every member's plain backups are analysed); refused at submit only signed-out, or no-worker for content nothing could judge. | ||
| 3 | 2026-10-25 | (iOS request #73) assistant.job.cancel: the Assistant's Stop ends a job after the step it is on, keeping what it did, with no done alert. | ||
| 4 | 2026-11-05 | The desktop window: another computer of the phone's member sends the job for the phone's backups (machine: the phone) with no grant, under the job ticket it took for the phone (POST assistant/jobs/ticket device); refused at once with reason: "not-here" when this PC holds no plain backup of it. |
album, replicate and rearrange are 0 on a PC that has no album host or replication host; current Windows, Mac and Linux builds have both.
Behaviour with older peers#
| The other side lacks | What the apps do |
|---|---|
dated (v0.4 or earlier) | prepare answers Unknown request: the destination fails with "<PC> runs an older Space Backup (v0.4 or earlier); update it to v0.5 to back up there". |
caps itself fails | fanout, resume, placement are taken as false. |
fanout | Each destination of that PC gets its own copy. |
resume | No markers (mark/unmark are not sent) and no resumed big files. |
e2e | The PC ignores hash and checks as before. |
placement | No placement; prunefolder is not sent ("runs Space Backup v0.5.8 or older"): that folder's dates stay there until they age out. |
gdrive 1 | The speed test says "needs a newer Space Backup there". |
read ≥ 2 | grant answers Unknown request: such a PC serves another machine's encrypted trees only; readers go on without a grant. |
read ≥ 3 | Single reads instead of readmany. |
album ≥ 3 | The phone sends album.clone only to a PC with album >= 3; otherwise it counts the items as waiting. |
album ≥ 4 | No guests and no album.readmany on that PC. |
album ≥ 5 | No captions there. |
album ≥ 8 | Album items carry only what album.json had before (no index fields); fields sent in album.add items are ignored. |
album ≥ 7 | No detach and no album.job: the phone stays connected for an add or clone there (on that PC a dropped connection stops the add at its next progress frame; the items done so far stay, an add again answers them already). |
replicate 1 (as primary) | The source sends each computer its own copy. |
replicate 1 (as target) | That drive is failed ("runs an older Space Backup without replication"); the source sends it there itself. |
replicate 2 (as target) | After the grant's time that drive waits with grantExpired ("<PC> runs an older Space Backup that copies only under <machine>'s new grant"): send replicate again with a new grant. It is never copied from. |
rearrange 1 | Copies to that PC are failed (the phone sends there itself); its old copies are kept (never dropped). |
rearrange 2 | That PC's copies are not copied from: a form held only there counts as held nowhere (the phone resends it). |
rearrange 3 | That PC is never asked to drop a date's old form: its drive waits ("<PC> runs an older Space Backup that cannot check a date's forms before dropping one") until it is updated; its copies are listed with replica.list (complete in one form only). |
remove 1 | The phone leaves that PC alone and tries again at its next run. |
Information requests#
caps#
- Direction: any device → PC. Needs: nothing (works on every version). Auth: company channel.
- Request:
{"op":"caps"} - Answer: the capability map, see Capabilities and versions.
status#
Whether one of the PC's destinations is connected, and its free space.
- Direction: device → PC. Needs: nothing. Auth: company channel.
- Request:
dest. - Answer:
online(the destination exists on that PC and its folder is there),free(bytes; 0 when offline),keep(the PC's max number of backups: after each of the caller's runs completes on one of its drives the PC prunes the caller's complete dates there beyond it, see replication.md "The PC's keep count"; 0 when none is set; absent from older PCs), and (0.16.10)full,freeBytes,totalBytes,fullSinceas in the announcement (null before the drive was measured, absent from older PCs). An unknowndestisonline: false, not an error. - Several drives at once (
multidrive2):drives: [id, …]instead ofdest(at most 64), answered{"ok":true, "drives":{"<id>": <the answer above>, …}}in the request's order; an unknown or offline drive isonline: falsethere, as above.
{"op":"status", "dest":"3F9A1C07B2E4"}
{"ok":true, "online":true, "free":1873415372800, "keep":10, "full":false, "freeBytes":1873415372800, "totalBytes":4000787030016, "fullSince":null}
Backing up to a PC#
A run from a device to one destination of a PC goes like this (one connection for the requests, up to 4 more for file transfers):
prepare(takes a job slot; answers the dates already there),caps,markthe new date incomplete,list/statto see what is there,linkunchanged files from the previous date,mkdir,putsmallbatches andputfor big files,delete/rmdir/delpartfor what went away,unmark(the date is complete; the PC writes its manifest), or, when the run stopped with items left, close it: the indexes,linkof what it did not reach from the previous date,unmark {partial: true},placement,prunedate/prunefolderfor dates that age out,release(frees the job slot).
A finished date is read-only for writes. A date folder with a manifest and no incomplete marker is finished: put, putsmall and link into it are refused with "<date> is complete on <PC>:<path>; mark it incomplete before writing into it". To change an older date, run on it: mark, the writes, unmark (which rewrites its manifest and hashes). delete, prunefolder and remove are allowed in a finished date and update its manifest themselves.
prepare#
Starts a backup job on the PC and lists the sender's dates on that destination.
- Direction: device → PC. Needs:
dated(v0.5);recheckneedsfanout,incompleteneedsresume. Auth: company channel; the caller's own folder. - Request:
dest,cf,today(the run's date). - What it does: takes a job slot (2 per PC by default; a peer holding one is always let in again); moves date folders written under the other
cflayout into this one; moves a v0.3/v0.4 mirror intotoday. - Answer:
dates(the sender's date folders there),recheck(true: list that destination instead of trusting your own index, because a fan-out copy there failed or is still queued),incomplete(dates holding the incomplete marker),partial(partial1: dates closed after a stopped run; they are complete, so they are not inincomplete, and they are good to link from),resend(resend1, only when there are some: the sender's files on that drive found damaged with no good copy anywhere,[{id, op, date, rel, size, cause, requested, hash?, item?}]; the run copies each again even when it looks unchanged and answers withresend.answer; see Re-sending a damaged copy). - Busy:
{"ok":false, "busy":true, "retry":<seconds>, "error":"busy with other PCs' backups, retry in <n> s"}.retryis 30 plus a random 0–30. The engine waits and asks again for up to 4 hours, then skips the destination for this run. - The slot is held until
release, or until 60 seconds after the peer's last connection closed. - Several drives at once (
multidrive1):drives: [id, …]instead ofdest(at most 64). One job slot covers them all; the drives are prepared at the same time and the answer is{"ok":true, "drives":{"<id>": <the answer above>, …}}in the request's order. An unknown or offline drive is{"ok":false, "error":"…"}there and the others are answered. Over the relay this is one round trip instead of one per drive.
{"op":"prepare", "dest":"3F9A1C07B2E4", "cf":true, "today":"2026-10-17"}
{"ok":true, "dates":["2026-10-14","2026-10-15","2026-10-16"], "recheck":false, "incomplete":["2026-10-16"], "partial":[]}
release#
- Direction: device → PC. Needs:
jobs(v0.5.3). Auth: company channel. - Request: no fields. Answer:
{"ok":true}. Frees the caller's job slot.
{"op":"release"}
list#
Files and folders under a folder of a date.
- Direction: device → PC. Needs:
dated;machineneedsread≥ 1 (and a grant for another machine sinceread: 2). Auth: company channel. - Request:
dest,cf,date,rel(""for the date folder itself),machine(optional; default: the caller). - Answer: one or more frames
{ok, files:[[rel, size, mtimeTicks]], dirs:[rel], done}, each about 1 MB of JSON at most; the last hasdone: true. Paths are relative to the listed folder,\-separated, recursive (every file and folder below it).
{"op":"list", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-10-16", "rel":"C\\Users\\anna\\Documents"}
{"ok":true, "files":[["Budget 2026.xlsx", 48213, 639277705310000000], ["Letters\\Bank.docx", 20114, 639201112000000000]],
"dirs":["Letters"], "done":true}
- Several drives at once (
multidrive2):drives: [id, …]instead ofdest(at most 64), the samedate,relandmachinelisted on each drive at the same time. The frames are then{"ok":true, "drives":{"<id>":{"ok":true, "files":[…], "dirs":[…]}, …}, "done":…}, still about 1 MB each: a frame holds only the drives with entries in it; append each drive'sfilesanddirsacross the frames. The last frame (done: true) names every drive of the request, in its order: the rest of its entries (possibly none), or{"ok":false, "error":"…"}for an unknown or offline drive. A refused read (machinewithout a grant) is the whole request's{"ok":false, "refused":true, …}.
{"op":"list", "drives":["3F9A1C07B2E4", "8D21E0F4A9C3"], "cf":true, "date":"2026-10-16", "rel":"Photos\\2026\\10"}
{"ok":true, "drives":{"3F9A1C07B2E4":{"ok":true, "files":[["IMG_0001.HEIC", 2210443, 639277705310000000]], "dirs":[]},
"8D21E0F4A9C3":{"ok":false, "error":"Destination offline: F:\\"}}, "done":true}
stat#
- Direction: device → PC. Needs:
dated;machineas forlist. Auth: company channel. - Request:
dest,cf,date,rels(paths in the date folder),machine(optional). - Answer:
files, in the order ofrels:[size, mtimeTicks]ornullwhen not there.
{"op":"stat", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-10-16", "rels":["C\\Users\\anna\\Documents\\Budget 2026.xlsx", "C\\gone.txt"]}
{"ok":true, "files":[[48213, 639277705310000000], null]}
mkdir, rmdir, delpart#
| Op | Does | Request |
|---|---|---|
mkdir | Creates a folder (and its parents) in the date folder. | dest, cf, date, rel |
rmdir | Removes a folder if it is empty. | dest, cf, date, rel |
delpart | Deletes the temp file (.~sbpart) of an interrupted copy of rel. | dest, cf, date, rel |
- Direction: device → PC. Needs:
dated. Auth: company channel; the caller's own folder. - Answer:
{"ok":true}. - mkdir on several drives (
multidrive2):drives: [id, …]instead ofdest(at most 64), answered{"ok":true, "drives":{"<id>":{"ok":true} or {"ok":false, "error":"…"}, …}}in the request's order.rmdiranddelparttake onlydest.
{"op":"mkdir", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-10-17", "rel":"C\\Users\\anna\\Pictures\\2026"}
delete#
Removes a file or a folder (this date's name only: other dates sharing the file by hard link keep it).
- Direction: device → PC. Needs:
dated. Auth: company channel; the caller's own folder. - Request:
dest,cf,date,rel,dir(truefor a folder; defaultfalse). - Answer:
{"ok":true}. In a finished date the manifest entries go in the same step, also when the path is already gone (a retried delete, a missing.sbefolder): nothing is left listed that is not there.
{"op":"delete", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-10-17", "rel":"C\\Users\\anna\\Temp", "dir":true}
link#
Gives files of an earlier date a name in this date: a hard link, or a copy on the PC's own disk where links are not possible. This is how unchanged files cost nothing.
- Direction: device → PC. Needs:
dated. Auth: company channel; the caller's own folder;tomust not be a finished date. - Request:
dest,cf,from(earlier date),to(this date),rels. - Answer:
errors(one per rel, in order:nullor the error text),copied(truewhen the PC had to copy instead of link). - Several drives at once (
multidrive1):drives: [id, …]instead ofdest(at most 64): the samerelslinked on each drive at the same time, answered{"ok":true, "drives":{"<id>": {"ok":true, "errors":[…], "copied":…}, …}}. A finishedto, an unknown or offline drive is that drive's{"ok":false, "error":"…"}only.
{"op":"link", "drives":["3F9A1C07B2E4", "8D21E0F4A9C3"], "cf":true, "from":"2026-10-16", "to":"2026-10-17", "rels":["C\\a.txt"]}
{"ok":true, "drives":{"3F9A1C07B2E4":{"ok":true, "errors":[null], "copied":false}, "8D21E0F4A9C3":{"ok":false, "error":"Destination offline: F:\\"}}}
{"op":"link", "dest":"3F9A1C07B2E4", "cf":true, "from":"2026-10-16", "to":"2026-10-17",
"rels":["C\\Users\\anna\\Documents\\Budget 2026.xlsx", "C\\Users\\anna\\Documents\\Letters\\Bank.docx"]}
{"ok":true, "errors":[null, null], "copied":false}
mark, unmark#
- Direction: device → PC. Needs:
resume(v0.5.5). Auth: company channel; the caller's own folder. - Request:
dest,cf,date,run(the run's id, free text);markalsouploads(optional,upload1);unmarkalsopartial(optional,partial1) andfanoutWait(optional, seconds). markwith"uploads": true: uploads through the relay's HTTPS door are on their way. The marker says so, and the PC closes the date as a dead run only after 24 hours without a write (not 2 hours), since iOS may space its background uploads hours apart.markputs the incomplete marker (.spacebackup-incomplete) into the date folder: writes are allowed there, and readers know it is not whole. It is allowed on any date: a complete or partial date is re-opened, and a marker left by a run that died is replaced by this run's (that is how a device recovers a stale marker:markwith a new run id, then close the date).unmarkwrites the date's manifest (every file with its hash) and removes the marker. The marker goes once the PC's fan-out copies of that date to that destination are done. A plainunmark(nopartial, orfalse) leaves a complete date and also removes a partial marker.unmarkwith"partial": truecloses a run that stopped with items left: the manifest is written, the partial marker (.spacebackup-partial) goes in, then the incomplete marker goes. Before it, the device has written the month indexes andlinked from the previous date everything the run did not reach (untouched months and the unfinished rest of the current one). See partial dates.- A nearly full destination (nearly-full.md, 0.16.10) refuses
markof a date that is not marked yet: `{"ok":false, "full":true, "nearlyFull":true, "freeBytes":…, "totalBytes":…, "error":"mars-001 /home/space is nearly full (12 GB left)"}`. The caller writes nothing there and goes on to its other destinations (a PC's run lists it asskipped: nearly full, not failed). A date already marked (a run or uploads in progress) is marked again as before. unmarkalso says which of the date's fan-out copies to that destination failed (iOS request #81, 2026-10-31): aput/putsmallwithdestsis done when its landing copy is verified, so a copy to another drive can fail after the device wrote that drive's index.unmarkanswers"fanoutFailed": [rels](the rels as theputnamed them; each is answered once) and, if copies are still queued,"fanoutPending": n. With"fanoutWait": s(seconds, up to 120; default 0) it first waits that long for the date's copies to that destination; a PC's own runs never wait. Pending copies' failures are not known yet (the nextprepareanswersrecheck: truefor that destination, as before). Both are left out when there is nothing to say. WithfanoutFailed, the date closes on that drive without those files (at once if nothing is pending); the device writes that drive's index and thumbnails again without them:mark(a new run id), the writes,unmark {partial: true}. An older PC never sends either field.- mark on several drives (
multidrive2):drives: [id, …]instead ofdest(at most 64), the samedate,runanduploadsmarked on each drive at the same time, answered{"ok":true, "drives":{"<id>":{"ok":true} or the nearly-in the request's order.full refusal above or {"ok":false, "error":"…"}, …}} unmarktakes onlydest. - Answer:
{"ok":true}, plusfanoutFailed/fanoutPendingas above.
{"op":"mark", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-10-17", "run":"r_20261017_091403"}
{"op":"unmark", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-10-17", "run":"r_20261017_091403", "partial":true}
{"ok":true, "fanoutFailed":["Photos\\2026\\10\\IMG_4021.HEIC"]}
A partial date is complete for everything that reads it: browse and restore (shown "partial"), the integrity check, replication (its copies are closed partial too), Space Vision, public links, rearranging, and the previous date a new run links from. Retention never counts it toward the max number of backups.
put#
One file of any size, streamed.
- Direction: device → PC. Needs:
dated;destsneedsfanout;resumeneedsresume;hashon commit needse2e. Auth: company channel; the caller's own folder; not a finished date. - Request:
dest,cf,date,rel,size(bytes),mtime(ticks); optionaldests(several destination ids of this PC,destone of them: the file is sent once, lands on the fastest, the PC copies it to the others itself), optionalresume: true(only for files of at least 64 MiB). - First answer:
{"ok":true}; withresume:{"ok":true, "have":<bytes>, "block":8388608, "blocks":[hash,…]}: the bytes of an interrupted earlier copy of the same source version the PC kept and re-verified, and the hash of each 8 MiB block of them. - Then the sender sends, only when the PC offered resume:
{"op":"from", "offset":<n>}wherenis 0 or a block boundary up tohave(the blocks before it match the sender's own copy); then data frames (from that offset; 1 MiB chunks); then{"op":"commit", "hash":"<XxHash128 of the whole file>"}, or{"op":"abort"}. - Final answer:
{"ok":true, "error":null}, or{"ok":false, "error":"…"}(a write error, or "Verification failed …" when what was written and read back does not havehash: send the file again). Afterabortthe answer is alwaysok: trueand nothing is kept. - The arrival check (
arrival1): a committed copy's answer also says"checked": truewhen it is confirmed good (it has yourhash, and a photo or video decodes: its picture size reads, a movie has a duration, nothing is cut short). A photo or video that arrived damaged is kept and answered{"ok":true, "error":null, "checked":false, "damaged":"<cause>", "resend":"rs_: the PC filed a re-send request for it that moment and woke you with the…"} formspush. Keep the item queued, read the original again in full and handleresendas a request fromphotos.requests(send it again in this run, answer the id). When those very bytes were asked for before and the request was answeredsameorgone, or given up, the copy is the best there is:{"ok":true, "error":null, "checked":true, "kept":"<cause>; <the answer>"}(count it; the owner hears of it through the request).checked: falsewithoutdamaged: the PC could not read the copy to the end, and checks it again itself (before any later date links it). A commit withouthashis neverchecked: true. - With
dests, the put is done when the landing copy is verified; the other copies follow in the background (seerecheckinprepareand theunmarkwait).
{"op":"put", "dest":"3F9A1C07B2E4", "dests":["3F9A1C07B2E4","8C21D0E5F7A9"], "cf":true, "date":"2026-10-17",
"rel":"D\\Video\\Holiday.mp4", "size":2147483648, "mtime":639278252430000000, "resume":true}
{"ok":true, "have":16777216, "block":8388608, "blocks":["9c1e4be0d22f4a7f8b3c6d5e4f3a2b1c", "0f1e2d3c4b5a69788796a5b4c3d2e1f0"]}
{"op":"from", "offset":16777216}
…data frames…
{"op":"commit", "hash":"4be09c1e2f4a7fd28b3c6d5e1c4f3a2b"}
{"ok":true, "error":null, "checked":true}
A photo that arrived cut short (its bytes are what the device read, so the device read it short: an iCloud original not fully downloaded):
{"ok":true, "error":null, "checked":false, "damaged":"the JPEG is cut short (no end of picture after its scan)", "resend":"rs_3f2a9c1d0b7e6a54"}
putsmall#
One small file in one round trip; meant to be pipelined in batches (the engine sends up to 64 files / 2 MB, then reads the answers).
- Direction: device → PC. Needs:
putsmall;destsneedsfanout;hashneedse2e. Auth: company channel; the caller's own folder; not a finished date. - Request:
dest,dests(optional),cf,date,rel,size,mtime,hash; then exactly one data frame with the whole file (the PC always reads it first, so a refused write keeps the stream in step). - Answer:
{"ok":true}or{"ok":false, "error":"…"}(one answer per file, in order); witharrival1,checked,damagedandresendas forput.
{"op":"putsmall", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-10-17", "rel":"C\\Users\\anna\\Documents\\notes.txt",
"size":1834, "mtime":639278252430000000, "hash":"d22f9c1e4be04a7f6d5e8b3c4f3a2b1c"}
…one data frame of 1,834 bytes…
{"ok":true, "checked":true}
prunedate#
- Direction: device → PC. Needs:
dated. Auth: company channel; the caller's own folder. - Request:
dest,cf,date. Removes that whole date folder of the caller (files linked into other dates stay there). Answer:{"ok":true}.
{"op":"prunedate", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-09-17"}
prunefolder#
Removes one backed-up folder from a date (and its manifest entries), on a destination that no longer receives that folder, as its dates age out.
- Direction: device → PC. Needs:
placement(v0.5.9). Auth: company channel; the caller's own folder. - Request:
dest,cf,date,rel(the folder's place in the date folder). Answer:{"ok":true}.
{"op":"prunefolder", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-09-20", "rel":"C\\Users\\anna\\Music"}
placement#
Stores, in that backup root, the sender's folders and which PCs and drives hold each one's copies. The PC's weekly check asks those holders first when it repairs a file.
- Direction: device → PC. Needs:
placement. Auth: company channel; a peer describes only its own folders (the PC overwritesComputerandInstwith the caller's). - Request:
dest,doc(the placement document as a JSON string). Stored as<root>/.. spacebackup- placement- <MACHINE>. json - Answer:
{"ok":true};Bad placementwhendocdoes not parse.
{"op":"placement", "dest":"3F9A1C07B2E4",
"doc":"{\"Computer\":\"ANNA-PC\",\"Inst\":\"\",\"UpdatedUtc\":\"2026-10-17T09:20:00Z\",\"Folders\":[{\"Path\":\"C:\\\\Users\\\\anna\\\\Documents\",\"Rel\":\"C\\\\Users\\\\anna\\\\Documents\",\"Mode\":\"Auto\",\"Copies\":2,\"Holders\":[{\"Inst\":\"5f0c2a9e8b7d4c31a6e2f90d14b7c3a8\",\"Machine\":\"OFFICE-NAS\",\"Dest\":\"3F9A1C07B2E4\",\"Path\":\"/mnt/backup1\"}]}]}"}
remove#
Removes files of one date and replaces the month index that listed them, in one step (the iPhone's Remove from backups).
- Direction: device → PC. Needs:
remove1. Auth: company channel; the caller's own folder only (machinenaming another isrefused). Allowed in a finished date. - Request:
dest,cf,date,rels(optional; any file of the date folder:Photos\…,Archived\…,Deleted\…(an item deleted for good from the phone's Deleted folder),Thumbs\…; send both spellings of each item when unsure, encrypted.sbe-<key id>/…and plain),index(optional):{rel, data, mtime?}withdatathe new index file base64 inside the JSON (no data frame follows; the whole request fits one 4 MiB frame, about 3 MB of index),mtimein ticks (default: the PC's now). At least one ofrelsandindex. ids(optional,changes3): the index ids of the items removed, at most 100: the change record lists them undergonewhen the PC cannot read the index (an encrypted date) or none came with the request.- What it does: checks every path first (one bad path: nothing changes), writes the index (if that fails nothing is removed), deletes the files; in a finished date rewrites the manifest once (files out, index with its new size, mtime and hash) and drops the hash journal. The date stays complete.
- Answer:
removed(rels deleted),missing(rels not there). Errors:Nothing to remove, bad base64, unknown destination, a bad path.
{"op":"remove", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-10-16",
"rels":["Photos\\2026\\10\\IMG_1234.HEIC", "Thumbs\\2026\\10\\IMG_1234.HEIC.jpg"],
"index":{"rel":"Index\\2026-10.json", "data":"eyJ2IjoxLCJpdGVtcyI6W119", "mtime":639279090000000000}}
{"ok":true, "removed":["Photos\\2026\\10\\IMG_1234.HEIC", "Thumbs\\2026\\10\\IMG_1234.HEIC.jpg"], "missing":[]}
move#
Moves items between folders of one date (Photos\…, Archived\…, Deleted\…) and replaces the month index files that say where they are, in one step (the iPhone's Archive, Delete and putting back, without sending the item again).
- Direction: device → PC. Needs:
move1. Auth: company channel; the caller's own folder only (machinenaming another isrefused). Allowed in a finished date with nomark; a date being written (marked) answers{"ok":false, "waiting":true, "error":"…"}: retry after that run. - Request:
dest,cf,date,moves:[{from, to}](rels of the date folder; encrypted.sbe-<key id>/…rels for an encrypted drive),index(optional):[{rel, data, mtime?}](one object is taken too), eachdatathe new file base64 inside the JSON, already encrypted for an encrypted drive. The PC never decrypts anything. One request per date and destination: the PC does not pass it on to its other drives (asremove). ids,group(optional,changes3): the index ids of the items moved (at most 100) and where they went,Deleted,ArchivedorPhotos(put back, unarchived): the change record lists them undermoved.<group>when the PC cannot read the index (an encrypted date). One action per request (all its ids go to one group).- What it does: checks every path first, renames each
fromto itsto(parent folders created; the same file, so other dates' hard links keep their old names), writes the index files, rewrites the manifest once (renamed entries keep their hashes, the index files get their new ones) and drops the hash journal. Atoalready there counts as done (already) whenfromis gone or holds the same bytes. Afromin neither place or atowith other content fails the whole request: the renames done so far are undone, nothing is written. - Answer:
moved(renames done),already(found done),missing(empty). Refused:{"ok":false, "error", "moved":0, "already":0, "missing":[froms not found]}. Errors:Nothing to move,Missing moves, bad base64, unknown destination, a bad path,Two items are moved to the same place.
{"op":"move", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-10-16",
"moves":[{"from":"Photos\\2026\\10\\IMG_1234.HEIC", "to":"Archived\\2026\\10\\IMG_1234.HEIC"}],
"index":[{"rel":"Index\\2026-10.json", "data":"eyJ2IjoxLCJpdGVtcyI6W119", "mtime":639279090000000000}]}
{"ok":true, "moved":1, "already":0, "missing":[]}
backups.changes#
The moves in a device's backups made on this PC since a counter (#70, iOS docs/requests.md #70 "Wire shapes"): a device browsing those backups applies them instead of reading every month again.
- Direction: device → PC. Needs:
changes1. Auth: company channel; the caller's own backups, or another machine's under a grant (tickethere, or an earliergranton the connection), as reading them.devicenaming another device thanmachine's isrefused. - Request:
machine(optional, default the caller),device(d_…, optional),ticket(optional),since("<pc>:<n>", optional: absent answers only the counter now). - What the PC records: at each
moveandremove, the month index before and after: the ids whose group changed undermoved(Deleted,Archived,Photos= put back), the ids gone undergone. The same change arriving again within 10 minutes (the phone sends a move per date and per drive) is not a new record; what arrives within 2 s is one record. An encrypted index, which the PC never reads, is recorded from the request'sids(changes3: a remove's undergone, a move's undermoved.<group>; they are the same opaque ids as a plain index's and stay between the phone and the PCs: the service and APNs get only the topic andv); with noids, more than 100, or a move without itsgroup, it makes afullrecord. A plain index decides by itself (idssent with it change nothing). Each record's topic andv(never its ids) go to the account service, which pushes them (POST devices/).changed {topic, v} - Answer:
{"ok":true, "v", "changes":[record, …]}oldest first, this PC's origin only;{"ok":true, "v", "full":true}whensinceis older than the last 1000 records, newer thanv, malformed or of another PC: read the whole backups.vis null before the first change.
{"op":"backups.changes", "machine":"IPHONE-17-PRO", "device":"d_7Hq2", "since":"a07d4c1e9b2f4e6d8c3a5b7f9e1d2c4a:16"}
{"ok":true, "v":"a07d4c1e9b2f4e6d8c3a5b7f9e1d2c4a:17", "changes":[{"part":"backups:d_7Hq2", "v":"a07d4c1e9b2f4e6d8c3a5b7f9e1d2c4a:17",
"prev":"a07d4c1e9b2f4e6d8c3a5b7f9e1d2c4a:16", "at":"2026-10-24T21:55:03Z", "moved":{"Deleted":["A1B2-C3"]}, "gone":["D4E5-F6"]}]}
changes.watch#
An open app's watch (#70 point 5): every change of the parts it shows, made on this PC or arriving from another PC, the moment it is made, over the connection it already has to one PC. The app watches one PC (the first that answers); changes of every origin come down the same watch. The push stays for the background.
- Direction: device → PC, then PC → device unasked. Needs:
changes2. Auth: company channel (an album guest: on the guest channel, its album only); each part as reading it:album:<album>with its album ticket (asalbum.list),backups:<device>by itsmachine(the caller's own, or another's under a grant: a peertickethere or an earliergrant),devicebeing that machine's. The right is checked again before each record goes. - Request:
parts: [{part, ticket?, machine?}]. - Answers: first
{"ok":true, "v":{part:[v, …]}}, the newestvper origin this PC knows for each part it may serve (its own first;[]: no change yet); then once per part it may not serve{"ok":true, "refused":{part, error}}; then{"ok":true, "change":record}for every record of a watched part (the shape ofbackups.changes/album.changes);{"ok":true, "ping":true}every 30 s with nothing else, so either side sees a dead channel. - Another
changes.watchon the channel replaces the parts (a new first answer). Any other request ends the watch and is answered as usual. Closing the channel ends it. A watch belongs to its channel, not to its machine: one machine may hold several watches at once on several channels (the app and an extension, two windows), and what one channel does (a new watch, another request, closing) never touches another's. A watch is neither a job nor a short request: an update does not wait for it. faces(iOS request #84, docs/faces.md#sync): the part{"part":"faces"}is the caller's member's people book (the member of the channel's device; recognize faces on; on any PC withfaces1 of this build, also one keeping no change log; an older PC refuses the part once). Itsvin the first answer is[]; a record is{"ok":true, "change":{"part":"faces"}}alone (nov, no names): the book changed on this PC or arrived from another PC (faces.book.put); the app asksfaces.people(docs/faces.md#peer){since}. One record waiting carries every change made until it goes (a merge of ten people is one); another member's change never goes down this watch.- The app: keeps
vper part and origin, applies a record when it holds itsprev(an older or repeated one changes nothing: set operations on index ids), else asks*.changeson that origin; that PC offline, orfull: reads the whole part from any PC.
{"op":"changes.watch", "parts":[{"part":"album:al_5Kp9", "ticket":"<album ticket>"}, {"part":"backups:d_7Hq2", "machine":"IPHONE-17-PRO"}]}
{"ok":true, "v":{"album:al_5Kp9":["a07d4c1e9b2f4e6d8c3a5b7f9e1d2c4a:42", "5b1e0c9d7a3f4b2e8d6c4a2f0e9b7d5c:7"], "backups:d_7Hq2":["a07d4c1e9b2f4e6d8c3a5b7f9e1d2c4a:17"]}}
{"ok":true, "change":{"part":"backups:d_7Hq2", "v":"a07d4c1e9b2f4e6d8c3a5b7f9e1d2c4a:18", "prev":"a07d4c1e9b2f4e6d8c3a5b7f9e1d2c4a:17", "at":"2026-10-25T01:12:40Z", "moved":{"Deleted":["A1B2-C3"]}}}
{"ok":true, "ping":true}
changes.push#
PC to PC (#70 point 4): each PC sends the records it makes to the company's other online PCs (not phones) at once, over the LAN or Space Relay, end to end encrypted with the company key, so their open apps' watches, their Space Vision workers and their public links hear it too. Every online PC is told (an app may watch any of them), not only the ones holding the album or the backups.
- Direction: PC → PC. Needs:
changes2. Auth: company channel; only records of the sender's own origin (vnaming its instance id) are taken. - Request:
records: [record]. - Answer:
{"ok":true, "taken":n}: the records new to this PC (well formed, of the sender's origin, newer than the newestvit knew of that origin). The others (a repeat, an older one, another origin's, a malformed one) are left out. - What a taken record does here: goes down every
changes.watchof its part;moved.Deletedandgoneids leave this PC's Space Vision worker's queue (a date being staged skips them; records of ones already analysed are not put); public links read what they serve again (a deleted, archived or removed item stops being served at its next request). This PC keeps only the newestvper origin (the first answer of a watch) and never passes the record on;*.changesanswers only for this PC's own origin. - A PC answering
Unknown request(an older build) is not asked again until its version changes; a PC that is off is not asked again for that record (its apps read the part as before).
{"op":"changes.push", "records":[{"part":"album:al_5Kp9", "v":"a07d4c1e9b2f4e6d8c3a5b7f9e1d2c4a:43", "prev":"a07d4c1e9b2f4e6d8c3a5b7f9e1d2c4a:42", "at":"2026-10-25T01:13:02Z", "remove":["9f2c000000000001"]}]}
{"ok":true, "taken":1}
Repair: fetch#
fetch#
Asks a PC for a good copy of a file by its hash, for self-repair (the weekly check found a damaged copy here).
- Direction: PC → PC. Needs:
fetch(v0.5.6). Auth: company channel. Served only from files in the PC's own SpaceBackup roots that their manifests list with that hash; the PC reads the file to check it first. - Request:
hash,size(bytes;-1if unknown),rel(optional hint: the file's path in its date folder). - Answer:
{"ok":true, "size":<as asked>}, data frames,{"ok":true, "done":true, "sent":<bytes>}; or{"ok":false, "error":"No copy with that hash here"}. The asking PC hashes what it got before using it.
{"op":"fetch", "hash":"4be09c1e2f4a7fd28b3c6d5e1c4f3a2b", "size":48213, "rel":"C\\Users\\anna\\Documents\\Budget 2026.xlsx"}
{"ok":true, "size":48213}
Replication#
A source (today the iPhone) sends a date once, to one PC, the primary, which copies the finished date, bytes as they are, to the source's chosen drives on other PCs, PC to PC (see Replication between computers). Encrypted trees stay encrypted: no PC needs or gets a key.
The replication grant#
Every replication request carries the source's grant, signed by the source itself:
"grant": {"payload":"<base64 of the UTF-8 JSON below>", "sig":"<base64 signature of those payload bytes>"}
{"v":1, "kind":"spacebackup-replicate", "machine":"Annas-iPhone", "date":"2026-10-17", "primary":"ANNA-PC",
"targets":[{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4"}, {"pc":"BOB-PC","dest":"8C21D0E5F7A9"}],
"issued":"2026-10-17T10:00:00Z", "expires":"2026-10-17T16:00:00Z"}
- Signature: ECDSA P-256 with SHA-256 over the payload bytes exactly as sent (no canonical JSON), as r‖s (64 bytes, IEEE P1363) or DER. Made with the device's registered signing key when it has one (
POST /; an iPhone's Secure Enclave key cannot sign, so it registers a separate signing key), else with its registered device key. Once a signing key is registered, only it is accepted.account/ api/ devices/ {id}/ signing- key - Key lookup: each PC asks
GET /with its own device token (an active device of an active member of the same company), usesaccount/ api/ devices/ key?name= <machine> signingKeywhen present, elsepublicKey; keeps a key 5 minutes and a "no such device" 1 minute; a signature that does not match a cached key makes it ask once more. The service unreachable makes the copy wait; it is never a refusal. - Time: the phone signs for 6 hours. A PC refuses a grant valid for more than 24 hours, issued more than 5 minutes in the future, or past
expires(5 minutes of clock difference tolerated), with one exception: catch-up.
Catch-up: a PC that was off for days#
0.14.0, iOS request #66 (replicate 2). A drive named in a job's grant is finished from the PCs, without the source, however long its PC was off:
- What an ended grant still allows: only its primary, only copying exactly its date (a rearrangement: its dates) to exactly its drives, and the reads for that (
replica.begin,replica.files,replica.put,replica.end,replica.dates,replica.has,replica.list,replica.read), up to 90 days afterissued. Signature, key, company channel, primary and drive checks are as for a grant within its time; no new key reaches any PC, the bytes are copied as they are stored.replicate,rearrangeand everyreplica.dropstill want a grant within its time. - Where the copy comes from: the primary's own copy when it is complete (no marker, every file its manifest lists there with its size), else a target of the same job that is
doneand answersreplica.hascomplete, read through the primary (replica.list,replica.read, under the same grant). Every file is checked against its hash where it is written; a copy whose file does not match is passed over for the next. - Only what no PC holds goes back to the source: that drive is
resend, itserrorand the primary's log (Replication: no PC holds <machine>'s <date> complete (…): <machine> sends it to <drive> itself) name what is missing where (up to 5 items per drive). A PC that may hold it but is off makes the drive wait instead, for at mostrearrange-wait-days(7), thenresend. - The source stops sending
replicateagain for a date whose drives arewaitingwithoutgrantExpired: the primary finishes them itself.grantExpirednow means the source has to act (the target runsreplicate1, or the grant is past its 90 days). kindkeeps a grant from being taken for anything else: aspacebackup-rearrangegrant is never accepted byreplicate, nor the other way round.- Grant refusals are
{"ok":false, "refused":true, "error":"…"}, e.g.Bad replication grant: …,This replication grant names BOB-.PC as the primary, not ANNA- PC
replicate#
- Direction: source → primary PC. Needs:
replicate1. Auth: company channel; the grant; the caller must be the grant'smachine; the grant'sprimarymust be this PC; itsdatethe request's. - Request:
dest(the primary's drive holding the date),cf,date,grant,alsoTo(optional[{pc, dest}]; each must be in the grant'stargets, none on the primary itself; absent: all oftargets),wait(optional seconds, 0–600, default 0). - Preconditions: the date is complete on
dest(no incomplete marker). Else the answer is{"ok":false, "waiting":true, "error":"… is not complete on … (its run has not finished there; it is copied once the run finishes or this PC closes it)"}: accepted, not a failure. The job is kept and the date is copied once its run finishes or this PC closes it as a dead run, while the grant is good; show it waiting and check withreplicas. Testwaiting, not the text. Send it as the last request of your run there, afterunmark. A target on the primary itself is an error ("send it with dests (fan-out)"). - What it does: keeps a job for the date (
<data>/: the grant and each target's state, never a key) and starts copying to every target at once. The copies go on after the source hangs up; targets that cannot be reached are retried every minute, also after the grant's time (catch-up, up to 90 days after it was issued). Jobs whose drives are all done or failed are kept 30 days forreplica- jobs/ <machine>/ <date>. json replicas. - Answer: while
waitruns, a progress frame every second{"ok":true, "progress":true, "replicas":[…]}; then{"ok":true, "machine", "date", "replicas":[Replica]}when every target is done, failed or waiting for an unreachable PC, or afterwait. - Sending
replicateagain for a date (the date grew, or a fresh grant) updates the job and checks every named drive again; files already there are not sent again.
Replica:
| Field | Meaning |
|---|---|
pc, dest | The target PC and drive id. |
drive | The drive's name, e.g. OFFICE-NAS /mnt/backup1. |
state | done (whole date there, verified, marker removed), waiting (PC off, drive not connected, transfer broke, or being copied now), failed (refused, no room, an older version), resend (replicate 2: no PC holds the date complete for it, error says what is missing where; the source sends the date to that drive itself, its normal run). Count a drive as holding the date only when done. |
since | When the state was set (ISO 8601 UTC). |
error | Why it is not done. |
full | true: the target has no room. |
files, bytes | With done: what the date holds. |
copying | With waiting: being copied right now. |
grantExpired | With waiting: the grant ended and that drive needs a new one (its PC runs replicate 1, or the grant is more than 90 days old); send replicate again with a new grant. Without it a waiting drive is finished by the primary (catch-up). |
keep | That drive's PC max number of backups (its own setting; the effective keep there is min(keep, the phone's grant keep), see replication.md "The PC's keep count"); absent when the primary does not know it. |
{"op":"replicate", "dest":"5B7E19A0C3D2", "cf":true, "date":"2026-10-17", "wait":60,
"grant":{"payload":"eyJ2IjoxLCJraW5kIjoic3BhY2ViYWNrdXAtcmVwbGljYXRlIiwi…", "sig":"MEUCIQD…"},
"alsoTo":[{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4"}]}
{"ok":true, "machine":"Annas-iPhone", "date":"2026-10-17",
"replicas":[{"pc":"OFFICE-NAS", "dest":"3F9A1C07B2E4", "drive":"OFFICE-NAS /mnt/backup1", "state":"done",
"since":"2026-10-17T10:04:12.0000000Z", "files":312, "bytes":1288490188}]}
replicas#
- Direction: source → primary PC. Needs:
replicate1. Auth: company channel; only a machine asks about itself (machinemust be the caller). - Request:
date,machine(optional; default: the caller). Withrearrange: true: see replicas for a rearrangement. - Answer:
{"ok":true, "machine", "date", "replicas":[Replica]}; an unknown date isreplicas: [].
{"op":"replicas", "date":"2026-10-17"}
replica.begin#
The primary starts writing a date on one target drive (one connection per target).
- Direction: primary PC → target PC. Needs:
replicate1 (datefor a rearrangement needsrearrange1). Auth: company channel; the grant; the caller must be the grant'sprimary; this PC anddestmust be in the grant'stargets(for a rearrangement: into, anddateamong its dates). - Request:
grant,dest,cf,date(a rearrangement only; a replication grant names its date),partial(optional,partial1: the source copy is partial;replica.endcloses this copy partial too; an older target ignores it and closes the copy complete). - What it does: marks the date incomplete on that drive. One writer per drive, machine and date at a time (else an error).
- Answer:
prev: the latest complete earlier date of that machine on the drive (hard links come from it), ornull.
{"op":"replica.begin", "grant":{"payload":"eyJ2Ijox…", "sig":"MEUCIQD…"}, "dest":"3F9A1C07B2E4", "cf":true}
{"ok":true, "prev":"2026-10-16"}
replica.files#
- Direction: primary → target, after
replica.beginon the same connection (elseNo replica.).begin on this connection - Request:
files([[rel, size, mtimeTicks, hash]], at most 2,000 per frame;hashfrom the primary's manifest, or read),last(trueon the last frame). - Answer:
{"ok":true}for each frame; for the last one{"ok":true, "need":[rel], "linked":<n>, "kept":<n>}. The target keeps files already there with the same size, mtime and hash (an interrupted copy resumes where it stopped), hard-links fromprevwhat is the same there, removes files the date no longer has, and asks for the rest.{"ok":false, "full":true, "error":"Not enough room on …"}when the drive cannot take what it needs;{"ok":false, "full":true, "nearlyFull":true, "error":"… is nearly full (12 GB left)"}when it is nearly full and something would be copied (0.16.10; the primary waits,skipped: "nearly full").
{"op":"replica.files", "files":[["Photos\\2026\\10\\IMG_1301.HEIC", 2381044, 639278252430000000, "9c1e4be0d22f4a7f8b3c6d5e4f3a2b1c"]], "last":true}
{"ok":true, "need":["Photos\\2026\\10\\IMG_1301.HEIC"], "linked":288, "kept":23}
replica.put#
- Direction: primary → target, for each file in
need. - Request:
rel(must be in the list),size,mtime,hash. - Answer:
{"ok":true, "have":<bytes>, "block":8388608, "blocks":[hash,…]}(bytes of an interrupted earlier copy kept there). The primary then sends{"op":"from", "offset":<n>}(resuming after the blocks matching its copy), data frames,{"op":"commit"}. - Final answer:
{"ok":true};{"ok":false, "verify":true, "error":"…"}when what was written and read back does not havehash;{"ok":false, "error":"…"}for a write error.
{"op":"replica.put", "rel":"Photos\\2026\\10\\IMG_1301.HEIC", "size":2381044, "mtime":639278252430000000, "hash":"9c1e4be0d22f4a7f8b3c6d5e4f3a2b1c"}
replica.end#
- Direction: primary → target. Request: no fields.
- Answer:
{"ok":true, "files":<n>, "bytes":<n>}after the target checked every listed file is there with its size, wrote the manifest and removed the marker. Only now is the date complete on the target. An error names the file that is not complete.
{"op":"replica.end"}
{"ok":true, "files":312, "bytes":1288490188}
Rearranging#
When the phone's destinations change and the user chooses Rearrange, the phone has the PCs move the dates it already backed up to the new drives, PC to PC, and drop them from drives no longer chosen, never below one complete copy. A rearrangement is ordered by the phone with a signed rearrange grant; every PC that writes or removes anything checks it.
The rearrange grant#
Same envelope, signature, key lookup and time rules as the replication grant, another kind:
{"v":1, "kind":"spacebackup-rearrange", "machine":"Annas-iPhone", "primary":"ANNA-PC",
"from":[{"pc":"ANNA-PC","dest":"5B7E19A0C3D2"}, {"pc":"BOB-PC","dest":"8C21D0E5F7A9"}],
"to":[{"pc":"BOB-PC","dest":"8C21D0E5F7A9"}, {"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4","plain":true}],
"dates":"all", "issued":"2026-10-18T10:00:00Z", "expires":"2026-10-18T16:00:00Z"}
from: the drives that held the dates under the old choice.to: the new choice. A drive in both keeps its copies.plain: trueon atodrive: Not encrypted there; absent: encrypted.dates:"all"or a list of dates.primary: the PC the phone sends it to. Every other PC acceptsreplica.*under this grant only from that PC.- PCs never convert between encrypted and plain (they hold no key): such a drive gets state
resendand the phone sends those dates there itself. - Refusals name it a rearrange grant:
No rearrange grant: a rearrangement needs the source's signed grant,Bad rearrange grant: …(no from drives,no to drives,bad dates, …),Annas-,iPhone's rearrange grant has expired The rearrange grant is not signed by Annas-,iPhone's device key 2026-. A replication grant sent to10- 16 is not in Annas- iPhone's rearrange grant rearrangeis refused withA replication grant does not allow a rearrangement; toreplica.*from a rearrangement's primary, withNot a rearrange grant. A payload whosekindis neither isBad replication grant: neither a replication nor a rearrange grant(Bad rearrange grant: …when sent torearrange).
rearrange#
- Direction: phone → primary PC. Needs:
rearrange1. Auth: company channel; a rearrange grant; the caller is itsmachine; itsprimaryis this PC. - Request:
grant,cf(optional, defaulttrue),wait(optional, 0–600 seconds). - What it does: keeps one job per machine (
<data>/). A grant issued later replaces it (dates already moved stay where they are); an older one is refused ("A later rearrangement … is in progress"); the same grant again re-checks what waits. Across PCs the later grant wins too: a PC asked (replica- jobs/ <machine>/ rearrange. json replica.*) under an older grant than its own rearrangement of the machine refuses withsuperseded: trueand the asker ends its job; asked under a later one, it ends its own. An ended job copies and drops nothing more: its opentodrives arefailedwith the reason,supersededsays it,stateisdone. For each date: copy to eachtodrive from a complete copy in the form it wants on any drive of the grant, the primary's own or another PC's (read withreplica.list/replica.read, written withreplica.begin…replica.end); only a form no drive holds isresend(while a PC that may hold it is off, the drive waits, for at most 7 days, settingrearrange-wait-days, thenresend); check drives of the other form withreplica.has, then drop fromfromdrives not into(replica.drop) only after everytodrive is done or failed, at least one done and just checked complete. Runs on after the phone hangs up and every minute while the grant is good. - Answer: progress frames (the same object with
"progress":true) every second duringwait, then:
| Field | Meaning |
|---|---|
machine, issued | The job's machine and grant time. |
state | done, working (a pass is running), waiting (for a PC, a drive or the phone), grantExpired (also while a pass is running: send rearrange again with a new grant: past its time the primary goes on copying (catch-up); only the drops, a drive whose PC runs replicate 1, or a grant more than 90 days old need the new one), none (no job). |
dates[] | {date, state, from, to:[{pc, dest, drive, state, error?, full?, skipped?, items?, keep?}], dropped:[drive], error?}; date state: done, waiting, resend, failed; from: the drive the primary copies it from; per to drive done / waiting / resend / failed / skipped (outside the effective keep: min(keep, grant keep)); skipped: "nearly full" on a waiting drive that is nearly full (0.16.10: no failure, moved when it clears); keep: that drive's PC max number of backups, absent when unknown. |
rearranged[] | {drive, items}: files the job verified on each to drive so far. |
elsewhere[] | {date, drives:[drive]}: dates on no drive of the primary; send another rearrangement with that PC as primary. |
superseded | Present when a later rearrangement of the machine on another PC ended this job: replaced by <machine>'s later rearrangement on <PC> (issued …Z). |
{"op":"rearrange", "grant":{"payload":"eyJ2IjoxLCJraW5kIjoic3BhY2ViYWNrdXAtcmVhcnJhbmdlIiwi…", "sig":"MEQCIF…"}, "wait":30}
{"ok":true, "machine":"Annas-iPhone", "issued":"2026-10-18T10:00:00Z", "state":"waiting",
"dates":[{"date":"2026-10-16", "state":"waiting", "from":"ANNA-PC D:",
"to":[{"pc":"BOB-PC","dest":"8C21D0E5F7A9","drive":"BOB-PC E:","state":"done","items":540},
{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4","drive":"OFFICE-NAS /mnt/backup1","state":"resend"}],
"dropped":[]}],
"rearranged":[{"drive":"BOB-PC E:", "items":540}]}
forms#
- Direction: phone → any PC. Needs:
forms1. Auth: company channel; the caller sees only the requests for itself. - Why: the PCs show each drive's encryption per phone and the user can ask for the other form there (Windows: Encrypt… / Don't encrypt…,
sbctl dest encrypt). A PC cannot encrypt or decrypt a phone's files, so it records the wanted form and the phone makes the change, as its own lock toggle does: its choice for that drive, then a rearrangement withplainon thattodrive. The PC shows the drive Pending — waiting for <device> until the drive holds the device's backups in that form (replication.md, "A PC asks the phone to change a drive's form"). - When: after a
formschanged push, and when the phone connects for a backup run. - Request:
answers(optional):[{pc, dest, requested, accepted, error?}];accepted: falsedeclines that request (error: why, in the phone's words; the PC shows it); an answer for anotherrequestedtime than the request's is ignored. - Answer:
{ok, machine, wanted:[{pc, dest, drive, plain, requested}]}: the pending requests of this PC for the caller;pcanddestname the drive as a rearrange grant does;plain: true= Not encrypted,false= Encrypted.
{"op":"forms"}
{"ok":true, "machine":"Annas-iPhone",
"wanted":[{"pc":"BOB-PC", "dest":"8C21D0E5F7A9", "drive":"BOB-PC E:", "plain":false, "requested":"2026-10-26T15:00:00Z"}]}
photos.work#
- Direction: phone → any PC. Needs:
work-mark1. Auth: company channel (a member's device; a guest has a channel of its own and never reaches it). - Why: the user's work mark (albums.md, "The user's work mark") is kept on the account service (
POST work/marks, chapter 9); a phone without an account connection at the moment hands its marks to a PC, which sends them as its own member and keeps them in its marks cache at once (the next/api/itemsand the PC's albums follow them). - Request:
marks:[{source, id, work}],sourcethe backups' device name,idthe item's id there (each 1–200 characters, no control character),worktrueorfalse; at most 5,000 (sent to the service 500 at a time). - Answer:
{ok: true, changed, v}: how many marks the service changed and the company's mark version;{ok: false, error}when the PC is not signed in or the service refuses.
{"op":"photos.work", "marks":[{"source":"Annas-iPhone", "id":"77ab0123456789ab", "work":false}]}
{"ok":true, "changed":1, "v":1234}
photos.requests#
- Direction: phone → any PC. Needs:
photoreq1. Auth: company channel; the caller sees only the requests for itself. - Why: a PC's Photos window offers Delete…, Caption… and Public link… on the phone's own items, but the phone owns its backups (it writes every month index again with its next backup, keeps its own captions, and an encrypted date is unreadable on the PC). So the PC records the request and the phone does it as its own viewer would: delete → move the item to Deleted (
setDeleted, thenmovetoDeleted); caption → set its own caption, written with the next backup; link → its share link. The PC shows Pending, waiting for <device> until the answer (desktop-photos.md, "Asked of the phone"). - When: after a
formschanged push (the PC sends that topic for these too), and when the phone connects for a backup run. - Request:
answers(optional):[{id, accepted, error?, url?}];accepted: falsedeclines (error: why, in the phone's words);url: the link alinkrequest made (https only); an id that is not a pending request of the caller is ignored. - Re-send (
resend1):wantedalso lists{id: "rs_: a file of the phone's backup this PC found damaged with no good copy on any drive or computer. The phone reads the item (…", op: "resend", date, rel, size, cause, requested, hash?, item?} item, else the filerelnames) from its library again and uploads it with its next run, sending that file even though it looks unchanged (the PC'sputreplaces the damaged name only once the new copy verified), then answers{id, accepted: true}. It answers{id, accepted: false, gone: true, error}when the library no longer has the item, and{id, accepted: false, same: true}when the library's bytes have the same hash ashash(damaged on the phone too). Any otheraccepted: false(an older app's "needs an update") leaves it pending: it is asked again under a newid. See Re-sending a damaged copy. - Answer:
{ok, machine, wanted:[{id, op, item, caption?, requested}]}:opisdelete,captionorlink, and withphotoreq2archive(archive it in the backups, kept on the phone: its next backup moves it intoArchived) orunarchive(its Put back out ofArchived; one request per item witharchive, the later replacing the earlier); a phone declines an op it does not know;itemthe phone's asset id (the index'sid);captiononly forcaption(""clears it).
{"op":"photos.requests", "answers":[{"id":"pa_3f2a9c1d0b7e6a54", "accepted":true, "url":"https://spacebackup.net/l/abc"}]}
{"ok":true, "machine":"Annas-iPhone",
"wanted":[{"id":"pa_77c1e0a9d2b34f10", "op":"caption", "item":"0123456789abcdef", "caption":"Dinner at the pier", "requested":"2026-10-26T17:40:00Z"}]}
resend.answer#
A computer or Mac source's answers to the resend of prepare, after its run.
- Direction: PC → PC. Needs:
resend1. Auth: company channel; only the source a request is for answers it. - Request:
sent(ids copied again: the copy landed and verified),gone(ids no longer in the source folder),same(ids whose source bytes have the damaged copy's hash),error(optional, the source's words). - Answer:
{"ok":true, "answered":<n>}; an id that is not a pending request of the caller is ignored.
{"op":"resend.answer", "sent":["rs_3f2a9c1d0b7e6a54"], "gone":[]}
Re-sending a damaged copy#
Vladimir's rule (2026-11-10): a damaged backup copy (cut short, unreadable, not what was backed up, missing on every
drive) is sent again by the device it came from, automatically; the user never presses Fix. The processing watchdog,
the scrub and the audit find it; a good copy on another drive or computer heals it first (the scrub's repair). Only when
no good copy is left does the PC holding it record a request (rs_…, kept in resend-requests.json in its data folder)
for the source, the date, the file and its hash, and wake the source with the silent forms changed push.
A phone or tablet reads it with photos.requests, a computer or Mac with its next run's
prepare; the request stays pending, pushed again every 6 hours, until the source answers. A file sent
again is checked by the next watchdog or scrub pass: read right, the request is done; still damaged, it is asked once
more, then given up. The user is told (once, naming the files) only when the source answered gone, when its own bytes
are the damaged ones, when it was still damaged after two sends, or when 3 days passed without an answer; never while a
re-send is on its way. An original a GPU worker analysed (it has a picture vector) is not damaged: what this PC's
probe cannot read there is a decoder gap of ours, and the device is not asked. Details: docs/resend.md.
replicas for a rearrangement#
- Request:
{"op":"replicas", "rearrange":true, "machine"?}. Needs:rearrange1. Auth: only the machine itself. - Answer: the job as
rearrangeanswers it; no job:{"ok":true, "machine", "state":"none", "dates":[]}.
replica.dates#
- Direction: primary → PC holding a
fromortodrive. Needs:rearrange1. Auth: a rearrange grant naming the caller asprimary;destinfromorto. - Request:
grant,dest,cf. Answer:dates: [{date, complete, partial}](the machine's dates there covered by the grant;complete: no incomplete marker;partial(partial1): closed after a stopped run, so it never counts toward a keep).
{"op":"replica.dates", "grant":{"payload":"eyJ2Ijox…", "sig":"MEQCIF…"}, "dest":"8C21D0E5F7A9", "cf":true}
{"ok":true, "dates":[{"date":"2026-10-15","complete":true,"partial":false}, {"date":"2026-10-16","complete":true,"partial":true}]}
replica.has#
- Direction: primary → PC. Needs:
rearrange1. Auth: asreplica.dates;dateamong the grant's dates. - Request:
grant,dest,cf,date. - Answer:
exists,complete(no marker, a manifest, every file of it there with its size),form(plain,encrypted,mixedornull; an encrypted date's plainIndex/matchkeys.jsonis of the encrypted form),files,completed(when the manifest was written, UTC; absent when none).
{"ok":true, "exists":true, "complete":true, "form":"encrypted", "files":540, "completed":"2026-10-16T21:14:09.0000000Z"}
replica.drop#
- Direction: primary → PC. Needs:
rearrange1. Auth: a rearrange grant naming the caller asprimary;dateamong its dates. - Request:
grant,dest,cf,date, and optionallyform.- Without
form: removes the whole date fromdest, which must be infromand not into; refused while the date is being written there. - With
form(plainorencrypted, the old form):destmust be intowith the other form; only when the date is complete there, holds both forms (mixed) and was completed after the grant'sissued, and (rearrange3) every file of the old form has its twin in the new one (the form check): the old form's top folders and their manifest entries go. A file without a twin: nothing goes,missingsays how many, logged there as "Rearrange: kept the <form> form of <machine>'s <date> on <drive>: N item(s) not yet in the new form"; the primary marks that driveresendand asks again on later passes.
- Without
- Answer:
{"ok":true, "dropped":<bool>, "missing":<int>}(droppedfalse: nothing was there, ormissing> 0;missingonly withform, fromrearrange3). Refusals arerefused: true, e.g. "… is one of Annas-iPhone's new drives: it keeps its dates".
{"op":"replica.drop", "grant":{"payload":"eyJ2Ijox…", "sig":"MEQCIF…"}, "dest":"5B7E19A0C3D2", "cf":true, "date":"2026-10-16"}
{"ok":true, "dropped":true}
replica.list#
- Direction: primary → PC holding a
fromortodrive. Needs:rearrange2. Auth: asreplica.has. - Request:
grant,dest,cf,date,skip(files already listed). - Answer: the date's files on that drive, for the primary to copy it to a new drive:
form,total,files([rel, size, mtimeTicks, hash], up to 2000 fromskip),partial(partial1: the copy is partial; the new one is closed partial). Only a complete copy in one form (plainorencrypted); otherwise an error. Withany: true(rearrange3): whatever the date folder holds, either form or both (formmay bemixed), hashes0, for the form check before a drop.
{"ok":true, "form":"plain", "total":540, "files":[["Photos\\2026\\10\\IMG_1234.HEIC", 2811904, 638650000000000000, "9f1c…"]]}
replica.read#
- Direction: primary → PC. Needs:
rearrange2. Auth: asreplica.has. - Request:
grant,dest,cf,date,rel,offset,count(at most 1 MiB). - Answer:
{"ok":true, "n":<bytes>}, then one data frame ofnbytes (none whennis 0: the end of the file). The new drive checks every file's hash as it is written.
The form check#
iOS request #54 (rearrange 3). A PC cannot read the phone's encrypted names or its encrypted month index, so a file of one form is paired with its twin in the other by what encryption keeps: each encrypted name is base32 of a 16-byte SIV and the name, so its length gives the plain name's length in bytes (a long name stored as ~<SIV> matches any); an encrypted file's size is 60 + plain path bytes + plain size + 28 × chunks of 1 MiB; both forms carry the asset's modification date. A file below a top folder's year and month (Photos, Thumbs, Archived, Deleted) needs one twin with the same name lengths, that size and an mtime within 2 s; the files right below a top folder (the month indexes, rewritten by PCs in a plain copy) are counted by name length, the new form needing at least as many; in the same form, paths are compared. The primary runs the same check before a from drop, between that copy (replica.list {any}) and every done to drive.
Onward copies#
Vladimir, 2026-11-06: "if a backup went to one drive, the app on the destination PC should be able to copy that backup to other destination drives". Whatever drive of a PC holds a date of another machine complete, that PC copies it, bytes as stored (encrypted stays encrypted, no key moves), to every other drive the machine's backups go to: its own drives and the other PCs'. The source never has to be online. What says where they go is signed by the source: its destinations grant, else (a phone) its latest rearrange grant's to drives within that grant's catch-up time. Copies only: nothing is dropped or converted. Details: docs/replication.md#onward-copies.
The destinations grant#
The replication grant's envelope, key and signature, with kind spacebackup-destinations, no primary and no date:
{"v":1, "kind":"spacebackup-destinations", "machine":"easytags-mbp",
"targets":[{"pc":"CHIA2","dest":"<dest id>","rels":["Users\\vlad\\Documents"]}, {"pc":"CHIA3","dest":"<dest id>","plain":true}],
"keep":30, "issued":"2026-11-06T10:00:00Z", "expires":"2027-02-04T10:00:00Z"}
rels: a computer's folders on that drive (their places in a date folder; only those files go there); absent: the whole date. plain: a phone's Not encrypted drive (only a plain copy goes there; absent: only an encrypted one). Valid at most 400 days; a computer signs one for 90 days at each run and puts it in the placement file it stores on every drive it reaches (placement, field Destinations); a phone sends it with replica.destinations. A later one replaces an earlier one; every PC that is asked under it keeps it, so the PCs holding the machine's drives all learn it.
replica.spread.dates#
- Direction: PC holding a date → PC of a target drive. Needs:
spread1. Auth: company channel, any PC; a destinations grant or a rearrange grant namingdest. - Request:
grant,dest,cf. Answer:{"ok":true, "dates":[{"date", "complete", "partial", "digest"}]}, every date of the machine there.digest(spread2): of a complete date's manifest (XxHash128 of its paths and sizes, sorted); the asking PC compares it with its own copies and asksreplica.spread.fileswhen they differ (request #157).
replica.spread.files#
- Direction: as
replica.spread.dates. Needs:spread2. - Request:
grant,dest,cf,date. Answer:{"ok":true, "files":[[rel, size], …]}: a complete date's files there as its manifest lists them (empty: none, or being written). The asking PC copies what one of its complete copies holds and the drive lacks withreplica.spread.begin, only those files.
replica.spread.begin#
- Direction: as
replica.spread.dates. Needs:spread1. - Request:
grant,dest,cf,date,partial(optional). Answer:{"ok":true, "prev":<date or null>}; thenreplica.files,replica.putandreplica.endas a replica. Files already there stay, also those the sender does not list (another form, a computer's folders from another holder). Refused while a run writes that date there (… is being written on <drive>: copied once that run finishes).
audit.local#
- Direction: PC → PC. Needs:
audit1. Auth: company channel, any PC. - Request:
device,date,lists(all optional). Answer:{"ok":true, "local":{…}}: what this PC's drives hold of every machine (each date folder: complete, partial, writing, form, files, bytes, manifest digest, the scrub's damaged files; withlists, the files and a size check), the backups each drive keeps of each machine, and the placement records this PC keeps (each item's drives and the form wanted on each; what it found is recorded first). The asking PC puts the company report together (the backup audit).
audit.fix#
- Direction: PC → PC. Needs:
audit1. Auth: company channel, any PC. - Request:
machines. Answer:{"ok":true, "queued":[…]}: the onward copies of those machines start now on this PC (holes looked at again), from its good copies in the form wanted on each drive; nothing deleted, converted or overwritten.queued: the machines this PC keeps a grant of.
replica.destinations#
- Direction: device → PC, or PC → PC. Needs:
spread1. Auth: company channel; the grant's signature by the machine's key. - Request:
grant(a destinations grant within its time). Answer:{"ok":true, "kept":<bool>}(true: later than the one kept; its drives are looked at at once).
Reading and browsing#
Devices read backups back with dates, list, stat, read and readmany. None of them takes a job slot or moves anything, so browsing never waits behind backups. A device reads its own folder freely (plain and encrypted, as stored). Another machine's folder is served only after a grant on the same connection: then its whole folder, read-only, encrypted trees as ciphertext (the reader needs the data key) and plain folders as they are. Without a grant: {"ok":false, "refused":true, "needsGrant":true, "error":"<machine>'s backups are served only after a grant (a ticket from the account service)"}.
list and stat with machine are described above.
dates#
- Direction: device → PC. Needs:
read1. Auth: company channel; own folder, or a grant. - Request:
dest,cf,machine(optional). - Answer:
dates(that machine's date folders on the destination, in thecflayout asked),incomplete(those holding the marker),partial(partial1: those closed after a stopped run; complete, shown "partial"). Ask with bothcfvalues to find every date.
{"op":"dates", "dest":"3F9A1C07B2E4", "cf":true, "machine":"Annas-iPhone"}
{"ok":true, "dates":["2026-10-15","2026-10-16","2026-10-17"], "incomplete":["2026-10-17"], "partial":["2026-10-16"]}
read#
A byte range of one file.
- Direction: device → PC. Needs:
read1. Auth: company channel; own folder, or a grant. - Request:
dest,cf,machine(optional),date,rel,offset(default 0),length(default: to the end). - Answer: head
{"ok":true, "size":<whole file>, "offset", "length":<what will be sent>, "mtime":<ticks>}, data frames of up to 1 MiB,{"ok":true, "done":true, "sent"}.offset= size gives nothing; past the end or negative is an error. A missing file is{"ok":false, "missing":true, "error":"No such file: <rel>"}. A read error after the head ends with{"ok":false, "error"}instead of the done frame. - Requests may be pipelined.
{"op":"read", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-10-16", "rel":"Photos\\2026\\10\\IMG_1234.HEIC", "offset":0, "length":1048576}
{"ok":true, "size":2381044, "offset":0, "length":1048576, "mtime":639277705310000000}
…one data frame…
{"ok":true, "done":true, "sent":1048576}
video.copy#
A phone's H.264 copy of a video it cannot decode (an iPhone's Dolby Vision / 10-bit HEVC HLG on a phone whose HEVC decoder is 8-bit only).
- Direction: device → PC. Needs:
video-copy1. Auth: company channel; asread(own folder, or a grant), or an album file with itsticketasalbum.read. - Request: the item as
readnames it (dest,cf,machineoptional,date,rel), orticket,album,name,dest(optional) asalbum.read;start(default true): start making it when it is not there;decodes(optional):{"hevc10":false}says the phone cannot decode 10-bit HEVC, and the PC makes the copies ahead as for a TV (sent alone, with no file, it is answered{"ok":true, "ahead":true}). - Answer:
{"ok":true, "state":"ready", "size", "seconds", "width", "height"}(the copy exists;sizeis whatvideo.copy.readsends);{"ok":true, "state":"making", "seconds", "done"}(being made now, ahead of the TV copies;done: seconds encoded so far; ask again every ~2 s);{"ok":true, "state":"none", "why"}withwhyone ofencrypted(this PC lacks its data key; an encrypted file is decrypted with a key this PC holds: the caller's own backups, another machine's under a grant, album files),no ffmpeg,not a video,failed,too long(over 10 minutes),not made(start:false). A missing file is{"ok":false, "missing":true, "error"}. - The copy is the TV copy: H.264 8-bit SDR (HDR tone-mapped when the PC's ffmpeg can), AAC, at most 1920 px, upright, at most 6 Mbit/s; a normal MP4 with its moov first (seekable; the fragmented encode if the remux fails; a fragmented TV copy made ahead is remuxed the first time a phone asks,
makingfor a second or two); one copy for the TVs and the phones (a copy made ahead for the TVs isreadyat once), kept with the TV copies, encrypted at rest. At most two are made at a time.
{"op":"video.copy", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-10-22", "rel":"Photos\\2026\\10\\IMG_4713.MOV"}
{"ok":true, "state":"making", "seconds":18.4, "done":6.2}
video.copy.read#
A byte range of a ready copy (video.copy answered ready), sent as read sends a file.
- Direction: device → PC. Needs:
video-copy1. Auth: asvideo.copy. - Request: the item as
video.copy,offset(default 0),length(default: to the end; the phone asks 1 MiB). - Answer: head
{"ok":true, "size":<whole copy>, "offset", "length"}, data frames of up to 1 MiB,{"ok":true, "done":true, "sent"}. Not ready:{"ok":false, "making":true, "error"}while it is made,{"ok":false, "missing":true, "error"}when there is none,{"ok":false, "encrypted":true, "error"}when the original is not decrypted for this caller.
readmany#
Several whole files of one date in one request: a screenful of thumbnails in one round trip.
- Direction: device → PC. Needs:
read3. Auth: asread, checked once for the batch. - Request:
dest,cf,machine(optional),date,rels(at most 64, all in that date folder). - Answer, for each rel in the order asked: a head
{"ok":true, "rel", "size", "mtime"}, its data frames (≤ 1 MiB),{"ok":true, "done":true, "sent"}(withok: falseanderrorin that end frame when the disk failed mid-file). A file that cannot be served is one frame{"ok":false, "rel", "missing":true, "error"}or{"ok":false, "rel", "error"}, and the batch goes on. Last:{"ok":true, "done":true, "all":true}. - Whatever fails the whole batch (no grant, unknown or offline destination, bad date, no
rels, more than 64) is a single{"ok":false, "error", …}withoutrel, and nothing else follows.
{"op":"readmany", "dest":"3F9A1C07B2E4", "cf":true, "date":"2026-10-16",
"rels":["Thumbs\\2026\\10\\IMG_1234.HEIC.jpg", "Thumbs\\2026\\10\\IMG_1235.HEIC.jpg"]}
{"ok":true, "rel":"Thumbs\\2026\\10\\IMG_1234.HEIC.jpg", "size":35120, "mtime":639277705310000000}
…data frame, {"ok":true,"done":true,"sent":35120}, the next file…
{"ok":true, "done":true, "all":true}
cancel#
- Direction: device → PC, while a
readmanyis being answered. Needs:read3. - Request:
{"op":"cancel"}. Never answered. The PC stops the readmany after the current data frame: a file cut short ends with{"ok":true, "done":true, "sent", "cancelled":true}, then{"ok":true, "done":true, "all":true, "cancelled":true}. Keep reading up to thatallframe; the connection stays usable. Acancelthat arrives after its readmany ended is ignored.
Sharing: read tickets#
A share of a device's backups (or an approved restore) lets another member's devices read that device's backups from any PC holding them (see Sharing a device's backups).
- The reader gets a ticket:
POST /→account/ api/ peer- tickets {"sourceDevice"} {ticket, sourceDevice, sourceName, reason, expires}(1 hour, for that reader device and source). - The reader sends
granton its connection to the PC. - The PC confirms the ticket with
POST /(its own device token) and caches the answer (yes 5 minutes, no 1 minute). A stopped share stops being served within 5 minutes.account/ api/ peer- tickets/ check
grant#
- Direction: reader device → PC. Needs:
read2. Auth: company channel; a ticket the account service confirms for this connection's peer name. - Request:
ticket. - Answer:
{"ok":true, "machine":<the source's folder name>, "until":<when the PC checks again>}. From now on, on this connection,dates,list,stat,readandreadmanywith thatmachineserve its whole folder. Several grants on one connection are fine (one per machine). - Errors:
{"ok":false, "refused":true, "error"}: the service said no (no live share or approved restore, ticket expired or unknown) or the ticket is another device's ("This ticket was given to BOB-PC, not to Annas-iPhone").{"ok":false, "error"}withoutrefused: the PC could not ask the service; try later or another PC. A PC not signed in answers "This PC is not signed in to the account service and cannot confirm a ticket".
{"op":"grant", "ticket":"pt_Q2x7mR4vK9…"}
{"ok":true, "machine":"ANNA-PC", "until":"2026-10-17T10:12:00Z"}
Albums#
An album is a plain copy of chosen photos and videos, kept on one or more album drives of the company's PCs (see Albums). On a drive: <root>/, the items' files flat beside it, thumbnails under Thumbs/<file>.jpg. Album ids are al_ + 16 base32 characters.
Album tickets and who may do what#
Every album.* request carries ticket: an album ticket from the account service (POST /, valid 1 hour, bound to the calling device), or a relay ticket (30 days, bound to a PC, for its transfer jobs). The PC confirms it with POST /, cached as above. One exception to the 5 minutes: when a write names a drive (dest, dests, alsoTo) that the cached yes does not list, the PC asks the service again before refusing (at most once per 10 seconds per ticket). The confirmed ticket says who asks, the album, its owner, the caller's access and the album's drives.
| Access | Who |
|---|---|
owner | A device of the album's owner. |
member | A device of a member it is shared with (view and save). |
member-add | The same, with members can add on: may add, clone in, remove and caption what they added (memberDevices: that member's device names). |
relay | A PC's relay ticket for its transfer jobs (a member's relay ticket also names the member; a filter's names filterMachines). |
filter | A PC filling an album by its standing filter (iOS request #57, POST /): filterMachines, the devices whose items it adds. |
guest | Someone outside the company; only on the guest channel. |
| Request | Allowed |
|---|---|
album.list, album.read, album.readmany | The ticket's own device, owner or member. |
album.add | The ticket's own device, owner or member-add. |
album.put | A filter ticket's own PC, of an item whose source is one of filterMachines (addedBy is the album's owner, whatever is sent); a PC passing on the owner's request for an album drive on this PC; a PC passing on a member-add member's add (one of the album's PCs, or a PC that is not one of that member's own devices); a PC's relay ticket for its own jobs. A member's device never sends it itself. The phone-shaped form (meta): the device owning a public album, into that album; from album 9 also any device of the member who owns an ordinary album, into it (never an album shared with them; below). |
album.remove, album.caption | The ticket's own device, owner or member-add (a member: only items whose addedBy is theirs); a PC passing on such a request; a relay ticket. Never member or a guest. |
album.delete | The owner's device; a PC passing on the owner's request; the owner's relay ticket. |
album.copy | The owner's device. |
album.status | The ticket's own device, owner or member. |
album.clone | The ticket's own device: owner or member-add of album, and from.ticket given to that same device, owner or member of from.album. A relay ticket serves neither. |
A relay ticket serves only album.put, album.remove, album.delete (and album.caption jobs) from that PC itself; for a deleted album only album.delete; a filter's relay ticket only album.put. A filter ticket serves nothing else either. Every write names destinations (dest/dests, this PC's ids); each must be one of the album's drives on this PC, else {"ok":false, "refused":true, "error":"CHIA2 G: is not one of this album's drives"}. A refused ticket is refused: true ("This album ticket was given to …", "This ticket is for another album", "Only the album's owner can change it", "An album request needs a ticket from the account service").
Item (in album.json): {id, source, files:[stored names], thumb, kind, created, place:{lat,lon}|null, added, size, addedBy?, caption?, <index fields>?}; kind is photo, video, live or file. An item is identified by (source, id): adding it again changes nothing. Item ids: 1–64 characters, letters, digits, -, _.
Item index fields#
album 8 (iOS request #53): modified, w, h, duration, types, camera, labels, text, colors, bright, description, transcript, frames, analysed, flat on the item, in the same shapes as the phone's month index (labels [[name, confidence]], camera {model, lens, iso, exposure, flash}, transcript {lang, text}, frames [[seconds, [[name, confidence]]]], analysed {by, at, v, what}), each absent when the source had none; at most 64 KB per item. Taken at album.add from what the device sends with the item, under the source's month index when the source is a plain date on that PC (the index wins); an encrypted source's index is never read. Carried by album.put, album.copy and album.clone. Items added earlier are filled at album.list from a source's plain, complete date on that PC (and written to album.json). A Space Vision analysis of the album copy merges into them as into a month index entry. Never the owner's private flags (favorite, archived, deleted, hidden), uploaded, edited, the index's caption, or anything about the owner's other devices: the PCs keep only the fields listed, whatever is sent.
Pushed drive (in answers that send to other PCs): {pc, dest, drive, state, ok, error?, added?, waiting?} with state done, waiting (kept as a transfer job on this PC for that PC; retried every minute for up to 30 days) or failed (refused); ok is true only for done.
album.add#
Makes plain copies of items from the caller's own backups on this PC, into the album on this PC's drives, and sends them on to album drives on other PCs.
- Direction: the item owner's device (a phone, or a PC for its own files) → a PC holding its backup. Needs:
album1 (pushedstates need 2). Auth: album ticket, own device,ownerormember-add. - Request:
ticket,album,dests(this PC's album drives; may be empty),items([{id, files:[rel], thumb?:rel, kind, created?, place?:{lat,lon}, <index fields>?}],rel= the file's plain path in the date folder,/or\; the index fields as the device has them,album8),key(optionaltrue),date(optional: only that date),alsoTo([{pc, dest}]),detach(optionaltrue,album7: answered at once, see PC-side jobs). - The lent key: with
key: true, one data frame of the 32 data-key bytes follows the request. It is used only for the caller's own.sbe-<key id>tree, held in locked memory, never written anywhere, and dropped when the add ends (after its last item, before the answer; also when the caller is gone or detached). Plain backups need no key. - What it does: each file comes from the newest date folder holding it (complete dates first); encrypted ones are decrypted with the lent key (every chunk authenticated, the stored path checked); plain ones are copied (never hard-linked, also on the same volume). Files are written as temp files, read back against their size and hash, then renamed into place. Items go on to
alsoTowithalbum.put; a PC that cannot be reached gets a transfer job (plain files only, never the key). - An item the album already has is answered in
alreadyand not written again. Fromalbum11 (iOS request #103), when it has no thumbnail there andthumbis now in the backup (plain, or encrypted with the lent key), the thumbnail is written in on those drives (its id also inthumbs) and sent on toalsoTowithalbum.putfillThumb(a transfer job for a PC that is off). So a phone that adds items as they land, before the month's thumbnails, sends the samealbum.addagain once its backup has ended; an older PC answersalreadyand leaves it without one. - Answer: progress frames
{"ok":true, "progress":true, "done":<items>, "of":<items>, "job"}at most once a second; then{"ok":true, "added":[ids], "already":[ids], "thumbs":[ids], "failed":[{id, error}], "pushed":[Pushed], "count":<items on this PC, or null without dests>, "job"}(jobsincealbum7). Sincealbum7 the add runs to its end whether or not the caller is still connected; withdetach: truethe only answer is{"ok":true, "accepted":true, "job", "of"}(PC-side jobs).
{"op":"album.add", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8", "dests":["5B7E19A0C3D2"], "key":true,
"items":[{"id":"9f2c41d07a8be613", "files":["Photos/2026/10/IMG_1234.HEIC","Photos/2026/10/IMG_1234.MOV"],
"thumb":"Thumbs/2026/10/IMG_1234.HEIC.jpg", "kind":"live", "created":"2026-10-13T18:02:11Z",
"place":{"lat":36.1147,"lon":-115.1728}}],
"alsoTo":[{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4"}]}
…one data frame of 32 bytes (the key)…
{"ok":true, "added":["9f2c41d07a8be613"], "already":[], "failed":[],
"pushed":[{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4","drive":"OFFICE-NAS /mnt/backup1","state":"done","ok":true,"error":null,"added":1,"waiting":0}],
"count":42, "job":"job_4be0c2a19f7d3e65"}
album.put#
One item into one album drive of this PC, its files streamed. Usually sent by a PC to another PC (the album's other drives); an owner's device may send it too, a member's device never.
- Direction: PC → PC, or the owner's device → PC. Needs:
album1 (queuedneeds 2,caption5). Auth: see the table. - Request:
ticket,album,dest,item({id, source, kind, created?, place?, files:[stored names], thumb:name|null, addedBy?, caption?, <index fields>?}),queued(when the item was asked for, ISO 8601; default now),fillThumb(optionaltrue,album11: the item brings a thumbnail and may be there without one),batch(optionaltrue,album12: one of a large put's items, see album.flush). - First answer:
{"ok":true, "thumbOnly":true, "thumb":<name>}(fillThumband the album has that item without a thumbnail, iOS request #103: send only the thumbnail, then the final answer; the item is otherwise kept as it is),{"ok":true, "already":true}(the album has that(source, id): send nothing),{"ok":true, "already":true, "removed":true}(it was removed there afterqueued: a late transfer never brings it back; send nothing), or{"ok":true, "files":[stored names], "thumb":<name|null>}(names may get a(2)suffix). - Then, for each file in order and then the thumbnail: its data frames (≤ 1 MiB), then
{"op":"end", "mtime":<ticks>, "hash":"<XxHash128>"}.{"op":"abort"}instead ends the item:{"ok":true, "aborted":true}, nothing kept. - Final answer:
{"ok":true, "count":<items>}after every file was read back against its hash and the item recorded;{"ok":false, "error"}(nothing kept). addedByis taken from the confirmed ticket for a member's add, never from the request; for a filter's put it is the album's owner.- A filter's adds (iOS request #57; Albums that fill themselves): the PC that judged a phone's new items
against an album's filter adds those that pass to the album's drives on itself (as
album.add, from plain dates) and sends them to the album's other PCs withalbum.putand itsfilterticket.
{"op":"album.put", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8", "dest":"3F9A1C07B2E4", "queued":"2026-10-17T10:20:00Z",
"item":{"id":"9f2c41d07a8be613", "source":"Annas-iPhone", "kind":"live", "created":"2026-10-13T18:02:11Z",
"place":{"lat":36.1147,"lon":-115.1728}, "files":["IMG_1234.HEIC","IMG_1234.MOV"], "thumb":"IMG_1234.HEIC.jpg",
"addedBy":"anna@acme.com"}}
{"ok":true, "files":["IMG_1234.HEIC","IMG_1234.MOV"], "thumb":"IMG_1234.HEIC.jpg"}
…data frames, {"op":"end","mtime":639277705310000000,"hash":"…"} per file…
{"ok":true, "count":43}
album.put from the owning device (public album)#
The phone's own plain copy of an item for a public link (iOS request #42): it
reads and decrypts the item itself and sends the plain file into its Shared publicly album (made with
POST /), with the same fields and data frames as the backup put. No key is lent.
The lent-key path (album.add) stays as it is for ordinary albums.
From album 9 (0.14.3, iOS request #67) the same put also goes into an ordinary album its member owns: the phone's
files shared into Space Backup from another app ("From other apps") are in no backup, so it sends them this way. Items
of its library still go through album.add. id is then the phone's own (x and 15 hex digits), source the device
and created from meta.created.
- Direction: the device owning the public album → PC. Needs:
album6. Auth: album ticket of that device; the service's check sayspublic: trueandpublicDevice= this connection's device. A request withmetais refused{"ok":false, "refused":true, "error":"not the album's device"}from any other device (the owner's other devices and members too). Into an ordinary album (album9): the service's check saysowner, that is the device is signed in as the member who owns the album; else (a member, an album shared with this device's member, another member's device){"ok":false, "refused":true, "error":"only the album's owner puts into it from a device"}(PCs before 0.14.3 answeralbum is not public). A ticket given to another device is refused as always ("This album ticket was given to …"). Every accepted put is logged on the PC: the device, the item, its bytes, the album. - Caps (0.14.3, every put with
meta):meta.sizeplus the thumbnail's over the PC's settingalbum-put-max-gb(default 4) → `{"ok":false, "refused":true, "reason":"too-big", "max":4294967296, "error":"IMG_1.MOV is 5.2 GB; CHIA2 takes files of up to 4 GB into an album from a phone"}`; an album drive of this PC that would keep less than 256 MB free → `{"ok":false, "reason":"no-space", "free":…, "need":…, "error":"Not enough free space on CHIA2's drive … Try again when there is room."}` (not refused: send it again later). Both come before any data. The file's first bytes must be a photo (HEIC/HEIF, JPEG, PNG, GIF, WebP, TIFF, DNG, camera RAW) or a video (MOV, MP4, M4V), the thumbnail a picture; else the put ends, after its commits, with `{"ok":false, "refused":true, "reason":"not-media", "error":"WA_2.PDF is not a photo or video; only these go into an album from a phone: …"}and nothing is kept.error` to the user.Show - Request:
ticket,album,id(the item's id in the album, 1–64 ofA-Z a-z 0-9 - _; the link names it),created? (ISO 8601; also taken insidemeta),meta:name: the file's name (one name, no folders; a(2)suffix is added when the album has it already)size: bytesmtime: UTC .NET ticks, as input(an ISO 8601 string is taken too)hash? XxHash128 of the plain file, 32 hex digits; normally it comes with the file'scommitinstead (as the backupput), and when both are given they must agreekind:photo,videoorlivemonth:yyyy-MMof the asset's creation (the item'screatedwhencreatedis not given)created? (ISO 8601),place?{lat, lon},caption?- the index fields? (
album8), as in the month index
thumb?{size, hash?, mtime?}: a thumbnail (JPEG) follows the file.dests? the album's drives on this PC to write (ordest, one; default: all of them that are connected).alsoTo?[{pc, dest}](default: every drive of the album on other PCs;[]: none). - First answer:
{"ok":true, "files":[stored name], "thumb":<name|null>}, or{"ok":true, "already":true, "count":<items>}(this device's item with that id is in the album;"removed":truetoo when it was removed from it). Afteralreadythe device sends nothing for this item (no frames, no commit); the PC reads the next request on the same connection. - Then: the file's data frames (≤ 1 MiB), then
{"op":"commit", "hash"}({"op":"end"}too;hashrequired unless meta has it); withthumb, its data frames and{"op":"commit"}.{"op":"abort"}instead:{"ok":true, "aborted":true}, nothing kept. - Final answer:
{"ok":true, "added":true, "count":<items>, "pushed":[{pc, dest, drive, state, ok, error?, added, waiting}]}after the bytes were checked againstsizeandhash, read back from disk and recorded on each drive here; then sent to the other PCs (album.put, a transfer job when one is offline).{"ok":false, "error"}(nothing kept), e.g. `12 bytes arrived, meta says 13,Verification failed: …. The item'ssourceis the device,addedBy` its member; the PCs then show and thumbnail it like any album item, and a public link names it as{"album", "id"}.
{"op":"album.put", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8", "id":"9f2c41d07a8be613",
"dests":["d1"], "alsoTo":[{"pc":"CHIA3", "dest":"e2"}], "created":"2026-10-03T18:02:11Z",
"meta":{"name":"IMG_1234.HEIC", "size":2481152, "mtime":639277705310000000, "kind":"photo", "month":"2026-10"},
"thumb":{"size":18342}}
{"ok":true, "files":["IMG_1234.HEIC"], "thumb":"IMG_1234.HEIC.jpg"}
…data frames, {"op":"commit", "hash":"8c1e…(32 hex)"}, thumbnail data frames, {"op":"commit", "hash":"02af…"}…
{"ok":true, "added":true, "count":12, "pushed":[{"pc":"CHIA3", "dest":"e2", "state":"done", "ok":true, "added":1}]}
{"ok":true, "count":7, "pushed":[{"pc":"OFFICE-PC", "dest":"5B7E19A0C3D2", "drive":"OFFICE-PC E:", "state":"done", "ok":true, "added":1, "waiting":0}]}
album.changes#
What was added to and removed from an album on this PC since a counter (#70): a device with the album open applies it instead of reading the album again. The same request and answer as backups.changes, for the part album:<album>.
- What the PC records (
changes2): before an album write that reaches this PC's drives (album.add,album.put,album.remove,album.copy,album.clone, also when passed on by another PC or as a transfer job) the album's items on its drives are noted; 2 s after the first write the album is read again and one record made: items new there underadd(asalbum.listgives them), items gone underremove(index ids). Only the drives that held the album before and after are compared (a drive plugged in or out is no change); an album new on this PC adds all its items. Each PC that holds a copy records what reached its own drives, under its own origin. Captions and renames are not #70 changes (they keepalbum:<album>withoutv).
- Direction: device → PC. Needs:
changes1. Auth: asalbum.list: the album ticket of its owner or a member; a guest on the guest channel (additems withoutsource). - Request:
ticket,album,since(optional). - Answer:
{"ok":true, "v", "changes":[{part, v, prev, at, add?: [items as album.orlist returns them], remove?: [index id]}, …]} {"ok":true, "v", "full":true}.
{"op":"album.changes", "ticket":"<album ticket>", "album":"al_5Kp9", "since":"a07d4c1e9b2f4e6d8c3a5b7f9e1d2c4a:40"}
album.list#
- Direction: owner's or member's device → PC. Needs:
album1. Auth: album ticket, own device. - Request:
ticket,album,dest(optional; default: the first drive of this PC holding the album). - Answer:
{"ok":true, "dests":[ids holding it], "dest", "album":<album.. Not on this PC:json>, "files":[[name, size, mtimeTicks]]} {"ok":true, "dests":[]}. The album's name is the service's (a rename reaches the file at its next change). Sincealbum8 each item has its index fields; items of a source with a plain date on this PC are filled from it first.
{"op":"album.list", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8"}
{"ok":true, "dests":["3F9A1C07B2E4"], "dest":"3F9A1C07B2E4",
"album":{"v":1, "id":"al_k3j9x2m4p7q1r5s8", "name":"Las Vegas", "owner":"anna@acme.com", "updated":"2026-10-17T10:20:04Z",
"items":[{"id":"9f2c41d07a8be613", "source":"Annas-iPhone", "files":["IMG_1234.HEIC","IMG_1234.MOV"],
"thumb":"IMG_1234.HEIC.jpg", "kind":"live", "created":"2026-10-13T18:02:11Z",
"place":{"lat":36.1147,"lon":-115.1728}, "added":"2026-10-17T10:20:04Z", "size":5123456,
"addedBy":"anna@acme.com", "caption":"Dinner at the Bellagio",
"modified":"2026-10-13T18:05:00Z", "w":4032, "h":3024, "types":["portrait"],
"camera":{"model":"iPhone 17 Pro","iso":80}, "labels":[["dinner",0.91],["table",0.62]],
"description":"Two people at a dinner table.", "colors":{"orange":0.41,"brown":0.22}, "bright":0.38,
"analysed":{"by":"CHIA2","at":"2026-10-19T22:10:00Z","v":1,"what":["labels","description","colors","bright"]}}]},
"files":[["IMG_1234.HEIC", 2381044, 639277705310000000], ["IMG_1234.MOV", 2742412, 639277705310000000], ["Thumbs/IMG_1234.HEIC.jpg", 35120, 639278252430000000]]}
album.read#
- Direction: owner's or member's device → PC. Needs:
album1. Auth: asalbum.list. - Request:
ticket,album,dest(optional),name(a stored name, orThumbs/<name>),offset,length(optional). - Answer: exactly like
read: head{ok, size, offset, length, mtime}, data frames,{ok, done, sent}; missing:{"ok":false, "missing":true, "error"}(also "This album is not on this PC").
{"op":"album.read", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8", "name":"IMG_1234.HEIC"}
album.readmany#
- Direction: device → PC. Needs:
album4. Auth: asalbum.list(guests too, on the guest channel). - Request:
ticket,album,dest(optional),names(at most 64). - Answer: for each name in order
{"ok":true, "name", "size", "mtime"}, its data frames,{"ok":true, "done":true, "sent"}; or one frame{"ok":false, "name", "missing"?, "error"}for that file (also for a file over 8 MiB: "… is too large for album.readmany; use album.read"; a read failure mid-file ends with{"ok":false, "name", "error", "sent"}); then{"ok":true, "done":true, "all":true}.
{"op":"album.readmany", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8", "names":["Thumbs/IMG_1234.HEIC.jpg","Thumbs/IMG_1240.HEIC.jpg"]}
album.remove#
- Direction: owner's (or a member-add member's) device → PC; PC → PC passing it on; a relay job. Needs:
album1. Auth: see the table. - Request:
ticket,album,dests(this PC's drives),ids,source(optional: only that machine's items; ignored for a member),alsoTo. - What it does: takes the items out of the album here, records them in
album.json(removed, kept 60 days) so a late transfer never brings them back, drops this PC's waiting put jobs of those items, and passes the request on toalsoTo(a PC that cannot be reached gets a remove job). Fromalbum10 (iOS request #97) what it takes out is kept in the album's Deleted area for 30 days: its files move toDeleted/in the album folder (thumbnails toDeleted/Thumbs/), listed inalbum.json'sdeletedwith who removed it (by: the member, or the owner's email as the service confirmed it; a PC passing the owner's remove on sends it) and when;album.restoreputs them back,album.purgeends them, and 30 days after the remove they go by themselves.permanent: true(the owner's only) deletes them at once as before. - Answer:
{"ok":true, "removed":<n>, "count":<items>, "pushed":[Pushed]}. For a member alsorefused: [{id, error:"you can remove only what you added"}]; when every id asked is someone else's:{"ok":false, "refused":true, "error":"You can remove only what you added"}.
{"op":"album.remove", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8", "dests":["5B7E19A0C3D2"],
"ids":["9f2c41d07a8be613"], "alsoTo":[{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4"}]}
{"ok":true, "removed":1, "count":41,
"pushed":[{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4","drive":"OFFICE-NAS /mnt/backup1","ok":true,"state":"done"}]}
album.deleted#
The album's Deleted area (iOS request #97): what album.remove took out in the last 30 days.
- Direction: as
album.list. Needs:album10. Auth: the owner sees all of it, a member what they removed themselves; never a guest. - Request:
ticket,album,dest(optional). - Answer:
{"ok":true, "dests":[…], "dest", "items":[item + removedBy, removedAt, purgeAt], "files":[["Deleted/, newest first. Each item as<name>", size, mtimeTicks]]} album.listgives it (filesandthumbare its names inDeleted/). Read its files withalbum.readofDeleted/<name>/Deleted/Thumbs/<name>.album.listfromalbum10 carries the same entries asalbum.json'sdeleted([{item, names, by, at, index}], cut to what the caller may see) and their files infiles.
{"op":"album.deleted", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8"}
{"ok":true, "dests":["5B7E19A0C3D2"], "dest":"5B7E19A0C3D2",
"items":[{"id":"9f2c41d07a8be613", "source":"Annas-iPhone", "files":["IMG_1234.HEIC"], "thumb":"IMG_1234.HEIC.jpg", "kind":"photo",
"removedBy":"anna@acme.com", "removedAt":"2026-11-01T22:10:04Z", "purgeAt":"2026-12-01T22:10:04Z"}],
"files":[["Deleted/IMG_1234.HEIC", 2481920, 638675…], ["Deleted/Thumbs/IMG_1234.HEIC.jpg", 18211, 638675…]]}
album.restore#
Put back (iOS request #97; a whole album: requests #101).
- Direction: as
album.remove. Needs:album10. Auth: the owner any item, a member what they removed; a whole album andfrom: the owner's device only. - Request, three forms:
ticket,album,ids,source(optional),dests,alsoTo: the items of the album's Deleted area back in the album, in their place, under their old names, on every drive named (a PC that is off gets arestorejob). They count as added now, so a removal recorded on another copy before does not take them out again. Answer{"ok":true, "restored", "count", "pushed"}(a member's alsorefused).- no
ids: the whole deleted album back in place from the drives' deleted albums (the app calls the service'sPOST albums/{id}/restorefirst, so the ticket is the owner's ordinary one). Answer{"ok":true, "restored":<drives>, "pushed"}. from(a deleted album's id) withids: the album is gone: its items (from its Deleted area, and of a whole deleted album its items too) are copied intoalbum, an album of the same owner (From Other Apps), asalbum.clonecopies; what was put back leaves the deleted album's Deleted area. The ticket is foralbum; the deleted album'salbum.jsonmust name the same owner. Answer asalbum.clone:{"ok":true, "added", "already", "failed", "pushed", "count"}.
{"op":"album.restore", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8", "dests":["5B7E19A0C3D2"],
"ids":["9f2c41d07a8be613"], "alsoTo":[{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4"}]}
{"ok":true, "restored":1, "count":42, "pushed":[{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4","drive":"OFFICE-NAS /mnt/backup1","ok":true,"state":"done"}]}
album.purge#
Delete permanently of items in the album's Deleted area (iOS request #97).
- Direction: as
album.remove. Needs:album10. Auth: the owner any, a member what they removed. - Request:
ticket,album,dests,ids,source(optional),alsoTo. - Answer:
{"ok":true, "purged":<n>, "pushed":[Pushed]}(a member's alsorefused). A PC that is off gets apurgejob.
album.excluded#
The album's Excluded folder (albums.md, Excluded items): the work photos and videos an assistant's
add kept out of the album (Space Vision's work label).
- Direction: as
album.list. Needs:album14. Auth: the owner and the members; never a guest. - Request:
ticket,album,dest(optional: else the drive here holding the most items). - Answer:
{"ok":true, "dests":[ids], "dest":<id>, "items":[album item + "label":{"conf","why"}, "excludedAt"], "files":[["Excluded/.<name>", size, mtimeTicks]]}
album.return#
Return to album of excluded items: their files move from Excluded/ into the album (the first names free), they are
listed in album.json's kept (never excluded from that album again) and added as now.
- Direction: as
album.remove. Needs:album14. Auth: the owner (a member who may add gets every id inrefused). - Request:
ticket,album,dests,ids,source(optional),alsoTo. - Answer:
{"ok":true, "returned":<n>, "count":<items here>, "pushed":[Pushed]}. A PC that is off gets areturnjob. - Delete in Excluded is
album.removewith the ids: the item goes to the album's Deleted area.
album.flush#
A large put's end (albums put, albums import; Vladimir drops terabyte folders into one album). A PC sending one keeps
one connection to each of the album's other PCs for all its files and marks each album.put (both forms) batch: true;
the PC taking them records them in album.json held in memory (as the local batch, albums.md), written out
every eighth of the album's items (at least 256) or 30 seconds and before anything else changes that album folder there
(a put not marked batch, a removal, a caption, the sync, thumbnails). When the put is done the sender asks each of those
PCs to write its batch out, and that PC asks the PCs it passed the items on to (the meta form's fan-out), before it
answers; when the connection closes without it, the PC writes the batch out then. album.json's format is unchanged.
- Direction: PC → PC. Needs:
album12 (an older PC answers{"ok":false, "error":"Unknown request album.: it batched nothing). Auth: the company channel; it writes out only what this connection's puts hold.flush"} - Request:
album. - Answer:
{"ok":true}once album.json on this PC's drives of the album (and on the PCs this connection's batch puts went on to) has every item.
{"op":"album.flush", "album":"al_k3j9x2m4p7q1r5s8"}
{"ok":true}
album.caption#
- Direction: as
album.remove. Needs:album5. Auth: asalbum.remove; nevermemberor a guest. - Request:
ticket,album,dests,id,source(optional; ignored for a member),caption(plain text, at most 2,000 characters, no control characters but newline; CRLF is stored as a newline;""clears it),alsoTo. - Answer:
{"ok":true, "captioned":<items changed on this PC's dests; 0 when not held here>, "pushed":[Pushed]}. A caption that breaks the rules:{"ok":false, "error"}, nothing changed. A member captioning someone else's item:{"ok":false, "refused":true, "error":"You can caption only what you added"}. This PC's waiting put jobs of the item take the new caption; a PC that is off gets a caption job.
{"op":"album.caption", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8", "dests":["5B7E19A0C3D2"],
"id":"9f2c41d07a8be613", "caption":"Dinner at the Bellagio", "alsoTo":[{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4"}]}
{"ok":true, "captioned":1, "pushed":[{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4","drive":"OFFICE-NAS /mnt/backup1","ok":true,"state":"done"}]}
album.delete#
- Direction: owner's device → PC; PC → PC; a relay job. Needs:
album1. Auth: see the table. - Request:
ticket,album,dests(any destination of this PC, also one no longer listed for the album),alsoTo. - What it does: from
album10 (requests #101) moves the album folder on those drives to the drive's deleted albums (<root>/, withAlbums/ Deleted/ <album>/ deleted.json{at}), kept 30 days, then removed;permanent: trueremoves it at once (and a copy kept there). Drops every job of the album here and passes the request on (delete jobs for PCs that are off).album.restorewithout ids brings it back. - Answer:
{"ok":true, "deleted":<drives>, "pushed":[Pushed]}.
{"op":"album.delete", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8", "dests":["5B7E19A0C3D2"], "alsoTo":[{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4"}]}
album.copy#
Copies the whole album to new drives (when the owner changed the album's drives). No key: the album is plain.
- Direction: owner's device → a PC holding the album. Needs:
album2. Auth: owner's device. - Request:
ticket,album,from(optional: this PC's drive to copy from; default the first holding it),dests,alsoTo. - An item a drive already has is counted in
already; fromalbum11 one without a thumbnail there takes the thumbnail of the drive copied from (here, and on other PCs withalbum.putfillThumb). - Answer: progress frames as
album.add, then{"ok":true, "copied":<n>, "already":<n>, "failed":[{id, error}], "pushed":[Pushed], "count"}.
{"op":"album.copy", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8", "dests":[], "alsoTo":[{"pc":"BOB-PC","dest":"8C21D0E5F7A9"}]}
{"ok":true, "copied":42, "already":0, "failed":[],
"pushed":[{"pc":"BOB-PC","dest":"8C21D0E5F7A9","drive":"BOB-PC E:","state":"waiting","ok":false,"error":"BOB-PC is offline","added":0,"waiting":42}],
"count":null}
album.clone#
A new album made from an existing one (own, or shared with the caller), between the PCs.
- Direction: device → a PC holding the source album. Needs:
album3. Auth:ticketlets this device writealbum;from.ticketlets the same device readfrom.album. - Request:
ticket,album,dests,alsoTo,from({ticket, album, dest?}),ids(optional; default all),detach(optionaltrue,album7). - What it does: copies the items as this PC holds them on
from.dest(each file its own copy, never a hard link, read back against its size and hash); each keeps itssource, id, kind, created and place;addedBybecomes the cloner. Jobs for PCs that are off keep their own copy of the files. - Answer: progress frames, then
{"ok":true, "added":[ids], "already":[ids], "failed":[{id, error}], "pushed":[Pushed], "count", "job"}; an id not in the source album is afailedentrynot in the album <name>. A PC-side job likealbum.add(album7): it runs to its end without the caller;detach: true→{"ok":true, "accepted":true, "job", "of"}.
{"op":"album.clone", "ticket":"at_P9w3…", "album":"al_m2n8b4v6c1x7z3q5", "dests":["5B7E19A0C3D2"], "alsoTo":[],
"from":{"ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8"}, "ids":["9f2c41d07a8be613"]}
{"ok":true, "added":["9f2c41d07a8be613"], "already":[], "failed":[], "pushed":[], "count":1, "job":"job_71c3a08e5d2b94f0"}
album.merge#
Merging two albums (docs/albums.md "Merging two albums"): every item of two of the owner's albums into a new album, each once. The account service makes the new album and archives the two first (POST albums/merge).
- Direction: device → a PC holding both albums. Needs:
album13. Auth:ticketan owner ticket of the newalbum(nevermember-add); eachfrom[].ticketthe same device's owner ticket of that album, the same owner (else refused:Only albums you own can be merged). - Request:
ticket,album,dests,alsoTo,from([{ticket, album, dest?}, {ticket, album, dest?}], the first album's items first;dest: which of this PC's drives to read it from, default the one holding the most items),detach(optionaltrue),quiet(optional, withdetach). - What it does: as
album.clonewith both albums, in order, each item once: an item is left out when one taken has the same(source, id)or the same content (its main file the same size and XxHash128); the one taken keeps its caption, or takes the duplicate's when it has none. Captions, the index fields andsource/id travel. - Answer: progress frames, then `{"ok":true, "added":[ids], "already":[ids], "duplicates":[{id, source, as}],
"failed":[{id, error}], "pushed":[Pushed], "count", "job"}
; a PC-side job (album.jobopmerge`; its end alerts the sender as a clone's).detach: true→{"ok":true, "accepted":true, "job", "of", "notifies"}.
{"op":"album.merge", "ticket":"at_P9w3…", "album":"al_m2n8b4v6c1x7z3q5", "dests":["5B7E19A0C3D2"], "alsoTo":[],
"from":[{"ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8"}, {"ticket":"at_3MZ1…", "album":"al_q4w7e2r9t5y1u3i6"}], "detach":true}
{"ok":true, "accepted":true, "job":"job_71c3a08e5d2b94f0", "of":57, "notifies":true}
album.status#
- Direction: device → PC (the source PC of the album's transfers). Needs:
album2. Auth: own device, owner or member. - Request:
ticket,album. - Answer:
drives: [{pc, dest, drive, state, items?, waiting?, error?, since?}]and (album7)jobs: [Job], the album's adds and clones on this PC (newest first, below);drivesis every album drive as this PC knows it:done(this PC's drive holds it,items; another PC's: nothing waits for it here),waiting(waitingjobs here,errorthe last reason,sincethe oldest),failed(that PC refused; kept 7 days),missing(this PC's drive does not hold it),offline(this PC's drive is not connected).
{"ok":true, "drives":[{"pc":"ANNA-PC","dest":"5B7E19A0C3D2","drive":"ANNA-PC D:","state":"done","items":42},
{"pc":"BOB-PC","dest":"8C21D0E5F7A9","drive":"BOB-PC E:","state":"waiting","waiting":42,"error":"BOB-PC is offline","since":"2026-10-17T10:31:00Z"}],
"jobs":[]}
album.add and album.clone as PC-side jobs#
Since album 7 every album.add and album.clone is a job of the PC: it finishes every item, its copies on this PC's drives and the fan-out to alsoTo (or their transfer jobs) whether or not the caller is still connected. Its progress frames and answer are sent best-effort: once a send fails (the phone was minimized, the network changed), the PC logs it and sends nothing more for that job, and the job goes on. The lent key is dropped when the job ends (before its answer), as before; the album's item count goes to the account service then, as after every change.
detach: trueon either request: after the checks (ticket, drives, items; the lent key frame is read first) the answer is at once{"ok":true, "accepted":true, "job":"job_; no progress frames and no final answer follow (the connection may be closed or used for other requests). A refused or malformed request is answered<16 hex>", "of":<items>, "notifies":<bool>} {"ok":false, …}as before and starts nothing.- The end, with the phone gone (iOS request #63;
notifies: true, version 0.13.9 on): as a detached job starts, the PC binds it to the sender's album ticket with the account service (POST albums/{id}/jobs/accept); at its end it reports it (POST albums/{id}/jobs/done): the sender's member gets analbum-jobalert ("Chicago Night River" / "23 photos added", or "Could not finish: …") opening the album, the album's people re-read it, and the count of what was added goes to them as the phone's albums/{id}/added would. The phone that sees the end itself still callsalbums/{id}/added, withjob: the service counts each job once. Best-effort: when the service cannot be reached as the job starts, the job runs and no alert follows (the log says so). quiet: truewithdetach: true(requests #111, 0.16.89): one step of an action whose alert another job gives (a helper of Copy album… cloning onto its own drives while the main job runs): the job runs as any detached one but binds nothing with the service, so it alerts nobody (notifies: false). A PC before 0.16.89 ignores it and alerts as before (the service folds such alerts, POST albums/{id}/jobs/done). An app that adds in several steps (as items land, again for the thumbnails) sends the steps withoutdetachand only the add that ends the action detached.- Reading a job later:
album.→job {ticket, album, job} {"ok":true, "job":Job}, or withoutjob→{"ok":true, "jobs":[Job]}(newest first); alsojobsinalbum.status. Auth asalbum.status: own device, owner or member. A job this PC does not know is{"ok":false, "missing":true, "error"}. - Job:
{"job", "op":"add"|"clone", "state":"running"|"done"|"failed", "by":<device>, "detached":<bool>, "done":<items>, "of":<items>, "started":<UTC ISO 8601>, "finished":<UTC ISO 8601|null>, "result":<null|{added, already, failed, pushed, count}>, "error":<text|null>}.resultis the answer a connected caller gets, withoutokandjob.failed: the job stopped as a whole (error); per-item failures are inresult.failed. A request that stayed connected is a job too (detached: false), so a caller whose connection broke reads its result the same way, by thejobof its last progress frame. - Jobs are kept in the PC's memory while they run and 24 hours after; a PC restart forgets them (a running add stops there: its lent key is gone; what it copied stays, and adding again answers those items
already).
{"op":"album.add", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8", "dests":["5B7E19A0C3D2"], "key":true, "detach":true, "items":[…], "alsoTo":[…]}
{"ok":true, "accepted":true, "job":"job_4be0c2a19f7d3e65", "of":120}
{"op":"album.job", "ticket":"at_7KQ2…", "album":"al_k3j9x2m4p7q1r5s8", "job":"job_4be0c2a19f7d3e65"}
{"ok":true, "job":{"job":"job_4be0c2a19f7d3e65", "op":"add", "state":"done", "by":"Annas-iPhone", "detached":true, "done":120, "of":120,
"started":"2026-10-20T21:02:11.0000000Z", "finished":"2026-10-20T21:04:40.0000000Z",
"result":{"added":["9f2c41d07a8be613", "…"], "already":[], "failed":[], "pushed":[{"pc":"OFFICE-NAS","dest":"3F9A1C07B2E4","drive":"OFFICE-NAS /mnt/backup1","state":"done","ok":true,"error":null,"added":120,"waiting":0}], "count":162},
"error":null}}
Guests#
The guest channel#
A guest is someone outside the album owner's company with an accepted invitation to an album (see Guests from outside the company). A guest has no company key, so it opens its own channel on the PC's peer port (a relay pipe in guest mode, or a LAN connection), proving its registered device key and an album ticket from its guest pass (POST /). The PC proves its own registered key. Needs a PC with album 4 that is signed in to the account service.
The guest pass, and each album ticket in it, is good until its expires (1 hour; ask for a new one when less than 10 minutes are left). Its per-company relay value is the relay pass, sealed for the relay: its JSON holds the group, company, device, expiry (x, Unix seconds), the PCs the guest may reach, and ExpiresAt (the same expiry as an ISO 8601 date-time); see Guests at the relay.
- Guest → PC (plain frame):
{"v":1, "guest":1, "name":<device name>, "inst":<instance id>, "nonce":<32 bytes b64>, "eph":<ephemeral P-.256 SPKI b64>, "ticket":"at_ …"} - The PC confirms the ticket (access
guest, its device name isname, the album has a drive on this PC, fewer than 8 guests connected). Else{"error":"…"}and the end. PC → guest:{"v":1, "name", "inst", "nonce", "eph"}. - Both compute, with G = the guest device's registered key, P = the PC's registered device key, g/p the ephemerals:
ee = ECDH(g,p),es = ECDH(G,p),se = ECDH(g,P)(32-byte X coordinates);th =; then HKDF-SHA256(ikm = ee‖es‖se, salt = nc‖ns, info =SHA- 256(L("SpaceBackup guest v1") | L(nc) | L(ns) | L(gName) | L(gInst) | L(pName) | L(pInst) | L(gEph) | L(pEph) | L(ticket)) SpaceBackup guest v1 keys‖ th, 128 bytes) = c2s key ‖ s2c key ‖ client MAC key ‖ server MAC key (32 bytes each). - Guest → PC
{"mac": b64(HMAC-; PC → guestSHA256(clientMacKey, "client\ n" ‖ th))} {"mac": b64(HMAC-, which the guest checks against the PC key from its pass. Then the same encrypted frames as the company channel.SHA256(serverMacKey, "server\ n" ‖ th))}
Refusals at the hello include: a guest's connection needs an album ticket, the account service did not confirm this ticket, not a guest's ticket, this ticket was given to <name>, not to <device>, the album <name> is not kept on <PC>, this PC serves too many guests now; try again later, this PC cannot serve guests (it is not signed in to the account service), the device's key does not match the one registered for it.
What a guest may send#
Only the handshake's album; ticket may be left out (the handshake's is used):
| Op | As for a member, except |
|---|---|
album. | album.json comes without the items' source, without removed, and without analysed.by. |
album. | none. |
album. | none. |
album. (changes 1) | add items come as a guest's album.list gives them (no source, no analysed.by). |
changes.watch {parts} (changes 2) | Only the part album:<album> of the handshake's album; any other part is refused once ({"ok":true, "refused":{part, "error":"A guest may only view the album shared with them"}}), the album goes on. add items as in album.changes. A ticket the account service no longer confirms, checked before each record: refused for the part, and the connection closes. |
destmust be one of the album's drives on this PC ({"ok":false, "refused":true, "error":"That drive is not one of this album's"}); without it, the first holding the album.- Anything else, or another album:
{"ok":false, "refused":true, "error":"A guest may only view the album shared with them"}, logged; the connection stays, but closes after 100 refused requests. - A guest cannot ask
caps: a PC built before 2026-10-25 refusesalbum.changesandchanges.watchwith that error; the guest then reads the album again on each push, as before. - At most 20 requests a second per connection (bursts of 100), then
{"ok":false, "busy":true, "retry":1, "error":"Too many requests; try again in a second"}. - The ticket is confirmed again when its last yes is older than 5 minutes; a no answers
refused: trueand ends the connection. A guest's ticket never works on the company channel ("A guest's ticket serves only a guest's own connection").
What the iPhone sends#
The phone is an ordinary client of the requests above; nothing on a PC is phone-only. In short:
| Task | Requests |
|---|---|
| Connect | LAN address (from the relay's lanAddrs when on the same public IP), else a relay pipe; the company channel handshake; caps. The phone announces Port 0, no Dests, Ver ios-<version>. |
| A backup run | prepare, mark, stat/list, link, putsmall/put (with dests for several drives of one PC), unmark, release. |
| Change an older date (Archive, a rewritten month index) | A run on that date: mark, the writes, unmark. |
| Remove from backups | remove (one per date and destination). |
| Several computers chosen | One run to the primary, then replicate with a grant; replicas at its next run for dates not done everywhere. |
| Destinations changed, Rearrange | rearrange with a rearrange grant; replicas {rearrange:true}. |
| Browse, view, save | dates, list, read, readmany (read ≥ 3), cancel; grant first for a shared device. |
| Albums | album.add (key lent) to the PC holding its newest backup, album.list/read/readmany to view, album.remove/delete/caption to the same PC, album.copy when the album's drives change, album.clone, album.status. |
See also The iPhone and iPad app.
Google Drive helper: gdrive-speed#
gdrive-speed#
The PC that backs up a Google account asks the other PCs how fast they download from Google Drive, to suggest the best worker.
- Direction: PC → PC. Needs:
gdrive1. Auth: company channel. - Request:
token: a short-lived Google access token of the asking PC (never the refresh token). - What it does: downloads up to 3 of the largest files (at most 200 MB, at most 30 s) and measures.
- Answer:
{"ok":true, "mbps":<MB/;s or null>, "free":<bytes free for the local copy>, "error":<text or null>} {"ok":false, "error":"no access token"}.
{"op":"gdrive-speed", "token":"ya29.a0AfB_FAKE…"}
{"ok":true, "mbps":41.7, "free":912384000000, "error":null}
Google Drive assignment records (which PC backs up which account) travel in the LAN announcements (Gd), not as requests.
Space Vision#
Phase 1 (docs/space-vision.md#phase1, iOS request #40). What the PCs learn about the photos and videos of a phone's
Not encrypted backups is written into the plain month index of its newest complete date (labels, text,
colors, bright, camera where the phone had none, description, a video's transcript and frames, and
analysed {by, at, v, what}), so browsing needs no new request. Encrypted trees are never read. The three requests
below take the same right as read: the caller's own machine, another only under a grant.
vision.status#
- Request:
{"op":"vision..status","machine"?} - Answer: `{ok, machine, pc, items, analysed, colored, videos, transcribed, encryptedDates, waiting, lastRun {at, by,
items}, worker {active, why, machine, profile, gpu, running}}`, counted over this PC's plain destinations;
encryptedDatesthe distinct dates of the machine held only encrypted on this PC (each date once, whatever the drives);waitingissigned-out(this PC is not signed in),no-workeror null (0.14.0: noconsent, every member's plain backups are analysed, iOS request #64). Settings → Photo analysis on the phone sums it over the PCs holding the device. Since phase 2 alsopending(items still waiting for a worker) andworkers[]{machine, active, items, lastPut, seen, leases[{dest, machine, date, expires}]}: the workers on other PCs working here;waitingis notno-workerwhile one is active. Since 0.13.1workers[].itemsis the machine's done records that worker put here, counted from the stored records (it survives a host restart), anddoneBy{worker: items}credits every worker, this PC's own included (a record from before records named their worker counts for this PC). Since 0.13.1workeralso hasgpuSetting(all,0,1,none),gpuUsedandgpus[]`{index, name, totalMb, freeMb, usedMb, profile, state, plan?, working?, why?, last?}: each graphics card of the PC,stateworking(working: the profile it loaded),ready(plan`: the profile it would take now),waiting(why: GPU busy),excludedorunusable; one worker runs per usable card.
vision.coverage#
- Request:
{"op":"vision.(capscoverage","machine"?,"months"?,"fresh"?} vision-coverage: 1, 0.16.30), from any PC of the company: counts only, no file name, no grant or hello. The PC answers its snapshot (at: when it was counted,cachedS: its age in seconds; one younger than 60 s with no put or requeue since is answered as it is, one up to 5 minutes old is answered withrefreshing: truewhile a refresh runs; older ones are counted again);fresh: truecounts now and waits (0.16.169; an older PC ignores it and counts every time). - Answer:
{ok, pc, version, dv, at, cachedS, refreshing?, columns, worker {active, why, ownFirst}, workers[], lastWork, machines[]}; per phone with backups on this PC:items(its newest complete plain date of each destination, an item once),current(analysed at the description version it needs: 5 with a place, 4 without),older,never,failed(failedDue: due again,nextRetry),coverage(current / items, %),oldest {landed, hours, created, state}(the unanalysed item that landed here first: the first date folder holding its file),oldestWaitingHours(failures in their back-off left out),exts,months {yyyy-,MM: [items, current, older, never, failed]} encryptedDates,encryptedNewer,encryptedDate/encryptedKeys/encryptedItems/encryptedOnlyItems/encryptedMatch(keysorcount)/plainKeys/encryptedUnmatched(the newest encrypted date's key list, two keys an item, matched with this PC's matching keys against its plain copies; docs/space-vision.md#coverage, Only encrypted).vision coverageasks every PC (docs/space-vision.md#coverage).
vision.audit#
- Request:
{"op":"vision.(capsaudit","machine"?,"fix"?,"wait"?} vision-audit: 1, 0.16.159), from any PC of the company likevision.coverage: counts and causes only, no file name.fixqueues again what the PCs make and is missing, broken or stale;wait(default 150 s, at most 170) is how long the caller waits. - Answer: the processing watchdog's report (docs/space-vision.md#watchdog): `{ok, pc, version, dv, at, fix, ms,
stages[], requeued, failed, bad, machines[], cached}
; per phone with plain copies here{machine, items, absent, needsUser, indexDate, stages {stage: {ok, na, waiting, bad, requeued, retrying, failed, healed, gaveUp, causes}}}`. The last report while it is fresh (30 minutes, nofix, nomachine:cached: true); an audit that does not end withinwaitanswers{ok, pc, version, running: true, lastAt}and its report is the next caller's. `processing audit` asks every PC.
vision.covered#
- Request:
{"op":"vision.(an older PC answers "Unknown request": nothing counted as held there), from any PC of the company likecovered","machine","keys":[hex…]} vision.coverage: another PC's encrypted keys of that phone that its own plain copies do not hold. - Answer:
{ok, pc, covered: [hex…]}: those of the keys an item of this PC's plain copies of the phone has (its keys HMAC'd with each matching key this PC holds).vision coveragecounts only what no PC holds plain as only encrypted.
vision.progress#
- Request:
{"op":"vision.(capsprogress","all"?,"company"?,"machine"?} vision-progress: 1, 0.16.80; 2:companyand the fields of 0.16.84). Withcompany: true(any PC of the company) the PC asks every online PC and answers their sum with each kind'sstatusandsayandpcs[](docs/space-vision.md#progress-status). Withall: truefrom any PC of the company (asvision.coverage): every phone on this PC, ormachine; without it the caller's own phone (another under a confirmedgrant), asvision.status. Cheap (counts kept 20 s, recounted in the background): poll it every few seconds while Settings → Photo analysis is open, never otherwise. - Answer:
{ok, v:1, pc, version, machine, at, kinds, worker, workers[], runs[]}.kinds.photos,.videos,.transcripts,.photoFaces,.videoFaces: `{done, total, failed, skipped, skippedReason?, left, lastHour, today, perMin, etaMin, waiting?}(skipped: never done and not waiting,skippedReasonno-speech` (a video without speech gets no transcript) oralbum-faces-off;left= total − done − failed − skipped;waiting: why this host's items do not move, e.g. "CHIA2 is busy with a backup";etaMinminutes, 0 when nothing is left, null without a rate in the last hour; none for transcripts; a faces kind is{off:true}while Recognize faces is off). Summed (and withcompany):statusdone|working|waiting|stalled|offandsay, the words to show ("Done — 55 videos have no speech", "Waiting: mars-3: GPU busy (…)"; "Not moving in the last hour" only while a worker that could take them is idle).worker: this PC's own, `{pc, state, why, rule, profile, profileReason, gpu, gpus, version, faces, now},stateone ofworking,idle,paused,busy,off,no-gpu`,not-installed; `now {task: analyse|describe|redescribe|faces|select, kind: photo|video, n, of, since, host?, machine?, date?}.workers[]: other PCs' workers as this host sees them,{pc, state, seen, lastPut, leases[{machine, date}], profile?, gpu?, version?, now?}.runs[]: the last 10, newest first,{started, at, by, host, machine, dates, photos, videos, transcripts, faces, failed, errors[], from?}(from: "records"`: told by the stored records of the last 2 days, no run noted for them; an album lease's run: machineAlbums,datesthe album's name). Sum over PCs: add the counts, perMin = Σ lastHour / 60, etaMin = Σ left × 60 / Σ lastHour; a PC's ownworkerwins over a host's view of it; the 10 newest runs (docs/space-vision.md#progress-sum). - The guards (0.16.85, docs/space-vision.md#guards; caps unchanged, an older app ignores the new fields): a kind
also has
skippedBy {reason: n}(failed-3x: failed 3 times, no worker is offered it again but a newer build;no-speech;album-faces-off;skippedReasonis then the most common), and on a hostelsewhere {PC: n}: album items whose file only that PC's drive holds. Summed, those of a PC that did not answer arewaitingFor {PC: n}, intotalbut not inleft, said "Waiting for CHIA3 (offline): n". The answer has `stall {since, left, kinds {kind: n}, idle [pc], why, retries}` when this host's self-check finds items left while a worker that could take them stood idle 15 min (the sum:stalls[]withpc, and those kindsstalled: "Not moving: 14 on CHIA2 left while …"), and the sumoutOfDate [{pc, version, newest}]withoutOfDate: true(andoffered) on a worker the download feed offers a newer version for its platform (0.16.94:newestis the feed's version for that platform; before, the newest version any PC answered).vision.lease's renewalprogressmay carrystaged(bytes of the batch read so far); a renewal whoseprogressstays the same for 2 h answers{ok:false, lost:true}and the date goes back to the workers.
- The fleet (0.16.86, docs/space-vision.md#fleet; caps
vision-progress: 3,vision-fleet: 1): this PC'sworkeralso hascards[{index, name, totalMb, freeMb, state, profile, why?}],perMin,lastHour,today(what its worker stored),owner {inUseMin, quiet, maxTempC, maxPowerW},statejoining(it installs the analysis by itself) andrulein-use,quiet,hotorpowerwhen the owner's rules hold it. The sum hasfleet[], one row per PC:{pc, state, cards, freeMb, profile, now, perMin, lastHour, today, idle, idleSay, version, outOfDate, offered?, via?}(idle:nothing,offered-nothing(0.16.94: idle while items it could take are left),in-use,quiet,hot,power,memory,backup,paused,joining,battery,off,not-a-worker;out-of-datebefore 0.16.94, now said inidleSaybeside the reason;idleSaythe words to show), the workers view every app shows. 0.16.94: the answer and itsworkerhaveplatform(windows,linux,macos), and an idleworkerhasround {host: line}, what each PC answered its last round.
vision.viewing#
- Request:
{"op":"vision.(capsviewing","machine","date"?,"dates"?,"rels"?} vision-fleet: 1): an app shows these items now (rels: their thumbnails' or files' paths in the date, at most 2,000;datesat most 31). Short. - Answer:
{ok, dates, items}. Those items go first for every worker for 10 minutes, and when nothing works on this PC the workers are called. Areadmanyof thumbnails by a connection that is not a worker's counts the same. - Parts (workers):
vision.hellomay carryparts: 1andcard {profile, vramMb};vision.pendingthen answers each date as parts (partp:/v:/a:<low>~<high>,kindphotos/videos;held {photos|videos: worker}when a kind is left for a better-suited idle worker), andvision.lease/vision.unleasename thepart(docs/space-vision.md#fleet-parts).
vision.search#
- Request:
{"op":"vision.: the Photos viewer's search words over the PCs' fields (and the phone's),search","q"?,"color"?,"machine"?,"dest"?,"kind"?,"from"?,"to"?,"limit"?} colorone of the twelve names (share ≥ 0.15). - Answer: `{ok, vector:false, hits:[{id, asset, kind, dest, date, rel, thumb, created, match, t0?, snippet?, lang?,
description, color}], total}
;date/relread withread/readmany` as usual. - With
queryinstead ofq(capsvision-search: 1, iOS request #60): `{"op":"vision.search","machine"?,"ticket"?, "query","max"?,"kind"?}` ranks every analysed item of the machine on this PC by the words and the picture vector its worker stored, from the host's memory alone (no worker, no file read; docs/space-vision.md#select-fast). Answer:{ok, vector, hits:[{id, asset, date, kind, score, why, description}], total, ms, why?}, best first, at mostmax(1–1000, default 50);idthe content hash,assetthe month-index id;score≥ 0.5 is whatvision.selectwould select;vector:false(withwhy) when no query vector could be made: the word rule alone (score 0.8 when every word of the query is in the item's analysis). The phone still narrows by place and days itself. - With
geo(capsgeo: 1, geography section 2): both forms take the geographic filter{"place":{"level","id","name"},"region","continent","water":{"kind","name"},"lat":{"min","max"},"lon":{"min","max"},"hemi"}(every key given must hold;lonminabovemaxwraps across ±180°) and answer only the items in it; with noq,colororquery, every item in it, newest first (match/why:place). Every hit carries the item's compactgeo({locality, metro, county, stateCode, cc, continent, regions, water, hemi}). A bad filter:{ok:false, error}. - A place alone, a page at a time (geography section 8 item 12; "Europe" or "the States" hold more
than one answer should): with
geoand noq,colororquery, both forms take"after"(thenextof the page before: the last hit'sid, itsassetwhen it has noid) and"limit"(1–5000, default 1000; thequeryform withoutlimittakesmaxif given) and answer{…, hits, total, next}:totalevery item in the filter,nexttheafterof the page after,nullon the last page. Newest first, ties byid, so pages neither repeat nor skip an item. Anafterno longer in the listing (the item went between two pages):{ok:false, error}, list again from the start.
geo.resolve#
- Request:
{"op":"geo.(capsresolve","words","langs"?,"machine"?,"ticket"?} geo: 1): the words said as a geographic filter (geography section 3), from the PC's offline data and docs/geography-aliases.tsv. - Answer:
{ok, geo, label, matched, candidates:[{geo, label, count}]}:geothe first candidate's filter (null: the words say no geography),labelin the first oflangs,matchedthe words it took; an ambiguous name ("Paris") lists its readings, the most ofmachine's items on this PC first (nomachine: counts 0, the biggest place first).
geo.places#
- Request:
{"op":"geo.(capsplaces","level","machine","geo"?,"langs"?,"ticket"?} geo: 1; who may read it asread):levellocality | metro | county | state | country. - Answer:
{ok, level, places:[{id, name, count}]}, the most first, each of the machine's items on this PC counted once (for a phone with no item list; an app with items groups theirgeoitself, geography.md section 6).
geo.names#
- Request:
{"op":"geo.(capsnames","ids":["geonames:5506956","US- NV","US","NA","middle- east"],"langs"?} geo: 1; any device of the company; no machine: the names are the PC's data, not anyone's items).ids: an array or a comma list, at most 5000: a town or metro (geonames:<n>), a county (US-NV-003), a state (US-NV,CA-ON), a country (US), a continent (NA), a region (middle-east);country:,continent:,region:,state:,county:,metro:orlocality:before one says its kind, which the codes that are both a continent and a country need for the country (AF,AS,NA,SAalone are the continents:country:NAis Namibia,country:SASaudi Arabia). - Answer:
{ok, names: {id: name}}, keyed by the ids as asked, each in the first oflangsthat has a name for it (GeoNames' for towns, states and counties, Natural Earth's for countries, the tables' for regions and continents), else English; an id that names nothing is left out. The compactgeostays ids only; an app asks once per session for the ids it holds and keeps the answer (geography.md section 8, item 14). A filter's own name isgeo.resolve'slabel(a region-only filter's too:{"region":"middle-east"}→ "Middle East").
search.index#
- Request:
{"op":"search.(capsindex","machine"?,"ticket"?,"have"?} search-index: 1; who may read it asread). - Answer:
{ok, version, date, months, size, ms}, then data frames ofsizebytes (gzip of `[count][length, month JSON]…, little-Index/yyyy-MM.json` of the machine's newest complete plain backup on this PC with this PC's analysis merged in, as the write-back would put it), thenendian int32: the month files {ok, done, sent}.havethe current version:{ok, version, date, same: true}and nothing more. No plain backup of it here:{ok:false, none:true}. The viewer reads a device this way first, and its month files only from a PC without it (docs/space-vision.md#search-index). - Each located entry carries
geo(capsgeo: 1, geography section 8 item 13): the PCs' whole record (section 1 and 7:lat,lon,cell,locality,localityId,subLocality,metro,county,countyCode,state,stateCode,country,cc,continent,regions,water: {kind, name, ocean, sea},hemi), whose keys include every key of the compactgeothe hits carry, with the same values: a phone groups Places by country, state and city from the entries it reads (names incountry/state/locality). Only in this answer: the month files on the drives stay as the phone wrote them, with nogeo(it writes them before any PC has worked out the geography). - Each located entry carries
spot, andspotKindwhen it is a venue (geography section 10, 0.16.158): the venue, landmark or park it was taken at ("Fontainebleau Las Vegas",hotel), from the PCs' offline packs, for About's Location, Nearby and search. The packs' version is part ofversion, so a new pack makes the index again. A phone may writeacc(the fix's horizontal accuracy in metres) into a month index entry besidelat/lon: the venue is then looked for within it (15–100 m; 30 m when absent). - The
vision.searchhits carryspotandspotKindthe same way (every form: words, the rankedquery, a place alone). - Several copies of the newest date on this PC's drives are one index: of each month the copy listing the most items (a drive's copy can hold a month file the phone wrote before it backed up more of that month), every drive's analysis.
vision.get#
- Request:
{"op":"vision..get","machine"?,"asset" | "id" | "rel","segFrom"?,"segCount"?} - Answer: the item's index fields plus
long(the description: 3–4 sentences, 40–80 words),ocr(in full),summary, andtranscript[]{t0, t1, lang, text}paged bysegFrom/segCount(≤ 500) withsegTotal;{ok:false, error:"not found"}.
Workers on other PCs (phase 2)#
A GPU PC analyses another PC's plain phone backups (docs/space-vision.md#phase2): it proves it is a company device,
leases one plain date, reads its files with read / readmany while the lease lives
(another machine's files, only that date, only Photos\, Archived\, Thumbs\, never an encrypted tree) and puts
the records back; the host merges them into the month index as a local worker's. Plain dates only; every member's
devices (0.14.0, iOS request #64; before: the worker's member's own devices and devices shared with them); the host's own
worker first. Caps vision-lease: 1. A host with no worker of its own calls a worker as soon as a phone's date is
completed there (vision.call with analyse), not at the worker's next round.
vision.challenge#
- Request:
{"op":"vision..challenge"} - Answer:
{ok, nonce, expires}: 64 hex, single use, this connection only, 60 s.
vision.hello#
- Request:
{"op":"vision.:hello","nonce","sig"} sig= base64 ECDSA P-256 / SHA-256 by the worker's device key over the UTF-8 ofsv-; the host checks it against the key the account service has for the connection's peer name (worker\ n<host>\ n<worker>\ n<nonce> GET /).account/ api/ devices/ key - Answer:
{ok, worker, host};{ok:false, refused:true}for a wrong or replayed nonce or signature. The requests below need it on the connection.
vision.pending#
- Request:
{"op":"vision..pending","dest"?,"limit"?} - Answer: `{ok, dates:[{dest, machine, date, cf, items:[{id, kind, rel, thumb, size, created, why, asset}]}], total,
waiting?, waitingDates?}`: per machine this worker may analyse its newest complete plain date's items no worker has done, newest
dates first, photos before videos (
asset: the month-index entry for just the main file); dates another worker holds are left out;waiting {machine: signed-names the others (only while the host is not signed in; a host before 0.14.0 may sayout} consent) andwaitingDates {machine: n}(withwaiting, since 2026-10-21) how many plain dates each holds back.{ok:true, own:true}: the host's own worker does them.{ok:false, busy:true, retry}: a backup is being written.
vision.lease#
- Request:
{"op":"vision.:lease","dest","machine","date","ttl"?,"lease"?} ttl60–1800 s (default 600); withleaseit renews (every 3 minutes while working). - Answer:
{ok, lease, expires};{ok:false, held:true, by, expires}(another worker),own:true(the host's own worker comes first),refused:true(may not analyse that machine),lost:true(renewing a lapsed lease). A lease not renewed lapses after its ttl and the date goes to the next worker; a host restart drops all leases.
vision.unlease#
- Request:
{"op":"vision.. Answer:unlease","dest","machine","date","lease"} {ok:true}.
vision.put#
- Request:
{"op":"vision.:put","body","sig"} bodya JSON text `{kind:"sv-put", host, dest, machine, date, lease, ts, records}(≤ 64 records ofspacevision.py export),sig` the worker's device-key signature over its UTF-8 bytes. - Answer:
{ok, stored, gone, expires}(ids not in that date ingone; the lease renewed). Refused when not signed by the worker, not for this host,tsmore than 5 minutes off, or without this worker's live lease on that date (held:true/lost:true).
Selection: which candidates match the user's words#
The phone narrows a request ("night views of Chicago") to candidates by place and date itself; a PC's worker looks at
them and says which match (docs/space-vision.md#select, iOS request #51). A read-only judgement: nothing is written to
the index. Caps vision-select: 1 (every host: vision: 1). Always a detached job, kept in memory for 24 hours.
vision.select#
- Request:
{"op":"vision.:select","machine"?,"ticket"?,"query","candidates":[{"date","id"}],"max"?,"day"?} machineand the right to it asvision.status(a grantticketmay come along instead of agrantrequest first);querythe user's words (≤ 500 characters);candidatesat most 1000,datethe backup date the phone holds the item in,idits month-index asset id (or the content hash), an id once;max1–1000 (default all);day: true(iOS request #62): only daytime pictures, the query judged with " in daytime" (unless it already says day) and a candidate whose analysis says night (a night-sky label, night, evening, dusk or twilight in its labels or description) rejected,why"night". - Answer at once:
{ok:true, accepted:true, job, of}. Missing query or candidates, or more than 1000:{ok:false}.
vision.job#
- Request:
{"op":"vision.(the device that asked only; another, or a job older than 24 hours or from before a restart:job","job"} {ok:false, notFound:true}). - Answer:
{ok, job, state, done, of},staterunning | done | failed,donethe candidates judged or skipped so far.done:result: {selected: [{id, score, why}], rejected, skipped: [{id, date, why}]}.selected: score ≥ 0.5, best first, at mostmax,whya few words.rejected: judged and not selected.skipped.why:encrypted(that date is held only encrypted here, never read),not-found(not in that date nor in the machine's newest plain date here),no-picture,vlm-answer,not-analysed-no-worker(never analysed and no worker could look at it),not-judged.failed(only when no candidate is analysed; otherwise the host judges the analysed ones itself, see below):reasonno-worker(no worker here nor on another PC seen in the last 15 minutes; also a worker of an older build refusing withconsent),signed-out(this PC, or the worker called, is not signed in),gpu-busy(the card stayed busy 2 minutes),worker-lost,error: ….no-workerandsigned-outare known at once: the firstvision.jobalready saysfailed. Noconsentsince 0.14.0. On any failed job the phone keeps its own rules.running(capsvision-select: 2):partial: {selected: [{id, score, why}], decided}: what the host's fast pass selected already, best first (the finalselectedkeeps every one of them and may add more), and how many candidates it settled.- Every answer (caps
vision-select: 2):timingsin ms so far:queue(behind another selection),embed(the query's vector),fast(the host's pass),call(the worker's process start, staging, lease and network),load(its model load),pictures(its SigLIP pass over pictures),vlm(the VLM judging),total;warm(the worker's VLM was loaded already),vectorBy(this PC, a worker PC's name, orcached) ornoVector(why none),decidedFast,toWorker(items).
- Who judges: this PC's worker first (a background run is stopped for it); else a worker on another PC (LAN first)
that the host calls with
vision.calland that works through a select lease. A worker scores each candidate 0…1: a fast pass with SigLIP 2 (the index words, the query against the thumbnail) settles clear cases, the VLM looks at the rest (the thumbnail; a video's middle frame), judging the query without names of places and people. - Analysed items by their stored fields (iOS request #55, docs/space-vision.md#select-stored): a candidate a worker
has analysed (
labelsinanalysed.what) is judged from its stored labels, description, text, transcript, scene labels, colours, brightness, camera and day only, never from its picture: the word match, then the VLM in text mode. Its files are not read nor staged. With no worker (or every worker failed or busy) the host judges the analysed candidates itself by the word match and skips the othersnot-analysed-no-worker; the job is thendoneat once. - The fast pass (iOS request #60, docs/space-vision.md#select-fast): the host keeps the analysed items and the SigLIP 2
picture vector each one's worker stored; it embeds the query once (its own text tower, else a worker PC's,
vision.embed) and settles every analysed candidate the word match or the vector decides (cosine ≥ 0.12 in, ≤ 0.03 out) in milliseconds. Only the band between (at most 48 nearest the cut) and the candidates never analysed go to a worker; with no worker the band is cut at 0.06.
vision.embed#
- Sent by a host to a worker PC's own peer server:
{"op":"vision.(what can be seen of the query, ≤ 500 characters). Answer:embed","text"} {ok:true, vec, dim:1152, ms},vecbase64 of 1152 little-endian float16 (SigLIP 2's text vector, unit length);{ok:false, error}without an encoder there. The worker keeps its text tower loaded 30 minutes after the last query (CPU, about 170 ms a query; 3–5 s to load). No data of any machine is read.
vision.call#
- Sent by a host to a worker PC's own peer server:
{"op":"vision.. Answer:call","job","machine"} {ok:true, accepted:true}(the worker dials back, proves itself withvision.helloand takes the select lease), or{ok:false, busy:true, reason:"worker-(its card is not ready, or it judges another selection), orbusy", error} {ok:false, reason:"signed-. A worker that does not take the lease within 60 s is passed over.out", error} - New backups (0.14.0, iOS request #64):
{"op":"vision.: a phone's plain date was just completed on the host (a backup's end, a replica, a rearrange, a dead run closed; batched 30 s per machine) and the host has no worker of its own. It calls the workers that saidcall","analyse":true,"machine"} vision.helloto it in the last 15 minutes, LAN first, until one answers{ok:true, accepted:true}: that worker runs one round on the host at once (vision.pending,vision.lease, reads,vision.put). Refused{ok:false, busy:true, reason:"worker-when the worker PC is busy (a backup, its worker running, no worker),busy", error} reason:"signed-out"; an older worker answersMissing job. Refused by all: the workers' next round (about every 10 minutes) takes the date.
vision.selectlease#
- Request (after
vision.hello):{"op":"vision.to take it (only the worker it was offered to),selectlease","job"} {"op":"vision.to renew (every 30 s; 5 minutes).selectlease","job","lease","done"} - Answer:
{ok, lease, expires}, and when takenmachine,queryand `items: [{id, kind, dest, date, cf, thumb, main, size, duration, labels, description, text}].read`](#op-read) /While the lease lives the worker may [ readmanyexactly thosethumbandmainfiles.lost:true(no such job, not this lease),refused:true(not offered to this worker, or it may not analyse the machine),held:true.
vision.selected#
- Request:
{"op":"vision.:selected","body","sig"} bodya JSON text `{kind:"sv-select", host, job, lease, ts, scored:[{id, score, why}], failed:[{id, why}]}(or{…, error}` to give the job back: the host calls the next worker),sigasvision.put's. Answer:{ok:true}; refused asvision.put(signature, host,tsmore than 5 minutes off),lost:truewithout the live select lease.
Assistant jobs: the computers finish a request#
The phone hands an assistant request over once and may close, lose signal or be paused; the PC holding its backups
finishes it (iOS request #61; docs/assistant-jobs.md).
Caps assistant-job: 1 (2 since 0.14.0: shared albums, no consent; 3: assistant.job.cancel). The PC:
- takes the candidates from its index of the machine's plain dates: place (a circle), days (
from/to,days, the item's own local day), time of day, kind, night or day (the rules of album filters); and (assistant-job: 2) from the albums shared with the user that it holds (the reading'sshared), by the index fields each album item keeps; - selects by what they show (
content) asvision.selectdoes: the stored analysis and vectors first, a worker for the rest, up to 5,000 newest candidates; a shared album's items by the analysis the album keeps only (one never analysed is left out); nocontent: every candidate; - for
makeAlbum/shareAlbum, makes the album on the account service for the phone's member, on its own drive holding the phone's backups, with the standing filter and the shares, presenting the job and the phone's job ticket (jobTicket) (POST assistant/jobs/album); - adds the chosen items from its backups, as a filter adds them; an item held only in encrypted backups is copied
with the lent key, else listed in
encrypted; an item no backup here holds goes inneedsPhone; the chosen items of shared albums are cloned in asalbum.clonecopies them (each keeps its source and id); - tells the phone: POST assistant/jobs/done sends the member an
alert ("Night Chicago Views" / "23 photos added") and their devices
changed: ["album:<id>", "albums"]; only for a job sent with ajobTicket(ashowjob without one is read from its status).
The phone's Stop (assistant.job.cancel, assistant-job: 3, iOS request #73) ends a job
after the step it is on: what it did stays, its state is cancelled, and step 5 is skipped (no alert).
Jobs are kept 24 hours in memory (not across a restart: the status then answers notFound and the phone runs the
request itself); one runs at a time. The user's words stay with the job: never logged, never sent on. When assistant-job
is 0 or absent, or the submit is refused, the phone keeps today's path (it selects and adds itself).
assistant.job#
- Request:
{"op":"assistant..job","machine"?,"ticket"?,"jobTicket"?,"request","reading","key"?} machine: the phone's own (default); another machine under a grant (asvision.status) forshowonly: an album is made only from the requesting device's own backups.ticket: that grant's ticket.jobTicket: the phone's job ticket for this PC (POST assistant/jobs/ticket, 15 minutes), needed formakeAlbum/shareAlbumand for the done alert: the PC redeems it before it answers (POST assistant/jobs/redeem), which binds it to the job for its 24 hours, and presents it with the job to the album and done calls. Held with the job in memory only, never logged. From a computer (capsassistant-job: 4, the desktop window):machinenames the member's phone, noticket, andjobTicketis the one that computer took for the phone (assistant/): it is redeemed for the phone (one the service issued for anyone else is refused), the album and the alert are the phone's member's,jobs/ ticket {device} sharedis ignored, and the job is the sending computer's to follow and stop. A PC holding no plain backup of the phone answers{ok:false, reason:"not-at once, before the ticket is used.here"} request: the user's words (≤ 2000 characters).reading: the phone's reading of them:Field Meaning actionshow(keep the chosen ids),makeAlbum,shareAlbum(an album, shared). Default:makeAlbumwith aname, elseshow.nameThe album's name (≤ 100). Needed for an album. shareEmails to share the album with (an array; {emails}or one email too).shareAlbumneeds one.place{name?, lat, lon, radiusKm}(radius default 10 km).from,to,daysyyyy-MM-dd: the item's own local day,from/toinclusive;daysa list.timeFrom,timeToMinutes after the item's local midnight, together (wrapping when timeFrom>timeTo);"HH:mm"is taken too.kindall(default),photos,videos.contentWhat the pictures show ("view"), judged as vision.selectjudges; absent: no selection.nighttrue: at night (the analysis says so, or dark and the sun below −4° there and then).daytrue: in daytime (iOS request #62), the mirror of night: the analysis says day, else bright (0.25 or more) with the sun above the horizon there and then (6 am to 6 pm without a place); one the analysis calls night is never day; not withnight; also sent tovision.selectasday.standingThe album's standing filter, as POST albums/{id}/filter takes it (machines default to the phone). notBackedUpIds of matching items the phone holds and no PC has yet: listed in needsPhone.shared[{album, ticket}](assistant-job: 2, iOS request #64): the albums shared with the user, each with the phone's album ticket for it (as foralbum.clone); at most 100; also taken next toreading. Each ticket must be the sending phone's, owner or member of that album (checked with the account service). Only albums this PC holds are searched; the others come back insharedSkipped.key: true: a data key (32 bytes) follows as the next data frame, lent for this job only. It serves only the album copy of items held in encrypted backups (asalbum.add); it never opens anything to judge it. It is held in memory and dropped when the job ends or fails (or at once when the request is refused). - Answer at once:
{ok:true, accepted:true, job}; refused:{ok:false, error}(Missing reading,reading: …,An album is made only from the requesting device's own backups,This PC keeps no albums, `An album needs the phone's job ticket (jobTicket, from assistant/jobs/ticket),The account service refused the job ticket: {why}` (expired, redeemed already, for another PC, not the sending phone's, or the PC not signed in), `The job ticket is for show: it makes no album`, a grant refusal). The ticket is redeemed before this answer, so a job accepted never fails later on its ticket, however long it waits in the queue. - Refused at submit (0.14.0), before the ticket is redeemed:
{ok:false, error, reason}, nothing accepted, so the phone, still there, runs the request itself. Only two reasons (iOS request #64: no consent, every member's plain backups are analysed):signed-out(this PC is not signed in to the account service; any job),no-worker(a job withcontent, no worker on this PC or seen lately, and none of the candidates is analysed: neither the phone's own nor a shared album's held here). A job withoutcontent(place and dates only) needs no worker and is accepted.
assistant.job.status#
- Request:
{"op":"assistant.(the device that sent the job only; another, an unknown job, or one older than 24 hours or from before a restart:job. status","job"} {ok:false, notFound:true}). - Answer: `{ok, job, state, action, steps, result?, found?, album?, ids?, needsPhone?, added?, fromShared?,
sharedSkipped?, why?, timings}
(found,album,ids,needsPhone,added,fromShared,sharedSkipped`: the result's, repeated at the top for the phone).state:queued(behind another job) ·running·done·failed(why: the selection's reasonno-worker,signed-out,worker-busy, or the error) ·cancelled(assistant.job.cancel).cancelling: truewhile a cancelled job finishes the step it is on.steps:[{name, state, ms?, count?, why?}]in this order:candidates(count: matching place/days/time/kind/night/day),select(count: chosen; skipped withoutcontent),album,add(count: in the album),filter,share(count: shared with),notify;statewaiting | running | done | skipped | failed | cancelled(the step a cancel interrupted).result: `{action, found, album: {id, name} | null, added: [ids], encrypted: [ids], failed: [ids], needsPhone: [ids], shared: [emails], invited?, shareError?, filter, ids?}.added`: the items in the album (added now or there already).encrypted: held only in encrypted backups and no key was lent (without the key the PC cannot tell an item it does not hold from one in an encrypted date, so both land here).needsPhone: the items this PC holds no file of, plus the reading'snotBackedUp: the phone adds them itself when it backs them up (album.add as today).ids:showonly, the chosen ids of the phone's own items, newest first.filter: the standing filter was set.shareError: the share failed (the album stays). With the reading'sshared(assistant-job: 2):fromShared: [{album, name, ids}]the chosen items of each shared album (newest first; cloned into the album formakeAlbum/shareAlbum, and then inaddedtoo),sharedSkipped: [{album, why}]the albums not searched (not on this PC, or the ticket's refusal).foundcounts both.timings: ms{queue, candidates, select, album, add, notify, total}.
assistant.job.cancel#
The Assistant's Stop (iOS request #73; caps assistant-job: 3).
- Request:
{"op":"assistant.(the device that sent the job only; another, an unknown job, or one older than 24 hours or from before a restart:job. cancel","job"} {ok:false, reason:"notFound"}, as its status). - Answer:
{ok:true, job, state, cancelling?}.- A queued job is over at once:
state: "cancelled", every stepskipped; it never runs. - A running job stops after the step it is on:
state: "running", cancelling: true, thencancelledinassistant.job.status. The selection stops between itsvision.selectjobs and while it waits for a worker (that stepcancelled); the album and add steps finish first. The steps not run areskipped. - A job already over answers its state (
done,failed,cancelled) and is not changed:{ok:true, state:"done"}.
- A queued job is over at once:
- The job keeps what it did: an album made stays, items added stay, the result so far is in its status (
album,found,added).notifyisskipped(why: "cancelled: no alert"): no done alert and nochangedpush. A lent key is dropped, as at any end. - A PC without it (
assistant-jobbelow 3) answersUnknown request assistant.: the phone says the computer may finish the job and stops following it.job. cancel
{"op": "assistant.job.cancel", "job": "aj_3f9a1c07b2e4d5c6a7b8c9d0"}
{"ok": true, "job": "aj_3f9a1c07b2e4d5c6a7b8c9d0", "state": "running", "cancelling": true}
Other requests and updates#
There are no other peer requests. In particular:
- Updates are not a peer request: a PC checks for an update at once when a peer announces a newer
Ver(see Automatic updates). - Hello / info: the handshake carries the names and instance ids;
capsandstatusare the only information requests. - An op the PC does not know is answered
{"ok":false, "error":"Unknown request <op>"}.
The Photos viewer launch contract#
The Photos window on Windows, macOS and Linux (see The Photos window on a computer) is a web page served by the local app on this computer and shown inside the app's own window (WebView2, WKWebView, WebKitGTK). This contract is between the app window and that local server; it is not the peer protocol and never leaves the computer.
Starting the server#
Run photos open --json through the app's control channel (sbctl photos open --json on Windows, spacebackup photos open - on Linux and macOS, or the control socket / named pipe the app already uses):
{"url":"http://127.0.0.1:52814/?s=Yk3vQ9x2LmP0aR7tU4wE1zC8nB6dF5gH0jK2sV9qXcA", "port":52814, "secret":"Yk3vQ9x2LmP0aR7tU4wE1zC8nB6dF5gH0jK2sV9qXcA"}
- The server listens on 127.0.0.1 only, on a random free port; connections from anything but loopback are closed.
- The secret is 32 random bytes in base64url without padding (43 characters).
photos openstarts the server if it is not running; calling it again returns the same port and the current secret.
Loading the page#
- Load
urlin the window. The first request,/?s=<secret>, answers302to/withSet-, so the secret leaves the address bar. A wrong secret answers 401 with "This Photos window has expired. Open Photos again from Space Backup."Cookie: sbphotos<port>= <secret>; Path= / ; HttpOnly; SameSite= Strict - Instead of the URL, a host may set that cookie itself before the first load (the Windows window does), or send the header
X-on its own requests. The page itself works with the cookie.SpaceBackup- Secret: <secret> - To open a screen, append
#albums,#places,#typesor#sharedtourl(default: All). /serves the viewer (photos.html); its scripts, styles and images are embedded in the app (no external CDN, works offline).
Security rules#
| Check | Answer |
|---|---|
Host other than 127.0.0.1:<port> or localhost:<port> (DNS rebinding) | 421 Wrong host |
Origin other than the viewer's own | 403 Other origins are refused |
Sec-Fetch-Site other than same-origin or none | 403 Other sites are refused |
A POST with the cookie only and no Origin | 403 A request that changes something must come from the viewer |
| No valid cookie or header | /api/…: 401 Not signed in to this viewer; pages: 401 with the "expired" page |
| Method other than GET, HEAD, POST | 405 |
Every answer carries Cache-Control: no-store (nothing decrypted lands in the web view's disk cache), X-, Referrer-, Cross-, X-Frame-Options: DENY; pages carry the CSP default-. No CORS headers, ever. The secret is compared in constant time.
Limits: 64 connections at once, keep-alive connections closed after 2 minutes idle, request head at most 32 KB (431), body at most 1 MB (413).
Endpoints#
| Endpoint | Does |
|---|---|
GET /api/session | {platform, email, restoreTo, saveTo, cache:{bytes, limit}}: the signed-in email, default Restore and Save folders, cache size. |
GET / | The photo sources (own devices, shared devices, albums), as photos sources. |
GET / | {cursor, changed, full}: live updates, as changes wait. Without after, the cursor to start from, at once; with it, the topics this computer learned of after it (albums, album:<id>, backups:<device>, devices, shares, faces, settings, languages, pictures, notifications, destinations, computers, runs…; each once, oldest first), held up to wait seconds (default and at most 25) until one comes; full: true: the cursor is not known here (the app restarted) or too old, read everything. Not for a TV's session or a page window. |
GET / | {source, from, date, problem, items}: one source's items, as photos list --source. |
POST / | {"thumbs":{id: base64 JPEG}, "later":[ids]}, up to 200 ids. make: false: stored thumbnails only, the others named in later (ask again with make, the default). |
GET /api/thumb?id= | One thumbnail (JPEG), 404 when none. |
GET /api/preview?id= | A picture the web view can show: JPEG for HEIC/HEIF, RAW, TIFF and pictures larger than 4,096 px. |
GET / | The original file (HTTP Range: one range, 206/416); download=1 adds Content-. |
GET /api/video?id= | The item's video, with HTTP Range, so it plays while arriving. |
POST / | {exit, text, data}: the same dispatcher as the command line, limited to photos sources|list|show|save|preview|restore|add|new-, albums list|show|create|share|unshare|restore|caption, share list, history, browse, restore, account status, dest list. Paths in arguments must be full paths. Anything else: exit code 2, "… is not available from the Photos viewer". |
Errors are JSON {"error":"…"}: 400 (bad request or usage), 404 (not found, "That file is not in the backup."), 502 (the backup could not be read: a PC offline, a decryption problem).
Folder picker#
Optional. The page posts the JSON string {"op":"pickFolder", "id":"…", "start":"<path>"} to window. (WKWebView, WebKitGTK) or window.chrome.webview (WebView2). The host answers by running window. in the page, or (WebView2) by posting {"id":"…", "value":"<path>"} back. Without a host the dialog keeps a text field with the default folder.
Lifetime#
- The server runs as long as the app (Windows tray app, or the Linux/macOS daemon) runs.
- The secret changes when the app restarts and when the user signs out (
account signout; the encrypted thumbnail cache is emptied too). Open windows then show "This Photos window has expired. Open Photos again from Space Backup.": runphotos open --jsonagain and load the newurl. - The window loads only the viewer's own origin; other http, https and mailto links open in the user's browser, other schemes are refused;
window.close()closes the window. The Windows window wipes its browser profile when it opens and closes, so the page keeps no state between openings.