hstratus-notes: Access iCloud Notes

[ bsd3, library, network ] [ Propose Tags ] [ Report a vulnerability ]

Browse notes and folders from iCloud Notes using an authenticated session from the hstratus-auth library.

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

This library is unofficial and not supported by Apple. It may break without warning if Apple changes their API.


[Skip to Readme]

Modules

  • Network
    • HStratus
      • Network.HStratus.Notes
        • Network.HStratus.Notes.Markdown
        • Network.HStratus.Notes.Note

Downloads

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0
Change log ChangeLog.md
Dependencies aeson (>=2.0 && <2.3), base (>=4.12 && <5), base64-bytestring (>=1.0 && <2.1), bytestring (>=0.10.8 && <0.11 || >=0.11.3 && <0.13), containers (>=0.6 && <0.8), hstratus-auth (>=0.1 && <0.2), hstratus-notes, http-client (>=0.5 && <0.8), http-types (>=0.12.1 && <0.13), proto3-suite (>=0.7 && <0.11), proto3-wire (>=1.0 && <2), text (>=1.2.3 && <2.2), time (>=1.9 && <1.15), zlib (>=0.6 && <0.8) [details]
Tested with ghc ==9.2.8, ghc ==9.4.8, ghc ==9.6.7, ghc ==9.8.4, ghc ==9.10.2, ghc ==9.12.1
License BSD-3-Clause
Copyright (c) 2026 Tim Emiola
Author Tim Emiola
Maintainer Tim Emiola <adetokunbo@emio.la>
Uploaded by adetokunbo at 2026-07-28T12:48:16Z
Category Network
Source repo head: git clone https://github.com/adetokunbo/hstratus.git(hstratus-notes)
Distributions
Downloads 0 total (0 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs pending
Build status unknown [no reports yet]

Readme for hstratus-notes-0.1.0.0

[back to package description]

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.