n8n API Discovery Regex AI Analysis

Discover hidden website API endpoints using regex and AI

Automatically find undocumented API interfaces by analyzing website JavaScript files

Download Template JSON · n8n compatible · Free
n8n workflow for discovering hidden API endpoints

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

  1. An n8n instance (self-hosted or cloud)
  2. Access to the target website's JavaScript files
  3. Basic understanding of API structures
  4. Optional: AI API key for enhanced analysis

Quick Setup Guide

  1. Download the JSON template file
  2. Import into your n8n instance
  3. Configure the target website URL
  4. Adjust regex patterns if needed
  5. Set up output destination (Google Sheets, database, etc.)
  6. 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.

Frequently Asked Questions

Common questions about API endpoint discovery and automation

Hidden API endpoints are undocumented interfaces that websites use internally. They matter because they often provide access to valuable data or functionality not available through official APIs. Many websites use these endpoints for their frontend while keeping them undocumented to control access.

For example, an e-commerce site might have product recommendation endpoints that aren't in their public API docs. Discovering these can help developers build more integrated solutions or help security teams assess potential vulnerabilities.

Regular expressions (regex) can scan JavaScript files for patterns that indicate API calls. Common patterns include fetch(), axios calls, or URLs containing /api/. Regex allows you to systematically search through code for these telltale signs of API usage.

Advanced regex patterns can also identify parameter structures and HTTP methods. For instance, a pattern might look for strings following the format '/api/v1/products/' followed by parameters in curly braces or query strings.

Always ensure you have permission to analyze a website's code. Using undocumented APIs may violate terms of service. Additionally, never use discovered endpoints for malicious purposes like scraping protected data or disrupting services.

From a defensive perspective, if you're analyzing your own website, this workflow can help identify endpoints that should be secured or removed. Many security vulnerabilities stem from forgotten or undocumented API endpoints.

  • Check robots.txt for disallowed paths
  • Verify terms of service before analysis
  • Limit request rates to avoid service disruption

Yes, AI can analyze code context better than simple regex patterns. It can identify API calls even when they're obfuscated or use unconventional patterns. AI also helps categorize endpoints by functionality and predict their parameters.

For instance, AI can distinguish between admin endpoints and public-facing ones based on surrounding code comments or variable names. It can also suggest likely authentication requirements by analyzing how tokens are handled in the code.

Browser developer tools, Postman, Burp Suite, and specialized API discovery tools like Fiddler can help. However, n8n provides automation capabilities that make the process scalable and repeatable across multiple websites.

The advantage of using n8n is that you can chain API discovery with other workflows. For example, you might automatically test discovered endpoints or integrate them into your existing API documentation system.

Accuracy depends on the complexity of the website and the rules you define. Simple regex patterns might catch 60-70% of endpoints, while combining regex with AI analysis can achieve 90%+ accuracy for many modern websites.

False positives are common with basic patterns, which is why the AI validation step is valuable. The most challenging cases are websites that heavily obfuscate their JavaScript or dynamically generate API calls.

Yes, GrowwStacks specializes in building custom API discovery solutions tailored to your specific needs. We can create workflows that target particular website architectures, integrate with your existing tools, and automate the entire API analysis process.

Our team can develop specialized patterns for your industry, integrate with your security testing frameworks, or create ongoing monitoring solutions that alert you to new API endpoints as websites update their code.

Need a Custom API Discovery Integration?

This free template is a starting point. Our team builds fully tailored automation systems for your specific needs.