{
  "name": "Generate .com brand names with OpenAI and API Ninjas into Google Sheets",
  "nodes": [
    {
      "id": "9418fcb2-faa2-4b09-a586-0e2407f29bc1",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2576,
        144
      ],
      "parameters": {
        "width": 280,
        "height": 148,
        "content": "## Write to sheets\n\nAppends available domains to sheet \"available\", taken ones to sheet \"closed\"."
      }
    },
    {
      "id": "76f9496b-5028-4289-ad46-638e8eee772d",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        368,
        336
      ]
    },
    {
      "id": "12966170-54f2-4adb-8986-e21a98ecadc2",
      "name": "Read sheet available",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        528,
        336
      ]
    },
    {
      "id": "0a434fcb-3328-40da-af7a-6c5fb3f6c2e8",
      "name": "Trigger closed read",
      "type": "n8n-nodes-base.code",
      "position": [
        688,
        336
      ]
    },
    {
      "id": "939ea07b-1f6a-4d31-928d-2a9cfa70e0ee",
      "name": "Read sheet closed",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        848,
        336
      ]
    },
    {
      "id": "1e5e0aca-0d40-4f79-9cc1-78e77055910e",
      "name": "Build initial state",
      "type": "n8n-nodes-base.code",
      "position": [
        1008,
        336
      ]
    },
    {
      "id": "1c6e05de-3a65-4778-99fa-2bc1be51d184",
      "name": "Prepare prompt",
      "type": "n8n-nodes-base.code",
      "position": [
        1232,
        336
      ]
    },
    {
      "id": "e04b598d-b421-466f-8371-91c406e2c896",
      "name": "Generate names (OpenAI)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1392,
        336
      ]
    },
    {
      "id": "114d5465-a2cb-40f0-8166-9bb144f4a7e9",
      "name": "Normalize to domains",
      "type": "n8n-nodes-base.code",
      "position": [
        1552,
        336
      ]
    },
    {
      "id": "493049ef-0815-4d22-893f-b45a9d56d61b",
      "name": "Check domain (API Ninjas)",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1760,
        336
      ]
    },
    {
      "id": "0a48d7ba-d5a0-4d2c-92bb-7f198ec317bf",
      "name": "Merge name and API result",
      "type": "n8n-nodes-base.code",
      "position": [
        1984,
        336
      ]
    },
    {
      "id": "edc50197-55e6-49c3-b123-5763435d5ea8",
      "name": "Closed only",
      "type": "n8n-nodes-base.code",
      "position": [
        1984,
        720
      ]
    },
    {
      "id": "ce7811b1-cf8d-45e2-955f-fa248a4d6ec1",
      "name": "State for next run",
      "type": "n8n-nodes-base.code",
      "position": [
        1984,
        544
      ]
    },
    {
      "id": "035d99e3-e056-4909-80a9-f5d81258cc3d",
      "name": "Exit or loop",
      "type": "n8n-nodes-base.if",
      "position": [
        2208,
        544
      ]
    },
    {
      "id": "8ea1d3ca-12f4-42d3-bd4c-ccbb79d0aae9",
      "name": "Filter available only",
      "type": "n8n-nodes-base.filter",
      "position": [
        2208,
        336
      ]
    },
    {
      "id": "fc2c9eca-d842-4b28-afbb-8f456f42ffed",
      "name": "Append to sheet available",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2640,
        336
      ]
    },
    {
      "id": "319bf54c-7c74-4276-85e1-48fc779bd217",
      "name": "Append to sheet closed",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        2208,
        720
      ]
    },
    {
      "id": "98e14d9d-acdb-4ded-bd01-a9c7dc1cbde9",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        -208
      ],
      "parameters": {
        "width": 464,
        "height": 448,
        "content": "## How it works\n\nManual Trigger starts a run. The workflow reads your Google Sheet (tabs \"available\" and \"closed\") to get domains already checked. Build initial state builds the alreadyChecked list an"
      }
    },
    {
      "id": "3537e384-9162-44f4-ac92-513c1fab213b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -208,
        288
      ],
      "parameters": {
        "width": 464,
        "height": 288,
        "content": "## Setup steps\n\n1. Credentials: Add OpenAI API key to the Generate names (OpenAI) node. Add API Ninjas key (header X-Api-Key from api-ninjas.com) to Check domain (API Ninjas). Add Google Sheets OAuth2"
      }
    },
    {
      "id": "ff9b747e-9b86-4997-9284-115fce0105ba",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        512,
        144
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "## Start & load state\n\nReads sheets \"available\" and \"closed\", builds alreadyChecked and totalFound for the loop."
      }
    },
    {
      "id": "fb7e0fae-f61b-40eb-a991-655691c480cd",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1392,
        144
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "## Prompt & names\n\nEdit Prepare prompt for your product; OpenAI returns 20 names; Normalize to domains makes them .com."
      }
    },
    {
      "id": "9fe661d2-b771-4e3f-a674-add5a79c3d1e",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1712,
        144
      ],
      "parameters": {
        "width": null,
        "height": null,
        "content": "## Check & route\n\nAPI Ninjas checks each domain; results split into available/closed; state updated; loop or exit."
      }
    }
  ],
  "connections": {
    "Closed only": {
      "main": [
        [
          {
            "node": "Append to sheet closed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Exit or loop": {
      "main": [
        [],
        [
          {
            "node": "Prepare prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Read sheet available",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare prompt": {
      "main": [
        [
          {
            "node": "Generate names (OpenAI)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read sheet closed": {
      "main": [
        [
          {
            "node": "Build initial state",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "State for next run": {
      "main": [
        [
          {
            "node": "Exit or loop",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Build initial state": {
      "main": [
        [
          {
            "node": "Prepare prompt",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Trigger closed read": {
      "main": [
        [
          {
            "node": "Read sheet closed",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Normalize to domains": {
      "main": [
        [
          {
            "node": "Check domain (API Ninjas)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Read sheet available": {
      "main": [
        [
          {
            "node": "Trigger closed read",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter available only": {
      "main": [
        [
          {
            "node": "Append to sheet available",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate names (OpenAI)": {
      "main": [
        [
          {
            "node": "Normalize to domains",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check domain (API Ninjas)": {
      "main": [
        [
          {
            "node": "Merge name and API result",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Merge name and API result": {
      "main": [
        [
          {
            "node": "Filter available only",
            "type": "main",
            "index": 0
          },
          {
            "node": "State for next run",
            "type": "main",
            "index": 0
          },
          {
            "node": "Closed only",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}