iCloud API
This is a high level documentation of the reverse engineered iCloud API, used in this application.
Postman Collection
In the debugging process, a Postman Collection has been created, in order to interact freely with the API.
In order to use it, username and password variables have to be set in the selected environment. Make sure that the Collection Variables are reset upon changing the environment. Also if you want to reset the current session, reset those variables and restart the authentication process
Authentication process
This application is using the same authentication flow as icloud.com.
This research concluded in the following flow:
To execute this flow in the provided Postman Collection, follow these steps:
- Run
01-Enter PwdRequest - If the status code is
409an MFA code is required, if code is200continue to 3.- To resend the MFA code to a trusted device, run
01-- Resend 2FA In-Apprequest - To resent the MFA code to a phone through a call or sms, run
01-- Resend 2FA Phone(you may need to adjust the body of this request) - Use the
02-Enter 2FAto provide a MFA code (by setting thecodevariable in the body), status code204expected - Run
03-Trust DeviceRequest, expecting 204
- To resend the MFA code to a trusted device, run
- Acquire iCloud Cookies through
04-Setup iCloudrequest - Setup the Photos Library (and select either the primary or shared library through the environment variable
sharedLibrary) through05-Setup iCloud Photosrequest - optionally (and done by the application) Check, that the Photos Library has finished indexing with
06-Check indexing State - Now use the
iCloud Photos Libraryfolder, to execute actions against the iCloud Photos library
The Postman Collection expects the following Environmental variables to be defined:
- username set to the iCloud username
- password set to the iCloud password
- sharedLibrary set to true in case the share library should be used
