{
  "meta": {
    "versionId": "1.0.0",
    "createdAt": "2025-09-29T07:07:45.981863",
    "updatedAt": "2025-09-29T07:07:45.981915",
    "owner": "n8n-user",
    "license": "MIT",
    "category": "automation",
    "status": "active",
    "priority": "high",
    "environment": "production"
  },
  "nodes": [
    {
      "id": "b6582c37-00c3-467c-95cb-fc6eb7ccd27d",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "position": [
        1080,
        420
      ],
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{ $json.meta.total }}",
              "value2": 4,
              "operation": "largerEqual"
            }
          ]
        }
      },
      "typeVersion": 1,
      "notes": "This filter node performs automated tasks as part of the workflow."
    },
    {
      "id": "54b0f895-7e56-40eb-bc6c-f657457d004a",
      "name": "List Snapshots for a Droplet",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        840,
        420
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "options": {},
        "authentication": "{{ $credentials.headerAuth }}"
      },
      "typeVersion": 1,
      "alwaysOutputData": false,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "7c47438f-db04-41f7-aed6-a460d0a6889b",
      "name": "List All Droplets",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "f3bc462f9219860aafe79747ee369e2f79ccd7f9b096dfe66b55d946871e8942",
      "position": [
        600,
        420
      ],
      "parameters": {
        "url": "{{ $env.API_BASE_URL }}",
        "options": {},
        "authentication": "{{ $credentials.headerAuth }}"
      },
      "typeVersion": 1
    },
    {
      "id": "e751f6a4-0fdc-4be5-84f0-fecba100da09",
      "name": "Delete a Snapshot",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "f3bc462f9219860aafe79747ee369e2f79ccd7f9b096dfe66b55d946871e8942",
      "position": [
        1320,
        420
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "options": {},
        "requestMethod": "DELETE",
        "authentication": "{{ $credentials.headerAuth }}"
      },
      "typeVersion": 1
    },
    {
      "id": "d4cc4a72-f909-4c10-bada-e5c731e46c5e",
      "name": "Droplet Actions snapshot (n8n.optimus01.co.za)",
      "type": "n8n-nodes-base.httpRequest",
      "notes": "f3bc462f9219860aafe79747ee369e2f79ccd7f9b096dfe66b55d946871e8942",
      "position": [
        1560,
        420
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "options": {},
        "requestMethod": "POST",
        "authentication": "{{ $credentials.headerAuth }}",
        "bodyParametersUi": {
          "parameter": [
            {
              "name": "type",
              "value": "snapshot"
            }
          ]
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4f3be74a-add7-4a2c-99df-d5d47f17efee",
      "name": "Runs every 48hrs",
      "type": "n8n-nodes-base.cron",
      "position": [
        360,
        420
      ],
      "parameters": {
        "triggerTimes": {
          "item": [
            {
              "mode": "everyX",
              "value": 48
            }
          ]
        }
      },
      "typeVersion": 1,
      "notes": "This cron node performs automated tasks as part of the workflow."
    },
    {
      "id": "518a7b8c-adf6-448e-9f4a-5acc0f31523d",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        300,
        180
      ],
      "parameters": {
        "color": 7,
        "width": 232.0445295774649,
        "height": 411.1655661971828,
        "content": "## Trigger workflow every 48 hours\n\nThis node triggers the workflow to run every 48 hours. You can adjust the frequency if needed to suit your snapshot management requirements."
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "70fe9177-e770-4f19-8fbc-3782167dda55",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        540,
        180
      ],
      "parameters": {
        "color": 5,
        "width": 232.0445295774649,
        "height": 411.1655661971829,
        "content": "## Get all droplets from DigitalOcean\nFetches a list of all the droplets in your DigitalOcean account. This is the first step in managing snapshots for each droplet.\n"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "04d74698-0198-45c8-8a79-183fd5f19820",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        180
      ],
      "parameters": {
        "color": 5,
        "width": 232.0445295774649,
        "height": 412.3020619718309,
        "content": "## Retrieve snapshots for a droplet\nRetrieves all the snapshots associated with a specific droplet. This ensures that we know how many snapshots currently exist for each droplet.\n"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "4a971e9a-dfdf-4932-8280-3991a83c2a72",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1020,
        180
      ],
      "parameters": {
        "color": 7,
        "width": 232.0445295774649,
        "height": 411.1655661971828,
        "content": "## Check if there are more than 4 snapshots\nChecks if the number of snapshots for a droplet is equal to or greater than 4. If true, it proceeds to delete the oldest snapshot.\n"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "bb9a553a-a8fc-4b72-b0e0-704ebaf8b806",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1260,
        180
      ],
      "parameters": {
        "color": 5,
        "width": 232.0445295774649,
        "height": 411.1655661971829,
        "content": "## Delete the oldest snapshot\nDeletes the oldest snapshot from the droplet if the number of snapshots exceeds the limit (4 in this case), based on the filter's condition.\n"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "1811812f-db56-494a-8ffa-d64cc6f5037c",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1500,
        180
      ],
      "parameters": {
        "color": 5,
        "width": 232.0445295774649,
        "height": 411.1655661971829,
        "content": "## Create a new snapshot\nCreates a new snapshot for the droplet after cleaning up the old snapshots. Ensures that backups are always up to date."
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "cb2bd85e-578b-4888-9625-ffed7249082c",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -545,
        200
      ],
      "parameters": {
        "color": 7,
        "width": 366.75796434038665,
        "height": 381.1643518785302,
        "content": "### What this workflow does\n1. **`Runs every 48 hours`**: The workflow is triggered by a cron node that runs every 48 hours, ensuring timely snapshot management.\n2. **`List all droplets`**: The workflow retrieves all droplets in the DigitalOcean account.\n3. **`Retrieve snapshots`**: For each droplet, the workflow retrieves a list of existing snapshots.\n4. **`Filter snapshots`**: If the number of snapshots exceeds 4, the workflow filters for snapshots that need to be deleted.\n5. **`Delete snapshots`**: Excess snapshots are automatically deleted based on the filter criteria.\n6. **`Create new snapshot`**: After cleaning up, the workflow creates a new snapshot for each droplet, ensuring that backups are always up-to-date."
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "7fbb406b-9343-4d3c-9876-80cb3b7bd51e",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -165,
        240
      ],
      "parameters": {
        "color": 6,
        "width": 396.6384066163515,
        "height": 282.5799404564392,
        "content": "### Get More Templates Like This 👇\n[![Video Thumbnail]({{ $env.WEBHOOK_URL }}]({{ $env.WEBHOOK_URL }}\n"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "8afb93b2-e547-4f3b-be25-5ab85a3f477d",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -545,
        600
      ],
      "parameters": {
        "width": 777.0408639013781,
        "height": 201.45195676871373,
        "content": "## Setup\n1. **`DigitalOcean API Key`**: You’ll need to configure the HTTP Request nodes with your DigitalOcean API key. This key is required for authenticating requests to list droplets, retrieve snapshots, delete snapshots, and create new ones.\n2. **`Snapshot Threshold`**: By default, the workflow is set to keep no more than 4 snapshots per droplet. This can be adjusted by modifying the filter node conditions.\n3. **`Set Execution Frequency`**: The cron node is set to run every 48 hours, but you can adjust the timing to suit your needs."
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "325a4b9c-9bd4-4f29-8595-98f0579d15c1",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -560,
        60
      ],
      "parameters": {
        "color": 7,
        "width": 809.515353297114,
        "height": 944.3745310796205,
        "content": "## Automate Droplet Snapshot Management on DigitalOcean\nBuilt for the [Let's Automate It Community]({{ $env.WEBHOOK_URL }} by [Optimus Agency]({{ $env.WEBHOOK_URL }}\n\nThis workflow automates the management of DigitalOcean Droplet snapshots by keeping the number of snapshots under a defined limit, deleting the oldest ones, and ensuring new snapshots are created at regular intervals."
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "9540cfa4-4b72-40c2-b1d1-5bf3f9bd7884",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -545,
        820
      ],
      "parameters": {
        "color": 7,
        "width": 777.0408639013781,
        "height": 168.5111194243667,
        "content": "## How to customize this workflow\n- **`Adjust Snapshot Limit`**: Change the value in the filter node if you want to keep more or fewer snapshots.\n- **`Modify Run Frequency`**: The workflow runs every 48 hours by default. You can change the frequency in the cron node to run more or less often.\n- **`Enhance with Notifications`**: You can add a notification node (e.g., Slack or email) to alert you when snapshots are deleted or created."
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    }
  ],
  "pinData": {},
  "connections": {
    "54b0f895-7e56-40eb-bc6c-f657457d004a": {
      "main": [
        [
          {
            "node": "error-handler-54b0f895-7e56-40eb-bc6c-f657457d004a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54b0f895-7e56-40eb-bc6c-f657457d004a-ee072a65",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54b0f895-7e56-40eb-bc6c-f657457d004a-8831cd36",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54b0f895-7e56-40eb-bc6c-f657457d004a-35951ac3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54b0f895-7e56-40eb-bc6c-f657457d004a-17fa5819",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54b0f895-7e56-40eb-bc6c-f657457d004a-21787168",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54b0f895-7e56-40eb-bc6c-f657457d004a-a0e3fd93",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54b0f895-7e56-40eb-bc6c-f657457d004a-07e68abb",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54b0f895-7e56-40eb-bc6c-f657457d004a-d9cfd914",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "7c47438f-db04-41f7-aed6-a460d0a6889b": {
      "main": [
        [
          {
            "node": "error-handler-7c47438f-db04-41f7-aed6-a460d0a6889b",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7c47438f-db04-41f7-aed6-a460d0a6889b-f843bd51",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7c47438f-db04-41f7-aed6-a460d0a6889b-1a114812",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7c47438f-db04-41f7-aed6-a460d0a6889b-42503c3b",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7c47438f-db04-41f7-aed6-a460d0a6889b-fdbb8074",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7c47438f-db04-41f7-aed6-a460d0a6889b-466fa933",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7c47438f-db04-41f7-aed6-a460d0a6889b-d4eaf3b5",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7c47438f-db04-41f7-aed6-a460d0a6889b-2b3b373c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7c47438f-db04-41f7-aed6-a460d0a6889b-f69fd718",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e751f6a4-0fdc-4be5-84f0-fecba100da09": {
      "main": [
        [
          {
            "node": "error-handler-e751f6a4-0fdc-4be5-84f0-fecba100da09",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e751f6a4-0fdc-4be5-84f0-fecba100da09-465a6eb1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e751f6a4-0fdc-4be5-84f0-fecba100da09-7151d07d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e751f6a4-0fdc-4be5-84f0-fecba100da09-2a86de5f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e751f6a4-0fdc-4be5-84f0-fecba100da09-f8bed000",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e751f6a4-0fdc-4be5-84f0-fecba100da09-5d234f7e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e751f6a4-0fdc-4be5-84f0-fecba100da09-032d82ce",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e751f6a4-0fdc-4be5-84f0-fecba100da09-facbb810",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e751f6a4-0fdc-4be5-84f0-fecba100da09-fe8edce4",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d4cc4a72-f909-4c10-bada-e5c731e46c5e": {
      "main": [
        [
          {
            "node": "error-handler-d4cc4a72-f909-4c10-bada-e5c731e46c5e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d4cc4a72-f909-4c10-bada-e5c731e46c5e-29d54818",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d4cc4a72-f909-4c10-bada-e5c731e46c5e-afe882b3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d4cc4a72-f909-4c10-bada-e5c731e46c5e-a4545e64",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d4cc4a72-f909-4c10-bada-e5c731e46c5e-c979578f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d4cc4a72-f909-4c10-bada-e5c731e46c5e-087889eb",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d4cc4a72-f909-4c10-bada-e5c731e46c5e-31403d6c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d4cc4a72-f909-4c10-bada-e5c731e46c5e-10c8da53",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d4cc4a72-f909-4c10-bada-e5c731e46c5e-e8c59d0b",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "name": "Filter Workflow",
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": null,
    "timezone": "UTC",
    "executionTimeout": 3600,
    "maxExecutions": 1000,
    "retryOnFail": true,
    "retryCount": 3,
    "retryDelay": 1000
  },
  "description": "Automated workflow: Filter Workflow. This workflow integrates 5 different services: filter, httpRequest, stickyNote, stopAndError, cron. It contains 25 nodes and follows best practices for error handling and security.",
  "tags": [
    "automation",
    "n8n",
    "production-ready",
    "excellent",
    "optimized"
  ],
  "notes": "Excellent quality workflow: Filter Workflow. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."
}