BSD-3-Clause licensed by Tim Emiola
Maintained by Tim Emiola
This version can be pinned in stack with:hstratus-notes-0.1.0.3@sha256:014f7713709e8e8c356cf8c674c6e674be931efcc89146b989435b994b50beb7,4214

Module documentation for 0.1.0.3

Used by 2 packages in nightly-2026-08-01(full list with versions):

hstratus-notes — access to iCloud Notes

hstratus-notes reads notes and folders from iCloud Notes using an authenticated session from hstratus-auth.

The library provides read-only access to the Notes CloudKit database: listing folders, fetching recent notes, and downloading note content.

Disclaimer — use at your own risk

  • This library is unofficial and not supported by Apple.
  • The iCloud Notes API it uses is undocumented and may change without notice.

Usage

After a successful login with hstratus-auth, construct a NotesApi value and use it to browse notes.

Listing recent notes

import Network.HStratus.Http (mkApi, login, AuthState (..))
import Network.HStratus.Http.Endpoints (Realm (..))
import Network.HStratus.Notes

example :: IO ()
example = do
  api <- mkApi Usual
  result <- login api
  case result of
    Authenticated sess ad -> do
      na    <- mkNotesApi ad sess api
      notes <- recentNotes na
      mapM_ print notes
    _ -> putStrLn "Unexpected result"

Listing folders

foldersExample :: NotesApi -> IO ()
foldersExample na = do
  folders <- noteFolders na
  mapM_ print folders

Listing notes in a folder

folderNotesExample :: NotesApi -> FolderId -> IO ()
folderNotesExample na fid = do
  notes <- notesInFolder na fid
  mapM_ print notes

Fetching and decoding a note body

import qualified Data.Text.IO as TIO
import Network.HStratus.Notes
import Network.HStratus.Notes.Markdown (noteToMarkdown)

getNoteExample :: NotesApi -> NoteId -> IO ()
getNoteExample na nid = do
  mnote <- getNote na nid
  case mnote of
    Nothing   -> putStrLn "Note not found"
    Just note -> do
      result <- decodeNoteBody (noteBodyBytes note)
      case result of
        Left err -> putStrLn $ "Decode error: " <> err
        Right nt -> TIO.putStrLn (noteToMarkdown nt)

getNote returns Nothing when the note has been deleted since the listing was fetched. decodeNoteBody returns Left when the compressed protobuf cannot be decoded.

CLI usage

A command-line interface using this behaviour is provided by the hstratus package.

Command Description
hstratus notes list-note-folders List all Notes folders
hstratus notes list-notes List notes, optionally filtered by folder name
hstratus notes get Fetch and display a note body
hstratus notes export-folder Download all notes in a folder to local files

Apple and the Apple logo are trademarks of Apple Inc., registered in the U.S. and other countries and regions. iCloud is a service mark of Apple Inc., registered in the U.S. and other countries and regions.

Changes

Revision history for icloud-notes

icloud-notes uses PVP Versioning.

0.1.0.3 – 2026-07-30

  • Add protobuf and cereal dependencies; replace proto3-wire for protobuf decoding.

0.1.0.2 – 2026-07-30

  • Remove unused proto3-suite dependency.

0.1.0.1 – 2026-07-30

  • Relax hstratus-auth upper bound to <0.3.

0.1.0.0 – 2026-07-28

  • Initial version.