Importing data exported from Safari
Transfer bookmarks, saved passwords, and other information between browsers.
Overview
In iOS, iPadOS, and visionOS, people can export their browser data to a file from Safari’s settings in Settings. In macOS, the person exports Safari’s browser data by choosing File > Export from Safari. In either case, the system presents the Export Browsing Data sheet, which walks the person through the export process. Alternatively, you can present the export sheet from a browser app that you develop by calling the SFSafariSettings class’s openExportBrowsingDataSettings(completionHandler:) method.
Safari exports the data in a ZIP archive that contains a bookmarks file, a passwords file, and a payment cards file. For each Safari profile, the ZIP archive also includes a browser history file and a Safari extensions file. The files have localized file names; in the en_US locale, their names are:
- Bookmark data
Bookmarks.html- Passwords
Passwords.csv- Browser history
History.json- Payment cards
PaymentCards.json- Safari extensions
Extensions.json
When someone creates multiple profiles, Safari exports the browser history and extension information for each profile into a separate file with the profile name as a filename suffix.
To import this data, create UI in your browser that someone uses to share the ZIP archive they export from Safari. Unzip the file, and use the information in the sections below to interpret the contents that you load into your browser’s data model.
Your browser can also export its data in the same format for someone to import into Safari.
Import bookmarks and Reading List
Safari exports bookmarks in an HTML file using the Netscape Bookmarks file format. The Reading List is a sub-folder with the identifier com.apple.ReadingList.
Import Safari passwords
Safari exports passwords in a comma-separated values (CSV) file that includes a titles row and contains the following columns:
TitleA name for the saved password.
URLA URL for the website that someone saved the password for.
UsernameThe username associated with the password.
PasswordThe saved password.
NotesFree-form notes that the person associated with the password.
OTPAuthA URL that uses the otpauth scheme and identifies the one-time passcode (OTP) generator that the website uses as a second factor with the password, for example,
otpauth://totp?secret=ASDFA&algorithm=SHA1&digits=6&period=30.
Understand JSON metadata
Safari exports browser history, extensions, and payment cards as JSON files. The top-level object in each file contains a metadata key, whose value is a JSON object containing these keys:
browser_nameA string that’s web browser name, which is
Safariif someone exported the data from Safari on iOS, iPadOS, macOS, or visionOS; orSafari Technology Previewif someone exported the data from Safari Technology Preview on macOS.browser_versionA string that’s the version of Safari that exported the data, for example
18.2.data_typeA string that describes the data in the file; one of
history,extensions, orpayment_cards.export_time_usecAn integer that’s the UNIX timestamp (the number of microseconds since midnight in the UTC time zone on January 1, 1970) at which Safari exported the file.
schema_versionAn integer that’s the version of the export schema.
Import browser history
The top-level object in the history JSON file contains a history key, which has a value that is an array of objects representing websites that Safari visited. Each object in the array contains these keys:
urlA string that’s the URL of the history item.
titleAn optional string that, if present, is the title of the history item.
time_usecAn integer that’s the UNIX timestamp in microseconds of the latest visit to the item.
destination_urlAn optional string that, if present, is the URL of the next item in the redirect chain.
destination_time_usecAn optional integer that’s present if
destination_urlis also present and is the UNIX timestamp (the number of microseconds since midnight UTC, January 1, 1970) of the next navigation in the redirect chain.source_urlAn optional string that, if present, is the URL of the previous item in the redirect chain.
source_time_usecAn optional integer that’s present if
source_urlis also present and is the UNIX timestamp in microseconds of the previous navigation in the redirect chain.visits_countAn integer that’s the number of visits the browser made to this item, and is always greater than or equal to
1.latest_visit_was_load_failureAn optional Boolean that’s
trueif Safari failed to load the site when someone most recently tried to access it; otherwise, it’sfalse.latest_visit_was_http_getAn optional Boolean that’s
trueif the last visit to this item used the HTTPGETmethod; otherwise, it’sfalse.
When the web server redirects Safari to a different URL, the history list contains all of the URLs in the chain of redirections. Link items in the redirection chain by comparing the url and time_usec fields in one history item with the destination_url and destination_time_usec of the item that redirected Safari to it, and the source_url and source_time_usec of the item that it redirected Safari to, for example:
...
{
"url" : "https://maps.apple.com/",
"time_usec" : 1722367302951213,
"destination_url" : "https://www.apple.com/maps/",
"destination_time_usec" : 1722367302951310
},
{
"url" : "https://www.apple.com/maps/",
"time_usec" : 1722367302951310,
"title" : "Maps - Apple",
"source_url" : "https://maps.apple.com/",
"source_time_usec" : 1722367302951213
},
...Import payment cards
The top-level object in the payment cards JSON file contains a payment_cards key, which has a value that is an array of objects representing the payment cards the person stored in Safari. Each object in the array contains these keys:
card_numberA string that is the payment card number.
card_nameAn optional string that, if present, is the name the person gave to the payment card.
cardholder_nameAn optional string that, if present, is the name of the cardholder.
card_expiration_monthAn optional integer that, if present, is the month of the card’s expiration date.
card_expiration_yearAn optional integer that, if present, is the year of the card’s expiration date.
card_last_used_time_usecAn optional integer that, if present, is the UNIX timestamp of the most recent occasion the person used the payment card.
The object looks like this example:
{
"card_number" : "0000000000000000",
"card_name" : "My Bank Card",
"cardholder_name" : "Mei Chen",
"card_expiration_month" : 11,
"card_expiration_year" : 2027,
"card_last_used_time_usec" : 1722730594744987
}Import extension information
The top-level object in the extensions JSON file contains an extensions key, which has a value that is an array of objects representing the Safari App Extensions, Safari Web Extensions, and Safari Content Blockers that the person installed and enabled in their Safari profile. Each object in the array contains these keys:
composed_identifierA string that’s the bundle identifier of the extension followed by the Developer Team ID, for example
com.example.great-app.browser-extension (AB67HSA2XZ).developer_nameA string that’s the name of the extension’s developer.
display_nameA string that’s the display name of the extension.
marketplace_lookupA JSON object that contains information you use to discover the extension’s containing app in its marketplace, which for Safari extensions is the App Store or Mac App Store.
The marketplace_lookup object contains these keys:
store_identifierA string that’s the identifier in the marketplace for the app that contains the Safari extension.
ios_extension_bundle_identifierA string that, if present, is the bundle identifier of the Safari extension on iOS corresponding with this Safari extension on macOS.
ios_app_bundle_identifierA string that, if present, is the bundle identifier of the iOS app corresponding with the macOS app that hosts this Safari extension.
macos_extension_bundle_identifierA string that, if present, is the bundle identifier of the Safari extension on macOS corresponding with this Safari extension on iOS.
macos_app_bundle_identifierA string that, if present, is the bundle identifier of the macOS app corresponding with the iOS app that hosts this Safari extension.
For more information on bundle identifiers, see CFBundleIdentifier.