Pairing devices
A device (a “worker” in the API, ids starting wkr_) is paired by an account that is already signed in. Pairing follows the OAuth device flow: a device with no account shows a code, and the account claims it.
Device Mailcycle API Account │ │ │ ├─ POST /workers/pairing-session ► │ │◄─ { token, code } ─────────────┤ │ ├─ show QR(token) and code │ │ ├─ GET …/pairing-session/:token ─► │ │◄─ state: waiting ──────────────┤ │ │ │◄─ POST /workers/pair/lookup ───┤ │◄─ state: operator_detected ────┤ │ │ │◄─ POST /workers/pair ──────────┤ │◄─ awaiting_inbox + credential ─┤ (credential sent once) │ │ │◄─ POST /workers/:id/inboxes ───┤ │ │◄─ POST /workers/:id/keys ──────┤ │◄─ state: inbox_assigned ───────┤ │ └─ open mail │ │On the device
Section titled “On the device”POST /workers/pairing-sessionwith aplatform(ios,android,weborunknown) and adeviceName. No token needed. The response carries a pairingtokenand an 8-digitcode. Show the token as a QR code, and the code for typing.- Poll
GET /workers/pairing-session/:token. The state moves throughwaiting,operator_detected,awaiting_inboxandinbox_assigned. The device credential is returned once, on the first poll after the account claims the device. - To give up,
DELETE /workers/pairing-session/:token.
On the account
Section titled “On the account”POST /workers/pair/lookupwith the 8-digitcodefinds the waiting session.POST /workers/pairclaims it, with thesessionId, a client-generatedworkerId(wkr_…) and the sealedprofile. On Free, a second device returnsworker_limit_reached.- Assign it an address with
POST /workers/:id/inboxes, then hand it the sealed address keys withPOST /workers/:id/keys.
Guarantees
Section titled “Guarantees”- Pairing tokens are random, generated by the server and stored only as a hash.
- The 8-digit code is a lookup key onto the token, not the secret itself.
- Sessions have no timer, so a device can wait as long as it needs. Each is used once. Sessions nobody claims are removed after 14 days.
- The device credential is minted only after the account confirms, is scoped to that device, and can be revoked on its own.
- Code lookups are limited: after ten failed lookups in five minutes, lookups return
429.
Managing devices
Section titled “Managing devices”GET /workers lists devices, PATCH /workers/:id replaces the sealed profile or sets status to disabled, and DELETE /workers/:id removes a device. Its addresses stay on the account, unassigned. See Devices.