--- method: GET path: /api/media-items/:id/download auth: jwt area: media-items --- # Download Media Item File Serves the book file itself (epub, pdf, …) for the given media item, enforced against the requester's **visible-library set** (family lens). This is the registered route — distinct from the dead `MediaHandler.DownloadBook` code path referenced by pre-2026 docs. Success is the raw file bytes with the file's MIME type. There is no JSON body. ## Errors | Status | Body | When | | ------ | ---- | ---- | | 400 | `{"error": "invalid library ID"}` / `{"error": "invalid path"}` / `{"error": "invalid media item ID"}` | malformed ids | | 403 | `{"error": "library not accessible"}` | library outside the visible set | | 404 | `{"error": "book not found"}` / `{"error": "book file not found"}` / `{"error": "file not found"}` | missing row or file on disk | | 500 | `{"error": "failed to check library access"}` | unexpected server error |