AutomationFlowsGeneral › Advanced HTTP Retry with Delay Logic

Advanced HTTP Retry with Delay Logic

Original n8n title: Advanced Retry and Delay Logic

Advanced Retry and Delay Logic. Uses manualTrigger, httpRequest, stopAndError, stickyNote. Event-driven trigger; 8 nodes.

Event trigger★★★★☆ complexity8 nodesHTTP RequestStop And Error
General Trigger: Event Nodes: 8 Complexity: ★★★★☆ Added:

This workflow follows the HTTP Request → Stopanderror recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Advanced Retry and Delay Logic",
  "nodes": [
    {
      "parameters": {},
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        48
      ],
      "id": "885f5632-f4f1-4efd-a5a6-b5d39a180f86",
      "name": "When clicking \u2018Execute workflow\u2019"
    },
    {
      "parameters": {
        "url": "https://example.com/1",
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        448,
        48
      ],
      "id": "c4ccc06f-0cb7-4aac-a195-dc8b6dae87e5",
      "name": "HTTP Request",
      "retryOnFail": false,
      "waitBetweenTries": 5000,
      "maxTries": 5,
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "509eb34a-731a-42cb-82d8-8b8172e35719",
              "name": "delay_seconds",
              "value": 30,
              "type": "number"
            },
            {
              "id": "3c241ef0-eb4e-4c92-93c6-696949db1170",
              "name": "max_tries",
              "value": "6",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        224,
        48
      ],
      "id": "4be525c2-5b5c-4d1a-b7f0-363faa63d522",
      "name": "Set Fields"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "1edaa212-dd5e-4368-9394-97e18ff19578",
              "name": "delay_seconds",
              "value": "={{ $json.delay_seconds }}",
              "type": "string"
            },
            {
              "id": "fa20c333-5d70-4cb4-9403-3c0c8633512d",
              "name": "max_tries",
              "value": "={{ $json.max_tries - 1 }}",
              "type": "number"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        672,
        -32
      ],
      "id": "6280a197-72bb-4cc2-8530-b4cc922180f1",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "43ba9e9c-70ce-4a6d-93cb-c39984911994",
              "leftValue": "={{ $json.max_tries }}",
              "rightValue": 0,
              "operator": {
                "type": "number",
                "operation": "lte"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        880,
        -32
      ],
      "id": "3273bc42-46e6-4d26-9f1b-c3cf456f27eb",
      "name": "If"
    },
    {
      "parameters": {
        "errorMessage": "=Service unavailable after {{ $('Set Fields').item.json.max_tries }} tries"
      },
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        1104,
        -80
      ],
      "id": "62460f30-3329-4392-919e-09da442a0bbd",
      "name": "Stop and Error"
    },
    {
      "parameters": {
        "amount": "={{ $json.delay_seconds }}"
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1104,
        160
      ],
      "id": "3c918a29-2b14-42e7-9e97-9cd92bc62a79",
      "name": "Wait"
    },
    {
      "parameters": {
        "content": "## Advanced Retry and Delay Logic\n\nThis template provides a robust solution for handling API rate limits and temporary service outages in n8n workflows. It overcomes the limitations of the default node retry settings, which cap retries at 5 and delays at 5 seconds. By using a custom loop with a `Set`, `If`, and `Wait` node, this workflow gives you complete control over the number of retries and the delay between them.\n\n### Instructions:\n\n1. Replace the placeholder **HTTP Request** node with your target node (the one that might fail).\n2. In the initial **Set Fields** node, modify the `max_tries` value to set the total number of attempts for your workflow.\n3. Adjust the `delay_seconds` value to define the initial delay between retries.\n4. Optionally, configure the `Edit Fields` node to implement exponential backoff by adjusting the `delay_seconds` expression (e.g., `{{$json.delay_seconds * 2}}`).\n\nFor a more detailed breakdown and tutorial of this template, you can find additional information [here](https://n8nplaybook.com/post/2025/06/mastering-custom-retry-and-delay-logic-in-n8n/).",
        "height": 468,
        "width": 616
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        0,
        -464
      ],
      "typeVersion": 1,
      "id": "3ddbc2a4-519c-4623-9098-312b1f14c9af",
      "name": "Sticky Note"
    }
  ],
  "connections": {
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Set Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Fields": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [],
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Stop and Error",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "af43755b-f2f3-404c-9f77-9079caf62f1b",
  "id": "2OIJjgh9dop5IF6f",
  "tags": []
}
Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Advanced Retry and Delay Logic. Uses manualTrigger, httpRequest, stopAndError, stickyNote. Event-driven trigger; 8 nodes.

Source: https://github.com/vklepikovskiy/n8nplaybook-public/blob/main/workflows/retry_delay_logic.json — original creator credit. Request a take-down →

More General workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

General

GiveWP Donations to Beacon. Uses httpRequest, stopAndError. Webhook trigger; 43 nodes.

HTTP Request, Stop And Error
General

Product - Google Search Console API Examples. Uses httpRequest. Event-driven trigger; 36 nodes.

HTTP Request
General

Retry on fail except for known error Template. Uses stopAndError, noOp, stickyNote, manualTrigger. Event-driven trigger; 19 nodes.

Stop And Error
General

Retry on fail except for known error Template. Uses stopAndError. Event-driven trigger; 19 nodes.

Stop And Error
General

Multi-Service Screenshot Scraping: ScraperAPI, Scrapingdog, & ScreenshotOne. Uses manualTrigger, httpRequest, stickyNote, dateTime. Event-driven trigger; 13 nodes.

HTTP Request