{ "name": "MicroEarn - CSV and JSON Data Cleaner", "tags": [], "nodes": [ { "parameters": { "content": "## MicroEarn - CSV and JSON Data Cleaner\n\n### How it works\nClean CSV or JSON data, remove duplicate and empty rows, and retrieve structured results from Apify.\n\n### Setup\n1. Create an Apify account and API token with permission to run the Actor and access its default run storage.\n2. Create an n8n Header Auth credential: name `Authorization`, value `Bearer YOUR_APIFY_TOKEN`. Restrict it to `api.apify.com`. Select it in both HTTP Request nodes. Never put the token in the workflow JSON.\n3. Run the included sample manually. Edit the JSON body in **Post to Microearn Cleaner API** to supply your own content and formats.\n\n### Pricing and limits\nThis template is free; Apify usage may incur charges. The Actor charges $0.0001 per processed input row plus a $0.0005 startup fee at the standard memory configuration. Check current pricing on [Apify](https://apify.com/microearn/microearn-data-cleaner). The sample sets a $0.05 maximum charge per run.\n\nIf a run is not finished within 60 seconds, this example stops; longer runs require status polling. Review storage retention before submitting sensitive data.", "width": 480, "height": 720 }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -608, -160 ], "id": "8b4e550f-76e3-45e9-8058-87841a84b2c3", "name": "Sticky Note" }, { "parameters": { "content": "## Start cleaner run\n\nManually launch the Actor with sample CSV data, a 512 MB memory setting and a $0.05 charge limit. Continue only when the run status is SUCCEEDED.", "width": 672, "height": 320, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ -48, -160 ], "id": "cda96e22-2caa-45b1-a8dc-057f7042fbc3", "name": "Sticky Note1" }, { "parameters": { "content": "## Retrieve and validate output\n\nFetch the OUTPUT record using the default key-value store ID. Check the returned status before passing the cleaned result to downstream nodes.", "width": 432, "height": 304, "color": 7 }, "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [ 672, -128 ], "id": "d285e5bb-778c-412a-b5d8-2d76d83d2779", "name": "Sticky Note2" }, { "id": "b239f6b8-530a-4b9c-a653-a19a4bd9d053", "name": "When Manually Triggered", "type": "n8n-nodes-base.manualTrigger", "position": [ 0, 0 ], "parameters": {}, "typeVersion": 1 }, { "id": "a330fc5d-370f-4a1c-906c-e5c327fe30cd", "name": "Post to Microearn Cleaner API", "type": "n8n-nodes-base.httpRequest", "position": [ 240, 0 ], "parameters": { "url": "https://api.apify.com/v2/acts/microearn~microearn-data-cleaner/runs", "method": "POST", "options": { "timeout": 90000 }, "jsonBody": "{\"content\":\"Name,City\\nMario,Roma\\nMario,Roma\\nAnna,Milano\\n,\\n\",\"inputFormat\":\"csv\",\"outputFormat\":\"json\"}", "sendBody": true, "sendQuery": true, "specifyBody": "json", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "queryParameters": { "parameters": [ { "name": "waitForFinish", "value": "60" }, { "name": "maxTotalChargeUsd", "value": "0.05" }, { "name": "memory", "value": "512" }, { "name": "timeout", "value": "120" } ] } }, "typeVersion": 4.2 }, { "id": "7d9cad85-68d3-4150-b76b-e3ec74476e6a", "name": "Check Data Cleaner Run", "type": "n8n-nodes-base.code", "position": [ 480, 0 ], "parameters": { "jsCode": "const run = $input.first().json.data;\nif (run.status !== 'SUCCEEDED') {\n throw new Error('Run not completed successfully: ' + run.status + '. Run ID: ' + run.id);\n}\nreturn [{ json: { storeId: run.defaultKeyValueStoreId } }];" }, "typeVersion": 2 }, { "id": "6cac24bf-3b96-4074-a884-a8d6221592f2", "name": "Fetch Cleaned Data Results", "type": "n8n-nodes-base.httpRequest", "position": [ 720, 0 ], "parameters": { "url": "={{ 'https://api.apify.com/v2/key-value-stores/' + $json.storeId + '/records/OUTPUT' }}", "options": { "timeout": 30000 }, "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth" }, "typeVersion": 4.2 }, { "id": "1303ac29-9818-43ae-a4d9-998ffb51e8da", "name": "Verify Cleaned Data Output", "type": "n8n-nodes-base.code", "position": [ 960, 0 ], "parameters": { "jsCode": "const result = $input.first().json;\nif (result.status !== 'ok') {\n throw new Error(JSON.stringify(result));\n}\nreturn [{ json: result }];" }, "typeVersion": 2 } ], "active": false, "pinData": {}, "settings": { "binaryMode": "separate", "executionOrder": "v1" }, "nodeGroups": [], "connections": { "When Manually Triggered": { "main": [ [ { "node": "Post to Microearn Cleaner API", "type": "main", "index": 0 } ] ] }, "Post to Microearn Cleaner API": { "main": [ [ { "node": "Check Data Cleaner Run", "type": "main", "index": 0 } ] ] }, "Check Data Cleaner Run": { "main": [ [ { "node": "Fetch Cleaned Data Results", "type": "main", "index": 0 } ] ] }, "Fetch Cleaned Data Results": { "main": [ [ { "node": "Verify Cleaned Data Output", "type": "main", "index": 0 } ] ] } } }