Use Apple's documented protocols for Calendar, Reminders, Contacts and Mail, and Mac automation for iMessage. iMessage has no first-party REST API, while Calendar does, and getting that wrong early costs weeks.
What are the two integration layers?
Apple exposes two separate surfaces for third-party access.
The native API tier uses documented, standards-based protocols: CalDAV for Calendar and Reminders, CardDAV for Contacts, and IMAP/SMTP for Mail. Apple's servers speak these directly, and your app connects over HTTPS without a Mac.
The Mac UI automation tier covers everything else, chiefly iMessage but also Notes, Shortcuts, and anything that lives only in a macOS app. Apple provides no public server-side API for these, so the only third-party path runs through the Messages app, its local SQLite database (chat.db), and either AppleScript or private framework injection. This tier lives on a Mac, not in a data center.
Conflating the two is the most common early design mistake. CalDAV is reliable and stateless. AppleScript combined with chat.db polling is stateful, brittle, and sensitive to OS updates.
How does the native API tier work?
For Mail, Calendar, and Contacts, users authorize a third-party app through their Apple Account and the app connects via standard protocols (Apple support: authorize third-party apps). The endpoints are:
- Calendar
- CalDAV at
caldav.icloud.com, RFC 4791, HTTPS port 443. - Reminders
- CalDAV (VTODO components), same endpoint and authentication as Calendar.
- Contacts
- CardDAV, same authentication requirements.
- IMAP (read) and SMTP (send), at the hosts listed below.
imap.mail.me.com IMAP (read)
smtp.mail.me.com SMTP (send)
Third-party clients authenticate with an App-Specific Password (ASP): a reusable credential generated at account.apple.com that substitutes for the main Apple password in IMAP, SMTP, CalDAV and CardDAV clients (Apple support: App-Specific Passwords). Two-factor authentication must be active. Each account holds up to 25 active ASPs, and all are revoked automatically when the Apple Account password changes.
Apple has a gated enrollment path for approved third-party apps at developer.apple.com/contact/request/icloud-oauth2. It requires individual application and approval, and the page requires a Developer sign-in. Verify enrollment and approval terms independently before building on it.
This tier suits server-to-server automation: it is stateless, runs from any server, and needs no connected Mac. Its scope is limited to the services Apple has documented it for.
How does the Mac UI automation tier work?
iMessage, Notes, Shortcuts, and similar services have no Apple-documented server API, so every third-party integration reaches them through macOS itself.
The common pattern combines AppleScript with chat.db polling. AppleScript handles sends and chat creation, and a periodic read of the Messages SQLite database (~/Library/Messages/chat.db) detects incoming messages. Some bridges add private framework calls in native Objective-C; that goes beyond basic messaging and is not covered here.
This architecture has real constraints:
- A running Mac is mandatory. The integration cannot move to Linux or a container without running macOS in a VM.
- AppleScript is synchronous and slow. Burst operations or high-volume sends queue up and can slow the system.
chat.dbreflects local sync state. If iCloud Message sync is behind, reads return incomplete history. A row appearing inchat.dbis not proof of delivery.- Private framework injection breaks on major OS updates. Each macOS release can change private API signatures, requiring rapid patching.
- System Integrity Protection and app sandboxing limit what a third-party process can read or inject, and these boundaries tighten with each release.
No Apple-documented first-party REST API exists for iMessage. The Mac automation tier is the only confirmed third-party path.
What fails in each iCloud service, and how do I recover?
This table maps each service to its access tier, its most common failure mode, and a recovery path. These are real operational concerns, and apps that treat the whole surface as one reliable API will hit them in production.
| Service | Access tier | Typical failure mode | Recovery path |
|---|---|---|---|
| Calendar | Native: CalDAV (RFC 4791) | App-Specific Password revoked on Apple Account password change | Generate a new ASP at account.apple.com; re-authorize |
| Reminders | Native: CalDAV (RFC 4791, VTODO) | App-Specific Password revoked on Apple Account password change | Generate a new ASP at account.apple.com; re-authorize |
| Contacts | Native: CardDAV | Same ASP revocation pattern | Same as Calendar |
| Native: IMAP / SMTP | IMAP connection dropped; SMTP auth rejected | Reconnect with valid ASP; check 2FA status | |
| iMessage | Mac automation: AppleScript + chat.db | macOS update breaks AppleScript handler or optional private API bundle | Patch automation layer; validate against new OS version |
| iMessage | Mac automation: chat.db polling | Sync lag: local db behind iCloud; messages missing until sync catches up | Poll historyComplete flag; do not assume full history |
| Notes | Mac automation: AppleScript / native | Locked notes block reads | Prompt user to unlock; handle per-note error |
| Shortcuts | Mac automation: Shortcuts app | Action not installed on Mac (phone-only action) | Filter to Mac-compatible installed actions only |
| Photos | Mac sync: Photos library on Mac | Cloud-only asset not yet downloaded | Trigger download; wait for asset to be locally available |
| Drive | Mac sync: iCloud Drive daemon on Mac | File evicted or not yet synced locally | Request local copy; check sync status before reading |
| Find My | Mac automation (native support required) | Sharing settings revoked or location service off | Surface error; do not silently retry |
| Voice Memos | Mac automation: synced recordings | Recording still uploading from watch or phone | Poll sync state; treat partial sync as incomplete |
Which tier does my app need?
If your app needs only Calendar, Reminders, Contacts, or Mail, call CalDAV, CardDAV, or IMAP directly from any server. You need no Mac infrastructure and no AppleScript, and your team manages ASP rotation and reconnection when Apple Account passwords change.
If you need iMessage, or any service that lives only in macOS, you need a managed Mac. That means uptime responsibility, macOS version tracking, private-API patch cycles, and sync-lag handling, and that operational surface grows with scale.
Figment's OAuth for iCloud focuses on the Mac automation tier. Its iMessage REST API lets your app send, search, and read messages through a hosted, signed-in Mac without building or operating that infrastructure. iMessage access requires an approved Figment account and setup, and live access depends on capacity and approval. The connection status reflects each service individually (connecting, needs_approval, syncing, ready, offline, reconnect_required, revoked), and non-ready services reject operations rather than returning stale data.
Reminders is an OAuth for iCloud scope, reminders:read, as are Passwords and Notes (/icloud). For Calendar and Contacts, Figment provides a synthetic read-only sandbox so you can build and test against the API shape. Live customer access to those two services is not currently available through Figment. If you need live CalDAV or CardDAV access today, the native protocols above remain the direct path, and your app handles them independently.
Two scopes control iMessage access through Figment: messages:read for history and search, and messages:send for outbound messages. Both can be approved within a single app grant, and read access does not imply sending. For the full OAuth grant and REST endpoint reference, see OAuth for iCloud: Connect Apple Data to Your App.
Which should I choose?
Connect directly to native protocols if your app only touches Calendar, Reminders, Contacts, or Mail, your team is comfortable managing ASP rotation, and you do not need iMessage, Notes, or Shortcuts.
Use Figment's OAuth for iCloud if you need iMessage, Notes, Reminders, or Passwords access and want to avoid building and operating Mac infrastructure, or if you want to test against Calendar or Contacts data while native live access is in development.
Both paths require a real Apple Account, real trusted-device approval, and careful sync-state management. Neither bypasses Apple's permission model.
Developer access starts at $14/month per connected Apple Account for the Apple Passwords plan, and the Full iCloud suite, which includes Messages, is $29/month. Sandbox access is free and includes synthetic data so you can build against the API shape before going live. For live access, request a demo.
Register your app and explore the sandbox
Related: Build or Buy Your iMessage Connection Service, Choose MCP or REST for Your iMessage Integration