This workflow corresponds to n8n.io template #12506 — we link there as the canonical source.
This workflow follows the Agent → Chainllm recipe pattern — see all workflows that pair these two integrations.
The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"id": "yhXwVT8BUhBcgUF55sIK8",
"name": "Research organizations using AI with public data sources and report generation",
"tags": [],
"nodes": [
{
"id": "22b1ea36-fac4-426e-8cb8-e9b98178f823",
"name": "Court Listener Discovery",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
640,
2080
],
"parameters": {
"url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
},
"sendHeaders": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"toolDescription": "=**Discovery Phase - Find ALL Court Cases**\n**Base URL:** https://www.courtlistener.com/api/rest/v4/\n**ALWAYS include full base URL in requests**\n\n## Search Endpoint (CORRECTED)\nhttps://www.courtlistener.com/api/rest/v4/search/?type=o&q={query}&page_size=20\n\n## Critical Parameters\n- **type=o** (opinions - most common)\n- **type=r** (RECAP docket documents)\n- **q={search terms}** (URL encode special characters)\n- **page_size=20** (API maximum)\n- **order_by=-score** (best matches first)\n- **court__jurisdiction=F** (F=federal, S=state, optional)\n\n## WORKING Discovery Search URLs\nCompany name searches:\nhttps://www.courtlistener.com/api/rest/v4/search/?type=o&q=cargill&page_size=20\nhttps://www.courtlistener.com/api/rest/v4/search/?type=o&q=\"cargill+meat\"&page_size=20\nhttps://www.courtlistener.com/api/rest/v4/search/?type=o&q=cargill+violation&page_size=20\n\nIssue/violation searches:\nhttps://www.courtlistener.com/api/rest/v4/search/?type=o&q=animal+welfare+cargill&page_size=20\nhttps://www.courtlistener.com/api/rest/v4/search/?type=o&q=environmental+violation+cargill&page_size=20\n\nDocket searches (different endpoint):\nhttps://www.courtlistener.com/api/rest/v4/dockets/?case_name__icontains=cargill&page_size=20\nhttps://www.courtlistener.com/api/rest/v4/dockets/?case_name__icontains=cargill&date_filed__gte=2020-01-01\n\n## Response Structure\n```json\n{\n \"count\": 123,\n \"next\": \"https://www.courtlistener.com/api/rest/v4/search/?page=2...\",\n \"results\": [{\n \"id\": 456789, // CAPTURE THIS for retrieval phase\n \"cluster_id\": 123456, // Alternative ID for cluster retrieval\n \"case_name\": \"NPPC v. Ross\",\n \"absolute_url\": \"/opinion/456789/nppc-v-ross/\", // Note: partial path\n \"court\": \"Court of Appeals for the Ninth Circuit\",\n \"date_filed\": \"2022-03-15\",\n \"snippet\": \"...text preview with <mark>highlighted</mark> terms...\"\n }]\n}",
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "8d926fc2-7092-4fab-95a9-1615f2a30905",
"name": "Google Search Discovery",
"type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
"position": [
352,
2080
],
"parameters": {
"url": "https://google.serper.dev/{endpoint}",
"sendQuery": true,
"sendHeaders": true,
"specifyQuery": "model",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"toolDescription": "=**Discovery Phase - Find ALL Legal Analysis & News**\n\nSearches Google for comprehensive coverage of the query. Cast wide net.\n\n## Endpoint Selection\nYou must specify one of these endpoints:\n- search (general web search) - for legal analysis, expert commentary\n- news (news articles) - for recent coverage, breaking developments\n- scholar (academic papers) - for law review articles\n\n## Query Parameters\n{\n \"q\": \"search query\", // REQUIRED\n \"location\": \"United States\", // optional\n \"tbs\": \"qdr:y\" // optional time filter\n}\n\n## Time Parameters (tbs)\n- \"qdr:d\" (past day)\n- \"qdr:w\" (past week) \n- \"qdr:m\" (past month)\n- \"qdr:y\" (past year)\n\n## Discovery Examples\nsearch endpoint: {\"q\": \"prop 12 legal analysis\", \"tbs\": \"qdr:y\"}\nnews endpoint: {\"q\": \"prop 12 constitutional challenge\", \"tbs\": \"qdr:m\"}\nsearch endpoint: {\"q\": \"proposition 12 california farm\"}\nscholar endpoint: {\"q\": \"prop 12 dormant commerce clause\"}\n\n**In Discovery Phase:**\n- Use multiple search variations\n- Try different endpoints\n- Don't filter results yet\n- Find everything relevant for later prioritization",
"parametersHeaders": {
"values": [
{
"name": "Content-Type",
"value": "application/json",
"valueProvider": "fieldValue"
}
]
},
"placeholderDefinitions": {
"values": [
{
"name": "{endpoint}",
"description": "search - General web search \n\nnews - News articles \n\nscholar - Academic papers \n\npatents - Patent searches \n\nmaps - Location-based searches \n\nreviews - Business/product reviews"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1.1
},
{
"id": "3f3ac475-b844-45c0-8121-9d2664c08c05",
"name": "LegiScan Discovery",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
496,
2080
],
"parameters": {
"url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
},
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"toolDescription": "=**Discovery Phase - Find ALL Related Legislation**\n\n**CRITICAL: ALWAYS use full base URL**\n**Base URL:** https://api.legiscan.com/\n**Every request MUST start with:** https://api.legiscan.com/?op=\n\n## Search Operation\nhttps://api.legiscan.com/?op=getSearch&state={state}&query={query}&year={year}\n\n## Parameters\n- state: ALL (searches all states) or specific state code (CA, TX, etc.)\n- query: search terms (URL encoded)\n- year: 1 (all years), 2 (current session), or specific year\n\n## CORRECT Discovery URLs\n\u2705 https://api.legiscan.com/?op=getSearch&state=ALL&query=prop%2012&year=2\n\u2705 https://api.legiscan.com/?op=getSearch&state=ALL&query=proposition%2012\n\u2705 https://api.legiscan.com/?op=getSearch&state=CA&query=farm%20animal%20confinement\n\n## WRONG (Missing base URL)\n\u274c ?op=getSearch&state=ALL&query=prop%2012\n\u274c getSearch&state=ALL&query=prop%2012\n\n## Response Structure\n{\n \"status\": \"OK\",\n \"searchresult\": {\n \"summary\": {\"count\": 15},\n \"0\": {\n \"bill_id\": 1234567,\n \"bill_number\": \"AB 123\",\n \"title\": \"Farm Animal Confinement Standards\"\n }\n }\n}\n\n**In Discovery Phase:**\n- ALWAYS use state=ALL for comprehensive search\n- Try multiple search terms\n- Note bill_id for later retrieval\n- Don't get full text yet"
},
"credentials": {
"httpQueryAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "345d1e45-5f9e-4ade-b718-8459e12997f5",
"name": "DocumentCloud Dsicovery",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
784,
2080
],
"parameters": {
"url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
},
"toolDescription": "=**Discovery Phase - Find ALL Government Documents**\n\n**Base URL:** https://api.www.documentcloud.org/api/\n**Search Endpoint:** documents/search/\n\n## Full Search URL Pattern\nhttps://api.www.documentcloud.org/api/documents/search/?q={query}&per_page=25\n\n## Query Parameters\n- q: search terms (URL encoded)\n- per_page: up to 25\n- created_at__gte: date filter (YYYY-MM-DD)\n\n## Discovery Search URLs\nhttps://api.www.documentcloud.org/api/documents/search/?q=prop%2012&per_page=25\nhttps://api.www.documentcloud.org/api/documents/search/?q=proposition%2012%20california&per_page=25\nhttps://api.www.documentcloud.org/api/documents/search/?q=CDFA%20enforcement&per_page=25\n\n## Response Structure\n{\n \"results\": [{\n \"id\": \"23456789\",\n \"slug\": \"cdfa-inspection-report\", // CRITICAL: Save this for text retrieval\n \"title\": \"CDFA Prop 12 Inspection Report\",\n \"page_count\": 45,\n \"canonical_url\": \"https://www.documentcloud.org/documents/23456789\"\n }]\n}\n\n**CRITICAL for later retrieval:**\n- Save both \"id\" and \"slug\" fields\n- These are needed to construct text retrieval URL in Phase 3\n- canonical_url is for reference, not for text retrieval\n\n**In Discovery Phase:**\n- Search broadly with multiple terms\n- Save id AND slug for each document\n- Don't retrieve text yet"
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "7b157bae-b0c3-4ebc-8d8e-dee5d8066165",
"name": "Court Listener Retrieveal",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
2704,
2176
],
"parameters": {
"url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
},
"sendHeaders": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"toolDescription": "=**Retrieval Phase - Get Full Opinion Text**\nBase URL: https://www.courtlistener.com/api/rest/v4/\nYour job: Retrieve ONLY opinions Agent 2 selected. NO NEW SEARCHES.\n\nCORRECT URL CONSTRUCTION:\nFor opinions:\nhttps://www.courtlistener.com/api/rest/v4/opinions/{opinion_id}/?fields=plain_text,html_with_citations,case_name,absolute_url\n\nFor clusters (opinion clusters):\nhttps://www.courtlistener.com/api/rest/v4/clusters/{cluster_id}/?fields=case_name,docket,date_filed,absolute_url\n\nFor dockets:\nhttps://www.courtlistener.com/api/rest/v4/dockets/{docket_id}/?fields=case_name,absolute_url,date_filed,court\n\nCRITICAL FIXES:\n1. **Add trailing slash before query params**: `/opinions/{id}/` not `/opinions/{id}`\n2. **Include absolute_url field**: This gives the human-readable URL for citations\n3. **Use proper field names**: \n - `plain_text` for full opinion text\n - `html_with_citations` for formatted version\n - `absolute_url` for the web URL to cite\n\nExample WORKING URL:\nhttps://www.courtlistener.com/api/rest/v4/opinions/4296807/?fields=plain_text,html_with_citations,case_name,absolute_url\n\nResponse will contain:\n- plain_text: Full opinion text\n- html_with_citations: HTML formatted text\n- case_name: Case title\n- absolute_url: The actual web URL for citations (e.g., https://www.courtlistener.com/opinion/4296807/case-name/)\n- date_filed: Filing date\n\nIMPORTANT: Always include `absolute_url` in fields to get the citable web URL!",
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "26b113c5-43b3-41a9-b828-a801a8a51118",
"name": "Think Tool Prioritization",
"type": "@n8n/n8n-nodes-langchain.toolThink",
"position": [
1824,
2144
],
"parameters": {
"description": "=FOR EACH DISCOVERED ITEM, CONDUCT THESE VERIFICATION CHECKS:\n\n1. Company Name Match?\n - Does the company name exactly match or is it a verified subsidiary/DBA?\n - If similar name, is this actually a different company?\n - Are alternate names/trade names consistent?\n\n2. Domain/Digital Match?\n - Does it link to/from the primary domain (companyDomain)?\n - Are SSL certificates/WHOIS data consistent?\n - Do social profiles cross-reference the main domain?\n\n3. Jurisdiction/Location Match?\n - Does the jurisdiction match known corporate registrations?\n - Are office locations consistent with corporate records?\n - If court case, is it in a jurisdiction where company operates?\n\n4. Industry/Business Match?\n - Does the business model match the target company?\n - Does the industry classification align?\n - Are products/services consistent with known offerings?\n - Do technology stacks align with known infrastructure?\n\n5. Red Flags?\n - Different industry entirely?\n - No connection to primary domain?\n - Incompatible founding date?\n - Wrong corporate structure (LLC vs Inc)?\n - Dissolved/inactive status?\n - Personal entity not corporate?\n\nVERDICT: \n- CONFIRMED SAME COMPANY (100% confidence)\n- LIKELY SAME COMPANY (high confidence)\n- UNCERTAIN (cannot determine)\n- DIFFERENT COMPANY (exclude)\n\nIf CONFIRMED, then evaluate relevance to report goal:\n- Do"
},
"typeVersion": 1
},
{
"id": "aecb4b98-85b5-4384-bd39-55852d6632ba",
"name": "LegiScan Retrieval",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
2576,
2176
],
"parameters": {
"url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
},
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"toolDescription": "=**Retrieval Phase - Get Full Bill Text**\n\nBase URL: https://api.legiscan.com/\nCRITICAL: ALWAYS use full URL!\n\nYour job: Retrieve ONLY bills Agent 2 selected. NO NEW SEARCHES.\n\nBill Retrieval URL:\n\u2705 https://api.legiscan.com/?op=getBill&id={bill_id}\n\u274c ?op=getBill&id={bill_id} (WRONG - missing base URL!)\n\nExample:\nhttps://api.legiscan.com/?op=getBill&id=1234567\n\nResponse contains:\n{\n \"bill\": {\n \"bill_id\": 1234567,\n \"title\": \"Full title\",\n \"description\": \"Summary\",\n \"sponsors\": [...],\n \"texts\": [{\"doc_id\": 890, \"type\": \"Introduced\", \"url\": \"...\"}],\n \"history\": [...],\n \"votes\": [...]\n }\n}\n\nTo get actual text:\nhttps://api.legiscan.com/?op=getBillText&id={doc_id}\n\nInclude full bill text and metadata for Agent 4."
},
"credentials": {
"httpQueryAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "610dd29c-86f5-4c4f-8d5c-bfaa2cc48033",
"name": "DocumentCloud Retrieval",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
2832,
2176
],
"parameters": {
"url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
},
"toolDescription": "=**Retrieval Phase - Get Document Full Text**\n\nBase URL: https://s3.documentcloud.org/\n\nYour job: Retrieve text for ONLY documents Agent 2 selected.\n\nCRITICAL URL PATTERN:\nhttps://s3.documentcloud.org/documents/{id}/{slug}.txt.json\n\nALWAYS INCLUDE THE SLASHES!\n\n\u2705 CORRECT: https://s3.documentcloud.org/documents/789123/report.txt.json\n\u274c WRONG: https://s3.documentcloud.org/documents/789123-report.txt.json\n\nConstruction:\n1. Take ID from Agent 2: \"789123\"\n2. Take slug from Agent 2: \"usda-report\"\n3. Build full URL: https://s3.documentcloud.org/documents/789123/usda-report.txt.json\n\nResponse:\n{\n \"pages\": [\n {\"page\": 0, \"contents\": \"Full text of page 1...\"},\n {\"page\": 1, \"contents\": \"Full text of page 2...\"}\n ]\n}"
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "8f1abed0-ca70-4735-82bf-64cc701c4239",
"name": "Jina URL Text Extraction",
"type": "n8n-nodes-base.jinaAiTool",
"position": [
2448,
2176
],
"parameters": {
"url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}",
"options": {},
"requestOptions": {},
"descriptionType": "manual",
"toolDescription": "=**Retrieval Phase - Extract Article Content**\n\nYour job: Get full text from ONLY URLs Agent 2 selected.\n\nSimply pass each prioritized URL:\nhttps://example.com/legal-analysis-article\n\nJina will:\n- Extract main content\n- Remove ads, navigation\n- Return clean text\n- Include title, author, date\n\nOutput: Complete article text for Agent 4's analysis.\n\nNo searching - only extract from Agent 2's selected URLs."
},
"credentials": {
"jinaAiApi": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1
},
{
"id": "44551c96-363b-42c4-8626-9b0f5894bad2",
"name": "Think Tool Analysis",
"type": "@n8n/n8n-nodes-langchain.toolThink",
"position": [
4320,
1888
],
"parameters": {
"description": "=**Analysis Phase - Synthesize All Retrieved Texts**\n\nYour job: Analyze retrieved content to create strategic insights.\n\nRequired Analysis:\n1. Map findings to user query:\n \"User asked about Prop 12 challenges\"\n \n2. Identify patterns:\n \"Pattern: All constitutional challenges have failed\"\n \"Pattern: Enforcement increasing in 2024\"\n \n3. Note contradictions:\n \"9th Circuit upheld, but 6th Circuit questioning\"\n \n4. Identify gaps:\n \"No enforcement data after July 2024\"\n \n5. Develop insights:\n \"Legal challenges exhausted, focus shifting to compliance\"\n \n6. Form recommendations:\n \"Monitor state-level adoption rather than federal challenges\"\n\nFocus on:\n- Connecting dots between sources\n- Finding non-obvious patterns\n- Creating actionable intelligence\n\nThis shapes the final strategic report - think deeply!"
},
"typeVersion": 1
},
{
"id": "cc041ea4-0d5a-400a-b188-ad86a34b306c",
"name": "Structured Output Parser",
"type": "@n8n/n8n-nodes-langchain.outputParserStructured",
"position": [
5040,
1904
],
"parameters": {
"autoFix": true,
"schemaType": "manual",
"inputSchema": "{\n \"$schema\": \"http://json-schema.org/draft-07/schema#\",\n \"title\": \"Verification Report\",\n \"type\": \"object\",\n \"required\": [\"contains_hallucinations\", \"hallucinations\", \"summary\"],\n \"properties\": {\n \"contains_hallucinations\": {\n \"type\": \"boolean\",\n \"description\": \"True if ANY critical factual claim is not supported by retrieved documents\"\n },\n \"hallucinations\": {\n \"type\": \"array\",\n \"description\": \"List of specific unsupported claims\",\n \"items\": {\n \"type\": \"object\",\n \"required\": [\"exact_text\", \"issue_type\", \"severity\"],\n \"properties\": {\n \"exact_text\": {\n \"type\": \"string\",\n \"description\": \"The EXACT text from the report that is unsupported\"\n },\n \"issue_type\": {\n \"type\": \"string\",\n \"enum\": [\"unsupported_number\", \"unsupported_date\", \"false_quote\", \"missing_entity\", \"unsupported_event\", \"unsupported_claim\"],\n \"description\": \"Category of hallucination\"\n },\n \"severity\": {\n \"type\": \"string\",\n \"enum\": [\"critical\", \"moderate\", \"minor\"],\n \"description\": \"How problematic this hallucination is\"\n },\n \"searched_in\": {\n \"type\": \"string\",\n \"description\": \"Which documents were checked for this claim\"\n }\n }\n }\n },\n \"summary\": {\n \"type\": \"string\",\n \"description\": \"Brief summary - either 'All factual claims verified' or '3 critical hallucinations found: [list]'\"\n }\n }\n}"
},
"typeVersion": 1.3
},
{
"id": "3722ea4b-9374-4b5c-804f-b7ae19f3a8bb",
"name": "If hallucinations present",
"type": "n8n-nodes-base.if",
"position": [
5456,
1648
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "3ac4aa73-45ff-4140-90d6-58cb115f069c",
"operator": {
"type": "boolean",
"operation": "true",
"singleValue": true
},
"leftValue": "={{ $json.output.contains_hallucinations }}",
"rightValue": ""
},
{
"id": "e8b43be4-9505-4861-b915-801b10c87c06",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ $runIndex }}",
"rightValue": 4
}
]
}
},
"typeVersion": 2.2
},
{
"id": "0cf05250-2d45-4dcf-8217-bc86cc0bd83e",
"name": "Set Report",
"type": "n8n-nodes-base.set",
"position": [
4768,
1648
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "0381fedf-0f65-4435-bd6f-197614916315",
"name": "Final Report",
"type": "string",
"value": "={{ $json.output }}"
},
{
"id": "e68ea8cd-497f-4734-8581-912436d883fe",
"name": "Retrieved Documents",
"type": "string",
"value": "={{\n (() => {\n const steps = $('Investigating Sources Further').item.json.intermediateSteps;\n if (!steps || !Array.isArray(steps)) return 'No retrieval data available';\n \n // First pass: extract essential info from n8n LangChain structure\n const cleanedData = steps.map((step, index) => {\n const observation = step.observation || 'No response';\n return {\n step: index + 1,\n tool: step.action?.tool || 'Unknown Tool',\n input: step.action?.toolInput || {},\n response: observation\n };\n }).filter(step => step.response && step.response !== 'No response');\n \n // Calculate per-response limit based on number of responses\n const totalMaxLength = 400000; // Total character budget (~100k tokens)\n const responseCount = cleanedData.length;\n const overheadPerResponse = 200; // Estimate for step, tool, input fields\n const totalOverhead = responseCount * overheadPerResponse;\n const availableForResponses = totalMaxLength - totalOverhead;\n \n // Dynamic per-response limit (min 1000 chars, max 50000 chars per response)\n const perResponseLimit = Math.min(\n 50000, \n Math.max(1000, Math.floor(availableForResponses / responseCount))\n );\n \n // Truncate individual responses if needed\n const truncatedData = cleanedData.map(step => {\n let response = step.response;\n \n // Convert to string if needed\n if (typeof response !== 'string') {\n response = JSON.stringify(response, null, 1);\n }\n \n // Truncate if too long\n if (response.length > perResponseLimit) {\n response = response.substring(0, perResponseLimit) + \n `\\n... [TRUNCATED from ${response.length} to ${perResponseLimit} chars]`;\n }\n \n return {\n ...step,\n response: response.trim()\n };\n });\n \n // Final safety check on total size\n let finalStr = JSON.stringify(truncatedData, null, 1);\n if (finalStr.length > totalMaxLength) {\n // If still too big, be more aggressive with largest responses\n const sorted = [...truncatedData].sort((a, b) => \n b.response.length - a.response.length\n );\n \n // Truncate the largest responses more aggressively\n for (let i = 0; i < Math.min(5, sorted.length); i++) {\n const newLimit = Math.floor(perResponseLimit * 0.5);\n if (sorted[i].response.length > newLimit) {\n sorted[i].response = sorted[i].response.substring(0, newLimit) + \n `\\n... [FURTHER TRUNCATED to ${newLimit} chars]`;\n }\n }\n \n // Re-sort by original order\n truncatedData.sort((a, b) => a.step - b.step);\n finalStr = JSON.stringify(truncatedData, null, 1);\n }\n \n return finalStr;\n })()\n}}"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "f3c87e09-530a-48ac-9db4-fe5e7ebc438e",
"name": "Retry if Tools Not Used",
"type": "n8n-nodes-base.if",
"position": [
912,
1584
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9bc6faa2-c596-4d24-8e2f-6f7888987d29",
"operator": {
"type": "object",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json.intermediateSteps[0] }}",
"rightValue": ""
},
{
"id": "2aa597be-e115-4022-8abc-99909f29fd83",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ $runIndex }}",
"rightValue": 4
}
]
}
},
"typeVersion": 2.2
},
{
"id": "5a80d647-0baa-47a2-a626-fdc463500012",
"name": "Retry if Tools Not Used1",
"type": "n8n-nodes-base.if",
"position": [
2960,
1616
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9bc6faa2-c596-4d24-8e2f-6f7888987d29",
"operator": {
"type": "object",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json.intermediateSteps[0] }}",
"rightValue": ""
},
{
"id": "2aa597be-e115-4022-8abc-99909f29fd83",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ $runIndex }}",
"rightValue": 4
}
]
}
},
"typeVersion": 2.2
},
{
"id": "c4c5adc7-607a-4453-a43c-1b6a5c6ec684",
"name": "Retry if Response Empty",
"type": "n8n-nodes-base.if",
"position": [
1760,
1600
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9bc6faa2-c596-4d24-8e2f-6f7888987d29",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json.output }}",
"rightValue": ""
},
{
"id": "2aa597be-e115-4022-8abc-99909f29fd83",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ $runIndex }}",
"rightValue": 4
}
]
}
},
"typeVersion": 2.2
},
{
"id": "6bf0f59b-aa39-4dae-9a0b-b1176d9c4636",
"name": "Retry if Response Empty1",
"type": "n8n-nodes-base.if",
"position": [
4416,
1632
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "9bc6faa2-c596-4d24-8e2f-6f7888987d29",
"operator": {
"type": "string",
"operation": "empty",
"singleValue": true
},
"leftValue": "={{ $json.output }}",
"rightValue": ""
},
{
"id": "2aa597be-e115-4022-8abc-99909f29fd83",
"operator": {
"type": "number",
"operation": "lt"
},
"leftValue": "={{ $runIndex }}",
"rightValue": 4
}
]
}
},
"typeVersion": 2.2
},
{
"id": "d25cfb1f-9088-46f5-a5e3-fd924e96858c",
"name": "Auto Fallback",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
208,
2080
],
"parameters": {
"model": "openrouter/auto",
"options": {
"temperature": 0.7
}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "ebe28b9c-779e-478f-bb83-8b2a60e1b255",
"name": "Gemini 2.5 Flash",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
64,
2080
],
"parameters": {
"model": "google/gemini-2.5-flash",
"options": {
"temperature": 0.7
}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "6e9ec3bf-26bc-4575-99f4-00aa6972bcb3",
"name": "Auto Fallback1",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
1632,
2144
],
"parameters": {
"model": "openrouter/auto",
"options": {
"temperature": 0.3
}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "193f24f2-1e74-4e79-b043-fb70e8691229",
"name": "Auto Fallback2",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
2288,
2176
],
"parameters": {
"model": "openrouter/auto",
"options": {
"temperature": 0.2
}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "6e7b894a-057e-4b0a-b395-ffac0fd59569",
"name": "Gemini 2.5 Flash2",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
2144,
2176
],
"parameters": {
"model": "google/gemini-2.5-flash",
"options": {
"temperature": 0.2
}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "abb13953-f0ea-4ea9-aa8c-1f08ab5df0a2",
"name": "Auto Fallback3",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
4160,
1888
],
"parameters": {
"model": "openrouter/auto",
"options": {
"temperature": 0.6
}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "1799e252-aba0-4198-b4a6-daf004b9df70",
"name": "Auto Fallback4",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
4912,
1904
],
"parameters": {
"model": "openrouter/auto",
"options": {
"temperature": 0.2
}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "ce5d58d7-23b0-42a4-85d1-508a20334be5",
"name": "Auto Fallback5",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
"position": [
5728,
1920
],
"parameters": {
"model": "openrouter/auto",
"options": {
"temperature": 0.1
}
},
"credentials": {
"openRouterApi": {
"name": "<your credential>"
}
},
"typeVersion": 1
},
{
"id": "8df2a24c-c717-42aa-9aa9-5a7df55c53aa",
"name": "Step 6: Fixing Hallucinations",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
5680,
1648
],
"parameters": {
"text": "=Current Date & Time: {{ $now }}\n\n# **User's Original Query**\n\nCompany Name: {{ $('Set Prompt').item.json.companyName }}\nPrimary Domain: {{ $('Set Prompt').item.json.companyDomain }}\nReport Goal: {{ $('Set Prompt').item.json.reportGoal }}\n\n# **Retrieved Documents** - All full texts with their source URLs\n\n{{ \n (() => {\n const docs = JSON.stringify($('Investigating Sources Further').item.json.intermediateSteps);\n // 1.6M chars (~400K tokens) - this is your main content\n return docs.length > 1600000 ? docs.slice(0, 1600000) + '\\n... [TRUNCATED]' : docs;\n })()\n}}\n\n# **Failed Report** - The report that contains hallucinations\n\n{{ \n (() => {\n const report = $('Set Report').item.json['Final Report'] || '';\n // 800K chars (~200K tokens) - full report should fit\n return report.length > 800000 ? report.substring(0, 800000) + '\\n... [TRUNCATED]' : report;\n })()\n}}\n\n# **Hallucinations** - FIX THESE PROBLEMS\n\n{{ \n (() => {\n const h = JSON.stringify($json.output.hallucinations, null, 2);\n // 80K chars (~20K tokens) - comprehensive hallucination list\n return h.length > 80000 ? h.slice(0, 80000) + '\\n... [TRUNCATED]' : h;\n })()\n}}",
"options": {
"maxIterations": 10,
"systemMessage": "=# \ud83d\udcdd ORGANIZATION OSINT REPORT REWRITE AGENT\n\n## Mission\nFix the specific hallucinations identified while **preserving everything valuable about the report**. The original report was written to be responsive to the user's specific query - maintain that responsiveness. Your job is surgical correction, not reconstruction.\n\n\n## CRITICAL: Automated System Instructions\n\n**YOU ARE PART OF AN AUTOMATED PIPELINE. This is a ONE-SHOT report generation with NO follow-up possible.**\n\n### Absolute Requirements:\n- You CANNOT interact with the user after this report\n- You CANNOT ask questions or request clarification \n- You CANNOT offer to do additional research or analysis\n- You MUST produce a complete, final report right now\n- You MUST work with whatever information you have\n\n### NEVER write phrases like:\n- \"Would you like me to...\"\n- \"I can also look into...\"\n- \"Let me know if you need...\"\n- \"Feel free to ask for...\"\n- \"I could further analyze...\"\n- \"If you want more detail on...\"\n- \"Should you need additional...\"\n- \"I'm happy to explore...\"\n- \"Would you prefer...\"\n- \"Shall I continue with...\"\n\n### INSTEAD:\n- Write a complete, self-contained report\n- Include all relevant analysis in THIS response\n- Make definitive statements and recommendations\n- Provide all insights you can generate NOW\n- Present findings as final deliverables\n\n### CITATION REQUIREMENTS:\n- **EVERY factual claim must include its source**\n- **ALWAYS include the full URL** when available\n- **Use inline citations** with [Source: URL] AND footnotes\n- **Never make unsourced claims** about verifiable facts\n- **If multiple sources support a claim**, cite all relevant ones\n\n### COMPREHENSIVENESS PRINCIPLE:\n**Create a LONG, DETAILED report with MOST IMPORTANT findings at the top**\n- **Executive Summary first** with key findings and recommendations\n- **Include ALL relevant information** from retrieved documents\n- **Don't summarize or condense** - be exhaustive with details\n- **Use extensive quotes** from source materials\n- **Provide complete analysis** of every relevant aspect\n- **Length is NOT a concern** - thoroughness is paramount\n- **Organize by importance** - critical findings first, supporting details follow\n- **Extract maximum value** from every document retrieved\n\n**This is your ONLY opportunity to provide value to the user. Make the report comprehensive, detailed, and complete. The user would rather have too much information than too little.**\n\n\n## CRITICAL PRINCIPLES\n\n### 1. THE REPORT'S VALUE COMES FROM ITS ANALYSIS\n- **Strategic insights are the point** - Never remove these\n- **Campaign recommendations are essential** - Keep all of them\n- **Vulnerability assessments are core value** - Preserve entirely\n- **Pattern recognition is intelligence work** - Maintain it all\n\n### 2. RESPECT THE ORIGINAL STRUCTURE\n- **The writer adapted to the user's query** - Don't impose a template\n- **The order was chosen for relevance** - Keep it\n- **Sections were named for clarity** - Don't standardize them\n- **Some parts were emphasized intentionally** - Preserve emphasis\n\n### 3. MINIMAL INTERVENTION PHILOSOPHY\n- **Only fix what's specifically flagged as wrong**\n- **Keep everything else exactly as written**\n- **Don't \"improve\" things that aren't broken**\n- **Preserve the original voice and flow**\n\n## HOW TO HANDLE FLAGGED HALLUCINATIONS\n\n### Read Each Hallucination Carefully\nBefore fixing anything, understand:\n- What specific claim is wrong?\n- Is it completely false or just imprecise?\n- What was the analytical point being made?\n- Can the point survive without this claim?\n\n### Choose the Lightest Touch That Works\n\n**1. ADJUST PRECISION** (First choice)\n- \"5,247 employees\" \u2192 \"approximately 5,000 employees\"\n- \"Founded in March 2019\" \u2192 \"Founded in 2019\"\n- \"$47.3M revenue\" \u2192 \"$10-50M revenue\" (if BuiltWith shows this)\n- \"37% market share\" \u2192 \"significant market share\"\n\n**2. ADD QUALIFIER** (When adjustment isn't enough)\n- \"Has violated...\" \u2192 \"Reportedly has violated...\"\n- \"CEO stated...\" \u2192 \"CEO reportedly stated...\"\n- \"Uses AWS exclusively\" \u2192 \"Appears to use AWS\"\n- \"Will expand to...\" \u2192 \"Plans suggest expansion to...\"\n\n**3. CONVERT TO ANALYSIS** (When fact is unsupported but insight is valid)\n- \"Has 5 facilities\" \u2192 \"Operations suggest multiple facilities\"\n- \"Spent $10M on...\" \u2192 \"Investment patterns indicate significant spending on...\"\n- \"Partners with X\" \u2192 \"Technology stack suggests partnership with X\"\n\n**4. REMOVE** (Only when absolutely necessary)\n- Only if completely fabricated AND\n- The point can't be made another way AND\n- Removal doesn't break the flow\n\n### Preserve the Analytical Value\n\nIf a hallucination supported a valid strategic point:\n- Find another way to make that point\n- Use available evidence differently\n- Reframe as assessment rather than fact\n- Keep the strategic conclusion even if the supporting fact changes\n\n## WHAT TO NEVER CHANGE\n\n### Protected Content - Don't Touch These:\n\n**Strategic Sections:**\n- Campaign recommendations\n- Vulnerability assessments\n- Pressure point analysis\n- Coalition opportunities\n- Messaging strategies\n- Tactical approaches\n\n**Analytical Content:**\n- \"This suggests...\"\n- \"Analysis indicates...\"\n- \"Pattern shows...\"\n- \"Evidence points to...\"\n- \"Strategic opportunity exists...\"\n- \"Campaign could leverage...\"\n\n**Structural Elements:**\n- The user-responsive organization\n- Section headers (even if non-standard)\n- Emphasis and priorities\n- Executive summary focus\n- Conclusion and recommendations\n\n**Qualitative Assessments:**\n- Market position evaluations\n- Competitive analysis\n- Risk assessments\n- Opportunity identification\n- Stakeholder mapping\n\n## PRACTICAL EXAMPLES\n\n### Hallucination: \"Company has 5,000 employees\"\n**If sources show 4,800:** Just leave it - close enough\n**If sources show \"large workforce\":** Change to \"large workforce\"\n**If sources show nothing:** Change to \"workforce size unclear from available data\"\n**If analyzing organizing potential:** Keep the analysis even if you modify the number\n\n### Hallucination: \"FDA issued warning in March 2023\"\n**If FDA issued warning in May 2023:** Adjust to \"FDA issued warning in 2023\"\n**If FDA issued violation, not warning:** Adjust to \"FDA issued violation in 2023\"\n**If no FDA action found:** Remove sentence but keep any analysis about regulatory pressure\n\n### Hallucination: \"Revenue of $47.3M\"\n**If BuiltWith shows $10-50M:** Change to \"$10-50M per BuiltWith\"\n**If sources suggest \"mid-market\":** Change to \"mid-market revenue tier\"\n**If no revenue data:** Remove number but keep analysis about financial position\n\n## REWRITE PROCESS\n\n1. **Read the full report first** - Understand its purpose and flow\n2. **Review what the user originally asked for** - Ensure fixes maintain responsiveness\n3. **Address only flagged hallucinations** - Don't fix what isn't broken\n4. **Use lightest touch possible** - Adjust > Qualify > Convert > Remove\n5. **Preserve all analysis** - This is the report's value\n6. **Maintain original structure** - It was adapted to user needs\n7. **Keep the same tone and voice** - Don't formalize informal writing\n\n## OUTPUT RULES\n\n### Start Immediately\n- No preamble about what you're doing\n- No explanation of changes made\n- Just output the corrected report\n\n### Maintain Everything Valuable\n- All strategic insights\n- All campaign recommendations \n- All vulnerability assessments\n- All analytical frameworks\n- All actionable intelligence\n\n### Format Preservation\n- Keep the original section structure\n- Maintain the same headers\n- Preserve the emphasis patterns\n- Keep the same level of detail\n- Maintain source citation style\n\n## CRITICAL REMINDERS\n\n1. **You're a corrector, not a rewriter** - Minimal changes only\n2. **Analysis is sacred** - Never remove strategic insights\n3. **Structure was chosen for a reason** - Don't standardize it\n4. **The report answered a specific query** - Keep it responsive\n5. **Campaign value is paramount** - Preserve all actionable intelligence\n6. **When in doubt, keep it** - Better to leave marginal content than remove value\n\n## FINAL INSTRUCTION\n\nOutput the corrected report immediately. Fix ONLY the specific hallucinations identified. Preserve everything else exactly as written, including all analysis, recommendations, structure, and strategic insights. The goal is a report that's accurate but retains all its original intelligence value and responsiveness to the user's query.\n\nRemember: A report full of strategic insights, vulnerability analysis, and campaign recommendations is doing exactly what it should do. Your job is to fix factual errors while preserving all that value.",
"returnIntermediateSteps": true
},
"promptType": "define",
"needsFallback": true
},
"retryOnFail": true,
"typeVersion": 2.2
},
{
"id": "942b76f1-9d0d-4112-9040-830c62e8b872",
"name": "Think Tool Analysis2",
"type": "@n8n/n8n-nodes-langchain.toolThink",
"position": [
5904,
1920
],
"parameters": {
"description": "=**Analysis Phase - Synthesize All Retrieved Texts**\n\nYour job: Analyze retrieved content to create strategic insights.\n\nRequired Analysis:\n1. Map findings to user query:\n \"User asked about Prop 12 challenges\"\n \n2. Identify patterns:\n \"Pattern: All constitutional challenges have failed\"\n \"Pattern: Enforcement increasing in 2024\"\n \n3. Note contradictions:\n \"9th Circuit upheld, but 6th Circuit questioning\"\n \n4. Identify gaps:\n \"No enforcement data after July 2024\"\n \n5. Develop insights:\n \"Legal challenges exhausted, focus shifting to compliance\"\n \n6. Form recommendations:\n \"Monitor state-level adoption rather than federal challenges\"\n\nFocus on:\n- Connecting dots between sources\n- Finding non-obvious patterns\n- Creating actionable intelligence\n\nThis shapes the final strategic report - think deeply!"
},
"typeVersion": 1
},
{
"id": "d4b472af-7e48-46f5-85c0-8b83ae12eab0",
"name": "Search Open Paws Database2",
"type": "@n8n/n8n-nodes-langchain.vectorStoreWeaviate",
"position": [
1056,
2032
],
"parameters": {
"mode": "retrieve-as-tool",
"topK": 10,
"options": {},
"toolDescription": "=**Internal Knowledge Base Search**\n\nSearches curated animal advocacy knowledge base containing research, strategies, and historical campaign data.\n\n**Query:** Natural language search terms\n**Returns:** Relevant documents with credibility and relevance scores\n\n**Use When:**\n- Need animal advocacy-specific context\n- Looking for proven strategies or campaign precedents \n- Want grounded information beyond generic web search\n- Research involves ethics, policy, or movement strategy\n\n**Best Practice:** Use before general web search for animal advocacy topics.",
"weaviateCollection": {
"__rl": true,
"mode": "list",
"value": "Content",
"cachedResultName": "Content"
}
},
"credentials": {
"weaviateApi": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1.3
},
{
"id": "d80a9ecd-5213-4438-990a-986961ec414e",
"name": "Embeddings OpenAI2",
"type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
"position": [
1200,
2176
],
"parameters": {
"options": {}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
},
"typeVersion": 1.2
},
{
"id": "46959214-9e3b-440a-aff6-6ef154b825cc",
"name": "Twitter Profile Scraper1",
"type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
"position": [
3296,
2176
],
"parameters": {
"url": "http://api.scrapingdog.com/x/profile?profileId={profileId}&parsed=true",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"toolDescription": "=**Twitter Profile & Content Analysis**\n\nRetrieves profile information and recent posts from Twitter/X accounts.\n\n**Input:** `profileId` - Twitter username (e.g., \"username\" from x.com/username)\n\n**Use When:** Understanding someone's public positions, communication style, or recent activity on Twitter.",
"placeholderDefinitions": {
"values": [
{
"name": "{profileId}",
"description": "The ID for the profile you want to scrape"
}
]
}
},
"credentials": {
"httpQueryAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1.1
},
{
"id": "4833e814-7b6d-4948-a230-5e5fe66f8659",
"name": "Linkedin Person and Company Scraper1",
"type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
"position": [
2992,
2176
],
"parameters": {
"url": "https://api.scrapingdog.com/linkedin",
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"parametersQuery": {
"values": [
{
"name": "linkId"
},
{
"name": "type"
}
]
},
"toolDescription": "=**LinkedIn Profile Intelligence**\n\nExtracts professional information from LinkedIn profiles including job history, connections, and public posts.\n\n**Input:**\n\nlinkId\n\nrequired\n\nThis is the Linkedin ID of any person profile. This can be found inside the URL of any profile i.e. for https://www.linkedin.com/in/sam-tucker-vegan/ the linkId is sam-tucker-vegan\n\nType: String\n\nrequired\n\nThis is a string that helps us to identify whether you want to scrape a person profile or a company profile.\n\nFor a person profile, you have to pass type=profile and for a company you type type=company\n\nType: String\n\nrequired"
},
"credentials": {
"httpQueryAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1.1
},
{
"id": "f53a6bcb-104c-4e2e-b1e3-7d039150fbaa",
"name": "Instagram Profile Scraper1",
"type": "@n8n/n8n-nodes-langchain.toolHttpRequest",
"position": [
3136,
2176
],
"parameters": {
"url": "https://api.scrapingdog.com/instagram/profile?username={username}",
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"toolDescription": "=**Instagram Content & Profile Analysis**\n\nExtracts profile information, recent posts, captions, and hashtags from public Instagram accounts.\n\n**Input:** `username` - Instagram username without @ symbol\n\n**Use When:** Understanding visual content strategy, audience engagement, or lifestyle/values presentation.",
"placeholderDefinitions": {
"values": [
{
"name": "{username}",
"description": "The username for the Instagram profile you want to read the posts from"
}
]
}
},
"credentials": {
"httpQueryAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 1.1
},
{
"id": "06cad5b8-b753-499d-8eb8-d4e3acb4fd28",
"name": "BuiltWith1",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
3440,
2176
],
"parameters": {
"url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
},
"response": {
"response": {}
}
},
"sendHeaders": true,
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"toolDescription": "=# BuiltWith API\n\n## What & Why\n**What:** Website technology profiler - tech stacks, revenue estimates, corporate relationships, social connections \n**Use when:** Need corporate tech analysis, company financials, subsidiary mapping, website relationships, market intelligence, digital infrastructure research\n\n**Base:** `https://api.builtwith.com/` \n**Auth:** Via query parameters (handled by system)\n\nIMPORTANT: ALWAYS INCLUDE THE BASE URL, YOU CANNOT JUST USE THE DOMAIN NAME OF THE COMPANY BY ITSELF, YOU MUST USE THE BASE URL FIRST AND EMBED THE DOMAIN AS A QUERY PARAMETER\n\n## Core Endpoints (USE THESE)\n\n### 1. Technology Profile - PRIMARY ENDPOINT\n```\nhttps://api.builtwith.com/v21/api.json?LOOKUP=tyson.com\nhttps://api.builtwith.com/v21/api.json?LOOKUP=tyson.com,cargill.com,jbs.com.br # batch up to 16\nhttps://api.builtwith.com/v21/api.json?HIDETEXT=yes&NOMETA=yes&LOOKUP=example.com # fast mode\nhttps://api.builtwith.com/v21/api.json?LIVEONLY=yes&LOOKUP=example.com # current tech only\n```\n**Provides:** Tech stack, revenue estimates, company info, employee count, industry vertical\n\n### 2. Website Relationships\n```\nhttps://api.builtwith.com/rv3/api.json?LOOKUP=tyson.com\nhttps://api.builtwith.com/rv3/api.json?LOOKUP=cargill.com\n```\n**Provides:** Connected domains, subsidiaries, shared analytics/ad accounts\n\n### 3. Social Media\n```\nhttps://api.builtwith.com/social1/api.json?LOOKUP=tyson\nhttps://api.builtwith.com/social1/api.json?LOOKUP=linkedin.com/company/tyson-foods\n```\n**Provides:** Social media profiles, follower counts, engagement metrics\n\n### 4. Other Endpoints\n```\nhttps://api.builtwith.com/redirect1/api.json?LOOKUP=example.com # redirects\nhttps://api.builtwith.com/trends/v6/api.json?TECH=Shopify # technology trends\n```\n\n## Strategic Queries\n\n### Food Industry Giants\n```\n# Major meat processors with financial estimates\nhttps://api.builtwith.com/v21/api.json?LOOKUP=tyson.com,cargill.com,jbs.com.br,smithfieldfoods.com\n\n# Find subsidiaries/relationships\nhttps://api.builtwith.com/rv3/api.json?LOOKUP=tyson.com\n\n# Plant-based competitors\nhttps://api.builtwith.com/v21/api.json?LOOKUP=beyondmeat.com,impossiblefoods.com,oatly.com\n```\n\n### Corporate Investigation\n```\n# 1. Tech profile with financials\nhttps://api.builtwith.com/v21/api.json?LOOKUP=target-company.com\n\n# 2. Subsidiary mapping\nhttps://api.builtwith.com/rv3/api.json?LOOKUP=target-company.com\n\n# 3. Social presence\nhttps://api.builtwith.com/social1/api.json?LOOKUP=company-name\n```\n\n### Market Intelligence\n```\n# Industry tech trends\nhttps://api.builtwith.com/trends/v6/api.json?TECH=E-commerce-Platform\n\n# Competitor comparison (batch for efficiency)\nhttps://api.builtwith.com/v21/api.json?LOOKUP=competitor1.com,competitor2.com,competitor3.com\n```\n\n## Response Structure\n\n### Technology Profile (v21) - INCLUDES FINANCIAL DATA\n```json\n{\n \"Results\": [{\n \"Lookup\": \"tyson.com\",\n \"Result\": {\n \"Spend\": 15000, // Monthly tech spend estimate\n \"SalesRevenue\": 47000000000, // Annual revenue estimate\n \"Paths\": [{\n \"Technologies\": [{\n \"Name\": \"Google Analytics\",\n \"Categories\": [\"Web Analytics\"],\n \"FirstDetected\": 1378422000000,\n \"LastDetected\": 1609459200000\n }]\n }],\n \"Meta\": {\n \"CompanyName\": \"Tyson Foods Inc\",\n \"Country\": \"US\",\n \"Vertical\": \"Food and Beverage\",\n \"Employees\": \"10000+\"\n }\n }\n }]\n}\n```\n\n### Relationship Response\n```json\n{\n \"Relationships\": [{\n \"Domain\": \"tyson.com\",\n \"Identifiers\": [{\n \"Type\": \"google-analytics\",\n \"Value\": \"UA-12345678\",\n \"Matches\": [{\n \"Domain\": \"subsidiary.com\",\n \"Overlap\": true\n }]\n }]\n }]\n}\n```\n\n### Social Response\n```json\n{\n \"Results\": [{\n \"Lookup\": \"tyson\",\n \"Profiles\": [{\n \"Platform\": \"twitter\",\n \"Handle\": \"@tysonfoods\",\n \"Followers\": 45000,\n \"Url\": \"https://twitter.com/tysonfoods\"\n }]\n }]\n}\n```\n\n## Key Fields\n\n### Tech Profile (v21) - Most Important\n- `Result.SalesRevenue` - Estimated annual revenue \n- `Result.Spend` - Monthly tech spend estimate\n- `Result.Technologies[].Name` - Technology stack\n- `Result.Meta.CompanyName` - Official company name\n- `Result.Meta.Employees` - Employee count range\n- `Result.Meta.Country` - Headquarters location\n- `Result.Meta.Vertical` - Industry category\n\n### Relationships\n- `Identifiers[].Matches` - Connected domains (subsidiaries, partners)\n- `Identifiers[].Type` - Connection type (shared analytics, DNS, etc.)\n- `Identifiers[].Value` - Shared identifier value\n\n### Social\n- `Profiles[].Platform` - Social network name\n- `Profiles[].Followers` - Follower count\n- `Profiles[].Handle` - Username/handle\n\n## Workflow Patterns\n\n### Complete Company Analysis\n1. Get company overview and financials:\n ```\n https://api.builtwith.com/v21/api.json?LOOKUP=company.com\n ```\n\n2. Find connected companies:\n ```\n https://api.builtwith.com/rv3/api.json?LOOKUP=company.com\n ```\n\n3. Analyze social presence:\n ```\n https://api.builtwith.com/social1/api.json?LOOKUP=company\n ```\n\n### Supply Chain Mapping\n1. Analyze parent company:\n ```\n https://api.builtwith.com/v21/api.json?LOOKUP=parent.com\n ```\n\n2. Identify subsidiaries:\n ```\n https://api.builtwith.com/rv3/api.json?LOOKUP=parent.com\n ```\n\n3. Batch analyze subsidiaries:\n ```\n https://api.builtwith.com/v21/api.json?LOOKUP=sub1.com,sub2.com,sub3.com\n ```\n\n### Competitive Intelligence\n1. Batch analyze competitors:\n ```\n https://api.builtwith.com/v21/api.json?LOOKUP=comp1.com,comp2.com,comp3.com\n ```\n\n2. Compare tech stacks and spending:\n - Extract `Technologies` arrays\n - Compare `Spend` values\n - Analyze `SalesRevenue` differences\n\n## Best Practices\n\n### Reliability\n- **Always use** `/v21/api.json` for financial data (includes revenue estimates)\n- **Skip** the `/financial1/` endpoint (unreliable, returns non-JSON)\n- All endpoints shown above return valid JSON consistently\n\n### Performance\n- Batch up to 16 domains in tech profile requests\n- Use `HIDETEXT=yes&NOMETA=yes` for 50% faster responses\n- Max 8 concurrent requests, 10 requests/second\n- Use `LIVEONLY=yes` to skip historical data\n\n### Common Patterns\n- For financial data \u2192 Use tech profile's `SalesRevenue` field\n- For subsidiaries \u2192 Use relationships endpoint\n- For tech stack \u2192 Use tech profile's `Technologies` array\n- For social metrics \u2192 Use social endpoint\n\n### Domain Formats\n- Try without www first: `example.com`\n- If no results, try with www: `www.example.com`\n- For international: Use local TLD (`example.co.uk`, `example.de`)\n\n**URL Encoding:** spaces=%20, slashes=%2F",
"headerParameters": {
"parameters": [
{
"name": "Accept",
"value": "application/json"
}
]
}
},
"credentials": {
"httpQueryAuth": {
"name": "<your credential>"
}
},
"retryOnFail": true,
"typeVersion": 4.2
},
{
"id": "d3ce2ee2-366b-456e-a659-85d8a4396757",
"name": "Open Corporates2",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
3584,
2176
],
"parameters": {
"url": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', ``, 'string') }}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
},
"authentication": "genericCredentialType",
"genericAuthType": "httpQueryAuth",
"toolDescription": "=# OpenCorporates API\n\n## What & Why\n**What:** Global corporate registry database with ownership, officers, filings \n**Use when:** Need company info, ownership networks, directors, corporate structure, subsidiaries, beneficial ownership, indust
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
httpHeaderAuthhttpQueryAuthjinaAiApiopenAiApiopenRouterApiweaviateApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
This workflow is designed for researchers, investigators, and analysts who need to: Build comprehensive profiles of organizations from public sources Research court cases, legislation, and government documents related to companies Verify company information across multiple…
Source: https://n8n.io/workflows/12506/ — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This workflow is designed for sales professionals, recruiters, and researchers who need to: Build comprehensive profiles of individuals from public sources Understand communication and personality sty
Your AI workforce is ready. Are you?
Indoor Farming Agent. Uses lmChatOpenAi, documentDefaultDataLoader, embeddingsOpenAi, toolVectorStore. Webhook trigger; 36 nodes.
Build a Multi-Agent system with n8n, Qdrant, Gmail & OpenAI. Uses vectorStoreQdrant, toolWorkflow, executeWorkflowTrigger, googleDrive. Event-driven trigger; 29 nodes.
This template presents a multi-agent system in which a coordinating agent manages specialized sub-agents: an AI agent for RAG and document summarization, and an email agent. Each agent effectively ope