{
  "name": "Extract Meta Ads detailed targeting across all endpoints using Google Sheets",
  "nodes": [
    {
      "id": "e05b0000-6b5c-494f-90cd-f189781746a5",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -816,
        416
      ]
    },
    {
      "id": "27b94aee-e8e6-4714-8f24-d4db290c9768",
      "name": "Read Input (Google Sheets)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        -592,
        416
      ]
    },
    {
      "id": "a78b61c5-1e48-4621-9d60-3e811577183b",
      "name": "Valid rows (ad_account_id + endpoint)",
      "type": "n8n-nodes-base.filter",
      "position": [
        -384,
        416
      ]
    },
    {
      "id": "5a8d62df-ef70-44df-9080-e6af2e836eba",
      "name": "Switch by endpoint",
      "type": "n8n-nodes-base.switch",
      "position": [
        -160,
        400
      ]
    },
    {
      "id": "25093240-0bd9-466d-986a-b9694b533d74",
      "name": "API Search",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        80,
        96
      ]
    },
    {
      "id": "53e5b635-9906-4cfe-8cba-51343fb8b57e",
      "name": "API Suggestions",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        80,
        336
      ]
    },
    {
      "id": "2aa0e47c-819b-480a-ae72-e7cef5ce6a7e",
      "name": "API Browse",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        80,
        576
      ]
    },
    {
      "id": "28f0f7b3-1098-4986-b7db-a8c600a2178e",
      "name": "API Validation",
      "type": "n8n-nodes-base.facebookGraphApi",
      "position": [
        80,
        816
      ]
    },
    {
      "id": "3ceb2479-d1ab-404e-b49e-ad5028e87766",
      "name": "Merge Search",
      "type": "n8n-nodes-base.merge",
      "position": [
        320,
        96
      ]
    },
    {
      "id": "fa27ee58-7cc9-4be2-8ca9-e26588252e1d",
      "name": "Merge Suggestions",
      "type": "n8n-nodes-base.merge",
      "position": [
        320,
        336
      ]
    },
    {
      "id": "177fa3e5-7acc-45ab-af2e-afd8a31378b1",
      "name": "Merge Browse",
      "type": "n8n-nodes-base.merge",
      "position": [
        320,
        576
      ]
    },
    {
      "id": "c438e33c-3542-4001-aa5f-abb5696ab86c",
      "name": "Merge Validation",
      "type": "n8n-nodes-base.merge",
      "position": [
        320,
        816
      ]
    },
    {
      "id": "c689afc0-3551-48ec-871d-240fd89baa10",
      "name": "Split Search",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        560,
        96
      ]
    },
    {
      "id": "4c2df6b3-4eae-4d26-9a3e-46830e8fcd90",
      "name": "Split Suggestions",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        560,
        336
      ]
    },
    {
      "id": "3f18ac94-689f-4799-ab20-5f8569030ea5",
      "name": "Split Browse",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        560,
        576
      ]
    },
    {
      "id": "1749dc20-580e-4a15-bbc1-af58f819505c",
      "name": "Split Validation",
      "type": "n8n-nodes-base.splitOut",
      "position": [
        560,
        816
      ]
    },
    {
      "id": "58529400-1fb0-4b7f-b70e-91f047657c67",
      "name": "Format Search",
      "type": "n8n-nodes-base.set",
      "position": [
        800,
        96
      ]
    },
    {
      "id": "832eaf83-14f8-44f3-8ef2-8e9e958e070f",
      "name": "Format Suggestions",
      "type": "n8n-nodes-base.set",
      "position": [
        800,
        336
      ]
    },
    {
      "id": "e1cd0e1f-aa68-44d5-a6d1-5232c86570b7",
      "name": "Format Browse",
      "type": "n8n-nodes-base.set",
      "position": [
        800,
        576
      ]
    },
    {
      "id": "8c476157-11c1-46be-95b7-ab3483ee9164",
      "name": "Format Validation",
      "type": "n8n-nodes-base.set",
      "position": [
        800,
        816
      ]
    },
    {
      "id": "e13f208b-df3a-4720-9904-5546da62b4bb",
      "name": "Save search_results",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1040,
        96
      ]
    },
    {
      "id": "ad7d72a3-5bf3-4dff-9dfd-3158bbb84af5",
      "name": "Save suggestions_results",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1040,
        336
      ]
    },
    {
      "id": "89aa9063-dc58-4454-87ce-11815a996d70",
      "name": "Save browse_results",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1040,
        576
      ]
    },
    {
      "id": "ab2406dc-f805-4bcd-a040-0896b27aa792",
      "name": "Save validation_results",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1040,
        816
      ]
    },
    {
      "id": "0e53ebdd-6ac3-43f6-9a66-0236a7e995ca",
      "name": "Google Sheets Trigger",
      "type": "n8n-nodes-base.googleSheetsTrigger",
      "position": [
        -816,
        576
      ]
    },
    {
      "id": "cddf5a47-3cde-41a8-906b-1314fbd17891",
      "name": "Sticky Note - Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -864,
        -720
      ],
      "parameters": {
        "width": 668,
        "height": 816,
        "content": "# Meta Ads Detailed Targeting (Universal)\n\n## How it works\n\n- Reads requests from **Google Sheets** (sheet `targeting_requests`) or runs when a **new row is added** (Google Sheets Trigger)\n- **Valid r"
      }
    },
    {
      "id": "e2c5a832-1f27-4841-956a-a69040608e18",
      "name": "Sticky Note - Get input & route",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -880,
        112
      ],
      "parameters": {
        "width": 856,
        "height": 624,
        "content": "## Get input & route by endpoint\n\n**Manual Trigger** / **Google Sheets Trigger**\nManual runs **Read Input** (whole sheet). Trigger runs when a new row is added to `targeting_requests`.\n\n**Read Input ("
      }
    },
    {
      "id": "e8402916-626a-4bf9-a8a5-9da844b96234",
      "name": "Sticky Note - API & save",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        48,
        -304
      ],
      "parameters": {
        "width": 1104,
        "height": 1280,
        "content": "## Call API, merge, split, format & save\n\nEach branch (Search, Suggestions, Browse, Validation):\n\n**API** (Facebook Graph API)\nCalls `act_{ad_account_id}/targetingsearch` (or targetingsuggestions / ta"
      }
    }
  ],
  "connections": {
    "API Browse": {
      "main": [
        [
          {
            "node": "Merge Browse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "API Search": {
      "main": [
        [
          {
            "node": "Merge Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Browse": {
      "main": [
        [
          {
            "node": "Split Browse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Search": {
      "main": [
        [
          {
            "node": "Split Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Browse": {
      "main": [
        [
          {
            "node": "Format Browse",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Search": {
      "main": [
        [
          {
            "node": "Format Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Browse": {
      "main": [
        [
          {
            "node": "Save browse_results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Search": {
      "main": [
        [
          {
            "node": "Save search_results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "API Validation": {
      "main": [
        [
          {
            "node": "Merge Validation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Read Input (Google Sheets)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "API Suggestions": {
      "main": [
        [
          {
            "node": "Merge Suggestions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Validation": {
      "main": [
        [
          {
            "node": "Split Validation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Validation": {
      "main": [
        [
          {
            "node": "Format Validation",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Validation": {
      "main": [
        [
          {
            "node": "Save validation_results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge Suggestions": {
      "main": [
        [
          {
            "node": "Split Suggestions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Split Suggestions": {
      "main": [
        [
          {
            "node": "Format Suggestions",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Suggestions": {
      "main": [
        [
          {
            "node": "Save suggestions_results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch by endpoint": {
      "main": [
        [
          {
            "node": "API Search",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Search",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "API Suggestions",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Suggestions",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "API Browse",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Browse",
            "type": "main",
            "index": 1
          }
        ],
        [
          {
            "node": "API Validation",
            "type": "main",
            "index": 0
          },
          {
            "node": "Merge Validation",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Google Sheets Trigger": {
      "main": [
        [
          {
            "node": "Read Input (Google Sheets)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read Input (Google Sheets)": {
      "main": [
        [
          {
            "node": "Valid rows (ad_account_id + endpoint)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Valid rows (ad_account_id + endpoint)": {
      "main": [
        [
          {
            "node": "Switch by endpoint",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}