{
  "name": "Voltcast — cheap-hours automation (starter)",
  "nodes": [
    {
      "parameters": {
        "rule": { "interval": [{ "field": "hours", "hoursInterval": 1 }] }
      },
      "name": "Every hour",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [0, 0]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://voltcast.com/api/v1/optimize/cheapest-window",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{ \"zone\": \"DE-LU\", \"duration_minutes\": 120, \"count\": 1 }"
      },
      "name": "Cheapest 2h window",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [220, 0],
      "notes": "Create an 'Header Auth' credential: name=Authorization, value=Bearer YOUR_VOLTCAST_KEY"
    },
    {
      "parameters": {
        "conditions": {
          "options": { "caseSensitive": true, "typeValidation": "strict" },
          "conditions": [
            {
              "leftValue": "={{ $json.data[0].avg_price_eur_mwh }}",
              "rightValue": 0,
              "operator": { "type": "number", "operation": "lt" }
            }
          ],
          "combinator": "and"
        }
      },
      "name": "Negative prices?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [440, 0]
    }
  ],
  "connections": {
    "Every hour": { "main": [[{ "node": "Cheapest 2h window", "type": "main", "index": 0 }]] },
    "Cheapest 2h window": { "main": [[{ "node": "Negative prices?", "type": "main", "index": 0 }]] }
  },
  "pinData": {},
  "meta": { "templateCredsSetupCompleted": false }
}
