{
  "id": "qdS91sG3hztdG5ph",
  "name": "Icon Metadata Exporter for Iconfinder",
  "tags": [
    {
      "id": "BQOruVpPYK0Bwfmm",
      "name": "published",
      "createdAt": "2025-11-01T00:26:11.530Z",
      "updatedAt": "2025-11-01T00:26:11.530Z"
    }
  ],
  "nodes": [
    {
      "id": "82b67e73-e06b-4076-bdb7-47a023dd70d6",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -480,
        -140
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "55e848a7-d8ba-42dd-abfe-5b70f0a155c1",
      "name": "Get Iconsets",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -140,
        -40
      ],
      "parameters": {
        "url": "=https://api.iconfinder.com/v4/users/{{ $json.user }}/iconsets?count=100&offset=0",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "={{$json.authorization}}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "3e0e3c84-d764-4c0d-9cf0-4519e73cffdc",
      "name": "Split Iconsets",
      "type": "n8n-nodes-base.code",
      "position": [
        0,
        -40
      ],
      "parameters": {
        "jsCode": "const iconsets = items[0].json.iconsets || [];\nconst countPerRequest = 100; // Max per request\nlet output = [];\n\niconsets.forEach(iconset => {\n    const iconsetName = iconset.name;\n    const totalIcons = iconset.icons_count || 0;\n    const numRequests = Math.ceil(totalIcons / countPerRequest);\n\n    for (let i = 0; i < numRequests; i++) {\n        const offset = i * countPerRequest;\n\n        output.push({\n            json: {\n                iconset_id: iconset.iconset_id,\n                iconset_name: iconsetName,\n                iconset_identifier: iconset.identifier,\n                // HTTP Node URL\n                url: `https://api.iconfinder.com/v4/iconsets/${iconset.iconset_id}/icons?count=${countPerRequest}&offset=${offset}`,\n                offset: offset\n            }\n        });\n    }\n});\n\nreturn output;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "45f7fcf7-5695-4392-a737-63b1c2992c72",
      "name": "Get Icons Details",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        360,
        -120
      ],
      "parameters": {
        "url": "={{ $json.url }}",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "={{ $json.authorization }}"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "90f07556-1fbf-47e1-bf90-064055a9b264",
      "name": "Extract Tags & Name",
      "type": "n8n-nodes-base.code",
      "position": [
        520,
        -120
      ],
      "parameters": {
        "jsCode": "\n\nlet output = [];\n\nitems.forEach(item => {\n    const iconset_id = item.json.iconset_id;\n    const iconset_name_input = item.json.iconset_name; // Input value, may be empty\n    const icons = item.json.icons || [];\n\n    icons.forEach(icon => {\n        // Check raster sizes\n        const rasterSizes = icon.raster_sizes || [];\n        // Choose the largest size <= 128, if available\n        let bestSize = rasterSizes\n            .filter(rs => rs.size <= 128)\n            .sort((a, b) => b.size - a.size)[0]  // largest <=128\n            || rasterSizes[rasterSizes.length - 1]; // fallback: largest available\n\n\n        const url = bestSize?.formats?.[0]?.preview_url\n                    || icon.vector_sizes?.[0]?.formats?.[0]?.download_url\n                    || \"\";\n\n        // Extract filename from URL\n        const filename = url.split(\"/\").pop() || \"\";\n\n        const nameWithExtRemoved = filename.replace(/-\\d+(\\.\\w+)$/, \"\");\n\n        // Replace underscores with spaces \u2192 original name\n        const originalName = nameWithExtRemoved.replace(/_/g, \" \");\n\n        // Determine iconset name from URL ONLY if the input value is empty/missing\n        let iconset_name = iconset_name_input || \"\";\n        if (!iconset_name && url) {\n            const marker = \"/data/icons/\";\n            const idx = url.indexOf(marker);\n            if (idx !== -1) {\n                // Take everything after \"/data/icons/\"\n                const after = url.slice(idx + marker.length); \n                const firstSegment = (after.split(\"/\")[0] || \"\"); \n                // Remove numeric suffix and replace separators with spaces\n                const withoutNumber = firstSegment.replace(/-\\d+$/, \"\");\n                iconset_name = withoutNumber.replace(/[_-]+/g, \" \").trim();\n            }\n        }\n\n        output.push({\n            json: {\n                icon_id: icon.icon_id,\n                iconset_id,\n                iconset_name,\n                name: originalName,          // now real icon label\n                tags: (icon.tags || []).join(\", \"),\n                preview_url: url\n            }\n        });\n    });\n});\n\nreturn output;\n"
      },
      "typeVersion": 2
    },
    {
      "id": "c468a92a-6016-47ef-b75e-aeacf32106bd",
      "name": "Create HTML",
      "type": "n8n-nodes-base.code",
      "position": [
        760,
        -180
      ],
      "parameters": {
        "jsCode": "if (!items || items.length === 0) return [];\n\nlet totalIcons = items.length;\n\nlet html = `\n<html>\n<head>\n<meta charset=\"UTF-8\">\n<title>Icons: ${totalIcons}</title>\n<style>\nbody {font-family: Arial, Helvetica, sans-serif;\n}\ntable {\n  border-collapse: collapse;\n  width: 100%;\n}\ntable, th, td {\n  border: 1px solid #ccc;\n}\nth, td {\n  padding: 5px;\n  text-align: left;\n}\n</style>\n</head>\n<body>\n<h1>Icons: ${totalIcons}</h1>\n<table>\n<tr><th>Icon</th><th>Name</th><th>Tags</th><th>Iconset</th></tr>\n`;\n\nitems.forEach(item => {\n    const icon = item.json;\n    const preview = icon.preview_url || \"\";\n    const name = icon.name || \"\";\n    const tags = icon.tags || \"\";\n    const iconset_name = icon.iconset_name || \"\";\n    html += `<tr>\n<td><img src=\"${preview}\" width=\"64\" height=\"64\"></td>\n<td>${name}</td>\n<td>${tags}</td>\n<td>${iconset_name}</td>\n</tr>`;\n});\n\nhtml += `\n</table>\n</body>\n</html>\n`;\n\nconst base64Data = Buffer.from(html, 'utf-8').toString('base64');\n\nreturn [\n    {\n        json: { message: \"HTML file created\" },\n        binary: {\n            data: {\n                data: base64Data,\n                mimeType: 'text/html',\n                fileName: 'icons.html'\n            }\n        }\n    }\n];\n"
      },
      "typeVersion": 2,
      "alwaysOutputData": false
    },
    {
      "id": "8b2c3559-f007-4763-931a-8e65dd562363",
      "name": "Create CSV",
      "type": "n8n-nodes-base.convertToFile",
      "position": [
        760,
        -40
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "bd806c51-d27d-4fdd-8a8d-d56a78ff6768",
      "name": "Merge",
      "type": "n8n-nodes-base.merge",
      "position": [
        200,
        -120
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3.2
    },
    {
      "id": "a3d51e37-6aaf-4fe3-88e0-734ebb15c81e",
      "name": "Auth Settings",
      "type": "n8n-nodes-base.set",
      "position": [
        -320,
        -140
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "1cfa6e52-8897-491c-8c58-e3a53fc052c7",
              "name": "authorization",
              "type": "string",
              "value": "Bearer YOUR_TOKEN_HERE"
            },
            {
              "id": "c2e616b7-0ea2-4c2d-9f5e-d9401e9d82e0",
              "name": "user",
              "type": "string",
              "value": "YOUR USER ID"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "a5b0bb66-fb25-41a7-b90d-b8547f56ad12",
      "name": "Check User ID",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -980,
        0
      ],
      "parameters": {
        "url": "=https://api.iconfinder.com/v4/icons/ICON-ID",
        "options": {},
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Authorization",
              "value": "=Bearer YOUR_TOKEN_HERE"
            }
          ]
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "68824d40-a6fb-4c09-988b-e89d5159480e",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1240,
        -300
      ],
      "parameters": {
        "color": 4,
        "width": 640,
        "height": 480,
        "content": "## 2. Check User ID\n1) Navigate to any icon owned by the user and copy the **icon id** from the URL:  \n   `https://www.iconfinder.com/icons/ICON-ID/icon-name`\n\n2) Open the **\"Check User ID\"** node and append **`ICON-ID`** to the URL field like this:  \n   `https://api.iconfinder.com/v4/icons/ICON-ID`\n\n3) For the Authorization value, use:  \n   **Bearer YOUR_TOKEN_HERE**\n\n4) Execute the step. You will find the numeric **\"user_id\"** in the output.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "2e77afe7-8047-4246-a3e0-c86038df4eca",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1920,
        -300
      ],
      "parameters": {
        "color": 6,
        "width": 640,
        "height": 480,
        "content": "## 1. Register an Application to Obtain an API Key\nYou need to register an application to get an **API Key** here: https://www.iconfinder.com/account/applications \n\nNote: You may need to create a developer account before registering your application."
      },
      "typeVersion": 1
    },
    {
      "id": "932133cc-5756-4046-a839-e8e6db80cd64",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        -300
      ],
      "parameters": {
        "color": 7,
        "width": 1600,
        "height": 480,
        "content": "## 3. Config & Execute\n1) Open the **\"Auth Settings\"** node and set the **`authorization`** value to: **Bearer YOUR_TOKEN_HERE**\n2) Change the **`user`** value to the **user_id** obtained from the previous step.\n3) Execute the workflow.\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "1eae398b-7e24-4b13-a3ea-1d1d933d7830",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2600,
        -300
      ],
      "parameters": {
        "width": 640,
        "height": 480,
        "content": "## Iconfinder Export\nThis workflow is designed to automatically fetch all icons from an Iconfinder user account, including all associated metadata such as tags, icon names, and the iconset they belong to.\n\nThis workflow exports an HTML file with icon previews and a CSV file containing all icons from the user account. It fundamentally simplifies exporting the icons as a list with their corresponding tags, making it easier to review, catalog, or reuse your icon library."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0e04a00d-6a29-48fc-9a04-5f52795a094e",
  "connections": {
    "Merge": {
      "main": [
        [
          {
            "node": "Get Icons Details",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create HTML": {
      "main": [
        []
      ]
    },
    "Get Iconsets": {
      "main": [
        [
          {
            "node": "Split Iconsets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Auth Settings": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 0
          },
          {
            "node": "Get Iconsets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Iconsets": {
      "main": [
        [
          {
            "node": "Merge",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Get Icons Details": {
      "main": [
        [
          {
            "node": "Extract Tags & Name",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Tags & Name": {
      "main": [
        [
          {
            "node": "Create CSV",
            "type": "main",
            "index": 0
          },
          {
            "node": "Create HTML",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Auth Settings",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}