Skip to main content

Discover hidden website API endpoints using regex and AI

Workflow preview

Workflow preview
100%
Discover hidden website API endpoints using regex and AI preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

What it is for This workflow helps to automatically discover undocumented API endpoints by analysing JavaScript files from the website's HTML code. When building automation for platforms without...

Best for

  • Engineering automation workflows
  • AI Summarization automation workflows
  • advanced n8n builders looking for reusable templates

Tools used

n8n-nodes-base.stickynote, @n8n/n8n-nodes-langchain.outputparserautofixing, n8n-nodes-base.manualtrigger, n8n-nodes-base.set, n8n-nodes-base.httprequest, n8n-nodes-base.html, n8n-nodes-base.splitout, n8n-nodes-base.filter

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Yulia.

Original n8n.io source

1.1 Workflow description

Title
Discover hidden website API endpoints using regex and AI
Workflow name
Discover hidden website API endpoints using regex and AI

💡 What it is for

This workflow helps to automatically discover undocumented API endpoints by analysing JavaScript files from the website's HTML code.

When building automation for platforms without public APIs, we face a significant technical barrier. In a perfect world, every service would offer well-documented APIs with clear endpoints and authentication methods. But the reality is different.

Before we resort to complex web scraping, let's analyse the architecture of the platform and check whether it makes internal API calls. We will examine JavaScript files embedded in the HTML source code to find and extract potential API endpoints.

⚙️Key Features

To discover hidden API endpoints, we can apply two major approaches:

1. Predefined regex extraction: manually insert a fixed regex with the necessary conditions to extract endpoints. Unlike LLM, which creates a custom regex for each JS file, we provide a generic expression to capture all URL strings. We do not want to accidentally miss important API endpoints.

2. AI-supported extraction:

  • ask LLMs to examine the structure of the JavaScript code. The 1st model will:
  • capture potential API endpoints
  • create a detailed description of each identified endpoint with methods and query parameters
  • the 2nd LLM connected to the AI Agent will generate a regex for each JS file individually based on the output of the 1st model.

In addition to pure endpoint extraction, we supplement our analysis with:

  • AI regex validation: the AI Agent calls a validation tool to iteratively improve its regex based on the reference data.

  • Results comparison: side-by-side analysis of API endpoints extracted with a predefined regex against AI-supported results.

✅Requirements:

  • OpenRouter API access: for AI-powered analysis (Gemini + Claude models by default)
  • Minimal setup: simply configure the target URL and run
  • Platforms: JS files must be accessible and have embedded standard API endpoints patterns (/api/, /v1/, etc.)

💪Use Cases

📚 API documentation: create complete endpoint descriptions for internal APIs 🚀 Automation & integration projects: find the APIs you need when official documentation is missing 🛠 Web scraping projects: discover data access patterns 🔍 Security research: map attack surfaces and explore unprotected endpoints

🎉Extracted the endpoints, what now?

To execute API requests, we often need additional information such as query parameters or JSON body data:

  • One way to find out exactly how the request is being made on the platform is to navigate to the Network tab in the Dev Tools console while interacting with the platform. Look for anything that resembles API requests and review the request/response headers, payload and query parameters.
  • Alternatively, you can also check the JS file and the page source code for the required values.

✨Inspiration

As a guitarist who also builds workflows, I wanted to automate communication with the booking platform I use in my music project. While trying to connect to the platform from n8n, I ran into a challenge: no public APIs.

Fortunately, I found out that the platform I work with was built as a modern web app with client-side JavaScript that contained information about the API structure. This led me to the topic of hidden API endpoints and eventually to this workflow.

It is part of my music booking project which I presented at the n8n Community Meetup in Berlin on 22 May 2025.

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Sticky Note3

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 2 - Sticky Note4

Type / Role
n8n-nodes-base.stickyNote - stickyNote
Config choices
Version 1

Block 3 - Auto-fixing Output Parser

Type / Role
@n8n/n8n-nodes-langchain.outputParserAutofixing - outputParserAutofixing
Config choices
Version 1

Block 4 - Start API Discovery

Type / Role
n8n-nodes-base.manualTrigger - manualTrigger
Config choices
Version 1

Block 5 - Configuration

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 6 - Fetch Website HTML

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 7 - Extract URLs of JS files

Type / Role
n8n-nodes-base.html - html
Config choices
Version 1.2

Block 8 - Split URLs of JS files

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 9 - Keep Relevant JS Files

Type / Role
n8n-nodes-base.filter - filter
Config choices
Version 2.2

Block 10 - Fetch JS Content

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 11 - Extract API Endpoints

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 12 - Check Endpoints Count

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

Block 13 - Split Endpoints

Type / Role
n8n-nodes-base.splitOut - splitOut
Config choices
Version 1

Block 14 - Remove Duplicates

Type / Role
n8n-nodes-base.removeDuplicates - removeDuplicates
Config choices
Version 2

Block 15 - AI Endpoints Analysis

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 16 - Add Source Metadata

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 17 - Reference for Source Metadata

Type / Role
n8n-nodes-base.noOp - noOp
Config choices
Version 1

Block 18 - Process Each Analyzed File

Type / Role
n8n-nodes-base.splitInBatches - splitInBatches
Config choices
Version 3

Block 19 - Format AI Results

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 20 - Prepare Endpoints File(s)

Type / Role
n8n-nodes-base.convertToFile - convertToFile
Config choices
Version 1.1

Block 21 - Save Endpoints File(s)

Type / Role
n8n-nodes-base.readWriteFile - readWriteFile
Config choices
Version 1

Block 22 - Pass File Name, No Binary

Type / Role
n8n-nodes-base.set - set
Config choices
Version 3.4

Block 23 - Merge AI Analysis & File Name

Type / Role
n8n-nodes-base.merge - merge
Config choices
Version 3.1

Block 24 - Create Endpoints Regex With AI

Type / Role
@n8n/n8n-nodes-langchain.agent - agent
Config choices
Version 1.9

Showing the first 24 of 58 workflow blocks. Download the JSON for the full node graph.

3. Summary Table

Workflow Discover hidden website API endpoints using regex and AI
Complexity advanced
Nodes 58
Categories Engineering, AI Summarization
Author Yulia
Published 03 Jun 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4627/4627.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Discover hidden website API endpoints using regex and AI do?

What it is for This workflow helps to automatically discover undocumented API endpoints by analysing JavaScript files from the website's HTML code. When building automation for platforms without...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your Engineering, AI Summarization use case.