{
  "nodes": [
    {
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1650,
        300
      ],
      "parameters": {
        "table": "Pokemon",
        "operation": "list",
        "additionalOptions": {}
      },
      "credentials": {
        "airtableApi": "Airtable Credentials @n8n"
      },
      "typeVersion": 1,
      "id": "node-905e6f6f"
    },
    {
      "name": "Redis",
      "type": "n8n-nodes-base.redis",
      "position": [
        600,
        600
      ],
      "parameters": {
        "key": "{{ $credentials.key }}",
        "ttl": 3600,
        "expire": true,
        "operation": "incr"
      },
      "credentials": {
        "redis": "Redis Cloud Credentials"
      },
      "typeVersion": 1,
      "id": "node-55f2f76c"
    },
    {
      "name": "Redis1",
      "type": "n8n-nodes-base.redis",
      "position": [
        1200,
        450
      ],
      "parameters": {
        "key": "{{ $credentials.key }}",
        "operation": "incr"
      },
      "credentials": {
        "redis": "Redis Cloud Credentials"
      },
      "typeVersion": 1,
      "id": "node-155b97cd"
    },
    {
      "name": "Set1",
      "type": "n8n-nodes-base.set",
      "position": [
        1600,
        550
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "message",
              "value": "You exceeded your limit"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1,
      "id": "node-3d7ccd78"
    },
    {
      "name": "Webhook1",
      "type": "n8n-nodes-base.webhook",
      "position": [
        200,
        600
      ],
      "webhookId": "a3167ed7-98d2-422c-bfe2-e3ba599d19f1",
      "parameters": {
        "path": "a3167ed7-98d2-422c-bfe2-e3ba599d19f1",
        "options": {},
        "responseMode": "lastNode",
        "authentication": "{{ $credentials.headerAuth }}"
      },
      "credentials": {
        "httpHeaderAuth": "Credential Example"
      },
      "typeVersion": 1,
      "id": "node-0e286c24"
    },
    {
      "name": "Function",
      "type": "n8n-nodes-base.function",
      "position": [
        1900,
        300
      ],
      "parameters": {
        "functionCode": " const limit = `Limit consumed: `+ $node['Redis1'].json[$node[\"Set2\"].json[\"apiKey\"]];\n return [\n  {\n    json: {\n      message:limit,\n      body: items.map(item => {\n        const name= item.json.fields.name\n        const url= item.json.fields.url\n        return {name,url}\n      })\n    }\n  }\n]\n"
      },
      "typeVersion": 1,
      "id": "node-6e368f92"
    },
    {
      "name": "Set",
      "type": "n8n-nodes-base.set",
      "position": [
        400,
        600
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "apiKey",
              "value": "={{$json[\"headers\"][\"x-api-key\"] +'-'+ new Date().getHours() +'-'+ new Date().getMinutes()}}"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1,
      "id": "node-4d4e41b1"
    },
    {
      "name": "Set2",
      "type": "n8n-nodes-base.set",
      "position": [
        1000,
        450
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "apiKey",
              "value": "={{$node['Webhook1'].json[\"headers\"][\"x-api-key\"] +'-'+ new Date().getHours()}}"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1,
      "id": "node-92c73a75"
    },
    {
      "name": "Set3",
      "type": "n8n-nodes-base.set",
      "position": [
        1000,
        700
      ],
      "parameters": {
        "values": {
          "string": [
            {
              "name": "message",
              "value": "You exceeded your limit"
            }
          ]
        },
        "options": {},
        "keepOnlySet": true
      },
      "typeVersion": 1,
      "id": "node-ec3bc090"
    },
    {
      "name": "Per hour",
      "type": "n8n-nodes-base.if",
      "position": [
        1400,
        450
      ],
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$json[$node[\"Set2\"].json[\"apiKey\"]]}}",
              "value2": 60
            }
          ],
          "string": []
        }
      },
      "typeVersion": 1,
      "id": "node-8cb729eb"
    },
    {
      "name": "Per minute",
      "type": "n8n-nodes-base.if",
      "position": [
        800,
        600
      ],
      "parameters": {
        "conditions": {
          "number": [
            {
              "value1": "={{$json[$node[\"Set\"].json[\"apiKey\"]]}}",
              "value2": 10,
              "operation": "smallerEqual"
            }
          ]
        }
      },
      "typeVersion": 1,
      "id": "node-11e6fe06"
    },
    {
      "id": "error-d380966e",
      "name": "Error Handler",
      "type": "n8n-nodes-base.stopAndError",
      "typeVersion": 1,
      "position": [
        1000,
        400
      ],
      "parameters": {
        "message": "Workflow execution error",
        "options": {}
      }
    }
  ],
  "connections": {},
  "name": "Production Workflow",
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": null,
    "timezone": "UTC",
    "executionTimeout": 3600,
    "maxExecutions": 1000,
    "retryOnFail": true,
    "retryCount": 3
  },
  "meta": {
    "instanceId": "workflow-570d7d98",
    "versionId": "1.0.0",
    "createdAt": "2025-09-29T07:08:00.089473",
    "updatedAt": "2025-09-29T07:08:00.089488",
    "owner": "n8n-user",
    "license": "MIT",
    "category": "automation",
    "status": "active",
    "priority": "high",
    "environment": "production"
  },
  "tags": [
    "automation",
    "n8n",
    "production-ready",
    "excellent",
    "optimized"
  ],
  "description": "Production-ready workflow: Production Workflow. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."
}