Import Pinboard Backup

Posted by agiletortoise, Last update over 1 year ago

Tool for migration of bookmarks from the Pinboard web bookmarking service into drafts.

To generate a backup file, visit the Pinboard website, click on Settings > Backup, and export a JSON format backup file. Download this file and save it to the root of the iCloud Drive/Drafts folder, naming it “pinboard_export.json”, then run this action.

You will be prompted to confirm the import, and provide an optional additional tag to assign to the newly create drafts.

Each pin in the backup will be imported as a new draft, with the tags assigned in Pinboard preserved, and the description, URL, and original pin timestamp in the text. You can modified the template variable defined in the first script step of this action to alter the import formatting. The original pin timestamp will also be assigned to the creation date of the draft.


  • script

    // path to the Pinboard export file within your `iCloud Drive/Drafts` folder.
    // defaults to "pinboard_export.json" at the root level of the Drafts folder.
    const path = "pinboard_export.json"
    // default value for new tag to assign to any imported drafts
    // tags from pinboard will also be preserved
    const defaultNewTag = "pinboard"
    // template for content of the drafts
    // special tags:
    // 	    [[pb_description]] - Title of the page from the pin
    //     [[pb_extended]] - Any notes you added when pinning
    //     [[pb_href]] - URL
    //     [[created]] - original pin timestamp
    const template = `[[pb_description]]
    Pinned: [[created|=longDateTime]]
    Tags: [[pb_tags]]
  • script

    let f = () => {
    	let fm = FileManager.createCloud()
    	let s = fm.readString(path)
    	if (!s) { 
    		alert(`Unable to read file. To use this action, visit Pinboard and export a JSON format backup from settings and put that file at “${path}“ in your “Drafts“ folder in iCloud Drive.`)
    		return false
    	let data = JSON.parse(s)
    	if (!data) {
    		alert(`Invalid backup file, could not parse JSON.`)
    		return false
    	let p = new Prompt()
    	p.title = "Pinboard Import"
    	p.message = `Import ${data.length} item(s) from Pinboard export file.`
    	p.addTextField("newTag", "Assign Additional Tag", defaultNewTag, {
    		"autocapitalization": "none", "placeholder": "optional tag"
    	p.addSegmentedControl("folder", "Create in", ["Inbox", "Archive"], "Archive")
    	p.addButton("Import", "Import", true)
    	if (! { return false }
    	const newTag = p.fieldValues["newTag"]
    	const createInArchive = p.fieldValues["folder"] == "Archive"
    	for (let item of data) {
    		let d = new Draft()
    		let t = new Date(item['time'])
    		d.createdAt = t
    		d.isArchived = createInArchive
    		let tags = item['tags'].split(" ").map(x => x.trim())
    		if (newTag.length > 0) {
    		for (let tag of tags) {
    			if (tag.length > 0) {
    		d.setTemplateTag("pb_href", item.href)
    		d.setTemplateTag("pb_description", item.description)
    		d.setTemplateTag("pb_extended", item.extended)
    		d.setTemplateTag("pb_tags", item.tags)
    		d.content = d.processTemplate(template)
    	return true
    if (!f()) {


  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.