What This Workflow Does
This n8n workflow automates the discovery of undocumented API endpoints by analyzing JavaScript files from a website's HTML code. Many websites use internal APIs that aren't publicly documented but can be found by examining their frontend code.
The workflow combines regex pattern matching with AI analysis to identify potential API endpoints, categorize them by functionality, and document their structure. This saves developers and security researchers hours of manual code inspection.
How It Works
1. Website HTML Analysis
The workflow starts by fetching the target website's HTML and extracting all JavaScript file references. It identifies both inline scripts and external JS files.
2. JavaScript File Processing
Each JavaScript file is downloaded and analyzed using a series of regex patterns designed to catch common API call patterns like fetch(), axios, or XMLHttpRequest usage.
3. AI-Powered Context Analysis
Potential endpoints are then processed through an AI model that analyzes the surrounding code context to validate endpoints and predict their purpose and parameters.
4. Endpoint Documentation
The final output is a structured JSON document listing all discovered endpoints with their inferred methods, parameters, and example usage patterns.
Who This Is For
This workflow is ideal for:
- Security researchers analyzing web applications
- Developers integrating with third-party services
- QA engineers testing API coverage
- Data teams building web scrapers
What You'll Need
- An n8n instance (self-hosted or cloud)
- Access to the target website's JavaScript files
- Basic understanding of API structures
- Optional: AI API key for enhanced analysis
Quick Setup Guide
- Download the JSON template file
- Import into your n8n instance
- Configure the target website URL
- Adjust regex patterns if needed
- Set up output destination (Google Sheets, database, etc.)
- Run the workflow
Pro tip: Start with broad regex patterns and refine them based on initial results to reduce false positives.
Key Benefits
Save dozens of hours compared to manual code inspection. What might take days to analyze manually can be done in minutes.
Discover hidden functionality that isn't documented in official API references, potentially unlocking valuable data sources.
Improve security testing by comprehensively mapping all API endpoints for penetration testing.
Scale across multiple websites with consistent analysis methodology rather than ad-hoc approaches.