Connecting an Apple Account to Figment is one OAuth flow, but each service then reaches ready on its own. iMessage, Contacts, Calendar, and Reminders each have their own Apple-side approval, sync, and Mac permission sequence. Check each service's state before your app makes requests against it, because a signed-in account does not automatically mean a ready service. For the developer overview, see OAuth for iCloud.
What states can a service be in?
Figment tracks a state for every service on a connection. The state appears in the connection.services map returned by GET /v1/connections/{connection_id}.
| State | Meaning |
|---|---|
connecting | Initial setup in progress |
needs_approval | A user action is required before this service can proceed |
syncing | The service is active but local data is still downloading |
ready | The service is available for requests within your granted scopes |
offline | The Mac worker has lost contact; most cases recover automatically |
reconnect_required | The user must re-authorize part of the connection |
revoked | The user removed access; will not recover without a new grant |
Non-ready services reject operations, and a service in syncing is not yet ready, so reads will fail. Check state at the start of each session, not only at connection time.
How do I connect an Apple Account?
Register your app first to get a client_id and to set your exact HTTPS redirect URI. The sandbox is free. Live plans are $14 or $29 per month per connected Apple Account, and you request a demo for live access.
- Build an authorization URL to
https://figment.so/icloud/authorize. Includeclient_id, your exactredirect_uri,response_type=code, the scopes you need, astatevalue, and a fresh PKCEcode_challengewithcode_challenge_method=S256. - Redirect the user to that URL. Figment's hosted screen signs the user into Figment and presents the app-consent step, where the user selects an Apple Account connection and approves the requested scopes. Apple sign-in and trusted-device approval on the Mac are part of connection setup and happen before the OAuth grant is issued. All codes and tokens are issued by Figment, not Apple.
- Figment redirects to your
redirect_uriwithcodeandstate. Verifystatematches before continuing. - Exchange the code at
POST https://figment.so/api/icloud/oauth/tokenwithgrant_type=authorization_code,client_id,redirect_uri,code, andcode_verifierasapplication/x-www-form-urlencoded. - The response includes
access_token,refresh_token,expires_in,scope, andconnection_id. Store theconnection_id, which identifies this Apple connection in every later API call. Access tokens expire after 900 seconds. Refresh usinggrant_type=refresh_tokenwithclient_idandrefresh_token, and store the rotated refresh token. Your app never receives the Apple password.
What should I check for each service the first time?
The table covers the services with a public customer endpoint. After the OAuth flow, confirm each service your app depends on reaches ready before you make data requests.
| Service | Availability | Apple-side requirement | First-time note |
|---|---|---|---|
| iMessage | Live: requires account setup and approval; live access depends on capacity | Trusted-device approval; Messages in iCloud enabled on iPhone and Mac | History can be incomplete even when ready; check historyComplete on list responses (Apple guide) |
| SMS / MMS / RCS | Live: same connection as iMessage | iPhone must be on, online, and signed into the same Apple Account | Messages in iCloud includes SMS, MMS, and RCS automatically; a separate forwarding switch is not required when Messages in iCloud is enabled (Apple guide) |
| Contacts | Synthetic sandbox only; live access unavailable | None | Sandbox returns invented data; every response includes "scope": "synthetic sandbox data" |
| Calendar | Synthetic sandbox only; live access unavailable | Supply both start and end ISO timestamps; range must not exceed 366 days | Sandbox calendar items are synthetic; end must follow start |
| Reminders | reminders:read scope in the Full iCloud suite; synthetic data in the sandbox | None | completed defaults to false; pass completed=true to include completed items |
Passwords and Notes are also OAuth for iCloud scopes (credentials:use and notes:read; see /icloud). Other Apple services (Mail, Photos, iCloud Drive, Safari, Voice Memos, Find My, Home, Shortcuts, and Books) sync locally on the connected Mac but have no public Figment customer endpoint. Figment does not currently expose a customer API for them.
How do I check status with the API?
After the OAuth exchange you have a connection_id. Fetch the connection to read per-service state:
GET https://figment.so/api/icloud/v1/connections/con_...
Authorization: Bearer ACCESS_TOKEN
Each entry in connection.services is an object with state, reason, and observedAt (epoch milliseconds). Only services on the granted connection appear:
{
"connection": {
"id": "con_...",
"mode": "sandbox",
"services": {
"messages": {
"state": "ready",
"reason": null,
"observedAt": 1731369600000
},
"contacts": {
"state": "syncing",
"reason": null,
"observedAt": 1731369590000
}
}
}
}
Proceed with service-specific operations only once that service shows ready. For iMessage, also check historyComplete on list responses, because native history can still be downloading after the service reaches ready. A ready state does not guarantee delivery of outbound messages.
What if a service shows offline or reconnect_required?
offline usually means the Mac has temporarily lost contact. Most cases resolve automatically. If the state persists, confirm the Mac is on and connected to the network.
reconnect_required means the user must re-authorize part of the connection, typically because a trusted-device session expired or a system permission was revoked. Send the user back through the authorization flow to restore it. For Mac system permissions (Full Disk Access, Automation, Contacts, Calendars), see Grant the Mac Permissions Your Connector Needs. For iMessage history that is incomplete after recovery, see Fix Missing iMessage History on a Connected Mac.
Where do I go next?
Register your app and start in the free sandbox. Live plans are $14 or $29 per month per connected Apple Account; request a demo for live access. Manage grants and revocations at your account page. For safe sending and idempotency, see Prevent Duplicate iMessages After a Timeout.