{
  "name": "Find decision makers → enrich → CSV (EnrichGrid API)",
  "nodes": [
    {
      "parameters": {},
      "id": "cb2441b1-8089-5e6c-ad71-237873ef8bbe",
      "name": "Start",
      "type": "n8n-nodes-base.manualTrigger",
      "typeVersion": 1,
      "position": [
        0,
        320
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://enrichgrid.com/v1/search",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "{\n  \"filters\": {\n    \"title\": {\n      \"any\": [\n        \"ceo\",\n        \"founder\"\n      ],\n      \"zones\": [\n        \"current\"\n      ]\n    },\n    \"country\": [\n      \"US\"\n    ],\n    \"company_size\": {\n      \"min\": 11,\n      \"max\": 200\n    }\n  },\n  \"cursor\": null\n}"
      },
      "id": "f2b7b6bd-6561-5757-a863-0a4e0120e60a",
      "name": "Search people",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        220,
        320
      ],
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 3000,
      "credentials": {
        "httpHeaderAuth": {
          "name": "EnrichGrid API key"
        }
      }
    },
    {
      "parameters": {
        "fieldToSplitOut": "slugs",
        "options": {
          "destinationFieldName": "slug"
        }
      },
      "id": "6a099017-fd51-5764-a64e-15200c6ff180",
      "name": "One item per profile",
      "type": "n8n-nodes-base.splitOut",
      "typeVersion": 1,
      "position": [
        440,
        320
      ]
    },
    {
      "parameters": {
        "batchSize": 1,
        "options": {}
      },
      "id": "ec162676-8b62-56c0-a83c-80465cfefb10",
      "name": "Loop over profiles",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        660,
        320
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://enrichgrid.com/v1/enrich/person",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {},
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ identifier: $json.slug }) }}"
      },
      "id": "7c32556b-463a-580c-a42c-a43d66362aaf",
      "name": "Enrich profile",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        880,
        420
      ],
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 3000,
      "credentials": {
        "httpHeaderAuth": {
          "name": "EnrichGrid API key"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose",
            "version": 2
          },
          "conditions": [
            {
              "id": "pending-check",
              "leftValue": "={{ $json.status }}",
              "rightValue": "pending",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "id": "357c191e-6148-535a-85a7-4956e4243b65",
      "name": "Still collecting?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        1100,
        420
      ]
    },
    {
      "parameters": {
        "amount": 3,
        "unit": "seconds"
      },
      "id": "e93e42c1-8e89-558b-81b7-707c8dac9253",
      "name": "Wait 3 s",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1320,
        560
      ],
      "webhookId": "a5bdb9bb-1ef3-5f82-8933-1677e413ea06"
    },
    {
      "parameters": {
        "method": "GET",
        "url": "=https://enrichgrid.com/v1/lookups/{{ $json.id }}",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "options": {}
      },
      "id": "ac76c0a2-f37d-5977-819a-df440113aa23",
      "name": "Check lookup",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1540,
        560
      ],
      "retryOnFail": true,
      "maxTries": 3,
      "waitBetweenTries": 3000,
      "credentials": {
        "httpHeaderAuth": {
          "name": "EnrichGrid API key"
        }
      }
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f-linkedin_url",
              "name": "linkedin_url",
              "value": "={{ 'https://www.linkedin.com/in/' + $('Loop over profiles').item.json.slug }}",
              "type": "string"
            },
            {
              "id": "f-found",
              "name": "found",
              "value": "={{ $json.found }}",
              "type": "string"
            },
            {
              "id": "f-first_name",
              "name": "first_name",
              "value": "={{ $json.profile?.first_name ?? '' }}",
              "type": "string"
            },
            {
              "id": "f-last_name",
              "name": "last_name",
              "value": "={{ $json.profile?.last_name ?? '' }}",
              "type": "string"
            },
            {
              "id": "f-headline",
              "name": "headline",
              "value": "={{ $json.profile?.headline ?? '' }}",
              "type": "string"
            },
            {
              "id": "f-current_title",
              "name": "current_title",
              "value": "={{ $json.profile?.current_title ?? '' }}",
              "type": "string"
            },
            {
              "id": "f-current_company",
              "name": "current_company",
              "value": "={{ $json.profile?.current_company_name ?? '' }}",
              "type": "string"
            },
            {
              "id": "f-seniority",
              "name": "seniority",
              "value": "={{ $json.profile?.seniority ?? '' }}",
              "type": "string"
            },
            {
              "id": "f-location",
              "name": "location",
              "value": "={{ $json.profile?.location ?? '' }}",
              "type": "string"
            },
            {
              "id": "f-country",
              "name": "country",
              "value": "={{ $json.profile?.location_country ?? '' }}",
              "type": "string"
            },
            {
              "id": "f-followers",
              "name": "followers",
              "value": "={{ $json.profile?.follower_count ?? '' }}",
              "type": "string"
            },
            {
              "id": "f-connections",
              "name": "connections",
              "value": "={{ $json.profile?.num_connections ?? '' }}",
              "type": "string"
            },
            {
              "id": "f-status",
              "name": "status",
              "value": "={{ $json.status }}",
              "type": "string"
            },
            {
              "id": "f-credits_charged",
              "name": "credits_charged",
              "value": "={{ $json.credits_charged }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "70c4a70f-e232-5842-b7ac-4e7dbeee1046",
      "name": "Pick columns",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1540,
        320
      ]
    },
    {
      "parameters": {
        "operation": "csv",
        "options": {
          "fileName": "linkedin-profiles.csv"
        }
      },
      "id": "35569c02-5c25-54b7-b536-3b1be9c959ed",
      "name": "Save as CSV",
      "type": "n8n-nodes-base.convertToFile",
      "typeVersion": 1.1,
      "position": [
        880,
        160
      ]
    },
    {
      "parameters": {
        "content": "## Find decision makers → enrich → CSV (EnrichGrid)\n1. Create a **Header Auth** credential named *EnrichGrid API key*: name `x-api-key`, value = your key.\n2. Edit the filters in **Search people** (title, country, city, company, past_company, company_size, industry, school, career years, tenure; see enrichgrid.com/api-docs).\n3. Execute. Search costs 1 credit per page of 10 results; each found profile costs 1 credit. For the next page, send the returned `next_cursor` as `cursor`.",
        "width": 620,
        "height": 300
      },
      "id": "9ef5c2c2-138e-5ebc-a3ff-19d14c4d56be",
      "name": "About",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        -180
      ]
    }
  ],
  "connections": {
    "Start": {
      "main": [
        [
          {
            "node": "Search people",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search people": {
      "main": [
        [
          {
            "node": "One item per profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "One item per profile": {
      "main": [
        [
          {
            "node": "Loop over profiles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop over profiles": {
      "main": [
        [
          {
            "node": "Save as CSV",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Enrich profile",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enrich profile": {
      "main": [
        [
          {
            "node": "Still collecting?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Still collecting?": {
      "main": [
        [
          {
            "node": "Wait 3 s",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Pick columns",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 3 s": {
      "main": [
        [
          {
            "node": "Check lookup",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check lookup": {
      "main": [
        [
          {
            "node": "Still collecting?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Pick columns": {
      "main": [
        [
          {
            "node": "Loop over profiles",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  }
}