# API Endpoint Crawler: Find APIs in Site JavaScript (`mjohnson7cd/api-endpoint-crawler`) Actor

Crawl a site you control and extract the API endpoints its pages and scripts call: REST paths, versioned routes, GraphQL and .json files. Stays on the target host, never fetches third-party CDNs. Export CSV, Excel, JSON or API. Beta: feedback welcome.

- **URL**: https://apify.com/mjohnson7cd/api-endpoint-crawler.md
- **Developed by:** [Mara Johnson](https://apify.com/mjohnson7cd) (community)
- **Categories:** Developer tools, Automation, SEO tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 75.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.50 / 1,000 page crawleds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

This **API endpoint crawler** crawls a website you control and extracts the API routes its
JavaScript calls: REST paths (`/api/users`, `/v1/orders`), versioned routes, GraphQL, and
`.json` files. It stays on your target host, never fetches third-party CDNs or tag managers,
and delivers one row per page crawled plus one per unique API path found. Export to CSV,
Excel, JSON or the Apify API.

Use it for API discovery on your own sites before writing docs, security audits on apps you
are authorised to test, or mapping the endpoints a legacy app depends on before you migrate
or rewrite it.

> **Beta.** The output columns and the charged events are stable and covered by an automated
> regression suite. Input options may still gain fields. Problems and requests go on the
> [Issues tab](https://apify.com/mjohnson7cd/api-endpoint-crawler/issues).

### What does the API endpoint crawler find?

| What | Patterns matched | Where |
|---|---|---|
| REST API paths | `/api/*`, `/rest/*`, `/endpoints/*` | Page HTML inline scripts, external `.js` files on your host |
| Versioned routes | `/v1/*`, `/v2/*`, etc. | Same |
| GraphQL | `/graphql`, `/graphql/*` | Same |
| JSON files | `*.json` anywhere in a path | Same |
| Cross-host API calls | `https://api.stripe.example.net/v1/charges` (reported with the real host, never fetched) | Same |

**How it works:** The crawler starts from your URLs, follows links and `<script src>` tags on
the same host up to a depth you set, fetches each page or script once, and extracts endpoint
patterns from the HTML and JavaScript. It does not run a browser, so endpoints injected by
JavaScript after the page renders are not seen.

### How to crawl a site for API endpoints: step by step

1. Click **Try for free** and sign in to Apify.
2. Paste one or more **Start URLs** - `https://example.com`, or just `example.com`. Up to 20
   per run.
3. Optional: change **Max Crawl Depth** (how many link hops from a start URL, default 3) or
   **Max Pages** (default 100). One typical site with depth 3 easily finds 100 pages from one
   start URL.
4. Optional: switch off **Analyze JavaScript** (skips external `.js` files; inline scripts are
   always parsed) or **Find API Calls** (delivers pages only, no endpoint rows).
5. Click **Start**. Each page becomes a row as soon as it is crawled; API calls found on that
   page follow immediately. Export from the **Storage** tab as CSV, Excel or JSON, or read it
   over the [Apify API](https://docs.apify.com/api/v2).

On the Apify platform you also get [scheduling](https://docs.apify.com/platform/schedules) (re-crawl
your site's API surface weekly), [integrations](https://docs.apify.com/platform/integrations)
(Make, Zapier, Slack, Google Sheets, webhooks) and API access, without writing any of it yourself.

### How much does the API endpoint crawler cost?

Two paid events:

| Event | Price per row | What it charges |
|---|---|---|
| `page-crawled` | $0.01 → $0.0055 | Each page or script on your target host fetched live with HTTP 2xx |
| `api-endpoint-found` | $0.002 → $0.0011 | Each unique API-style path found in a crawled page's scripts (opt-out: set **Find API Calls** off) |

The price depends on your Apify plan:

| Apify plan | page-crawled | api-endpoint-found | 100 pages + 50 endpoints |
|---|---|---|---|
| Free | $0.01 | $0.002 | $1.1 |
| Starter | $0.0085 | $0.0017 | $0.935 |
| Scale | $0.007 | $0.0014 | $0.77 |
| Business and above | $0.0055 | $0.0011 | $0.605 |

Apify adds its standard run-start charge of $0.00005 per run (charged once, because the Actor
runs on at most 2 GB of memory). There is no monthly fee and no compute-unit bill on top.

What is **not** charged:

- Failed pages: a non-200 status, a timeout, a refused or TLS-failed connection, or a blocked
  internal address. They still get a row with `error` saying why.
- Files that are not pages or scripts (images, PDFs, JSON responses), even when fetched and
  returned with HTTP 2xx.
- Duplicates: the same URL crawled twice (e.g. linked from two pages) is fetched and charged once,
  even if the run is restarted.
- API paths reported more than once (found on two different pages).
- Anything after your **max cost per run**: the run works out what your budget pays for before
  each page and its endpoints, and stops cleanly, so the total never goes over your limit.

The Pricing tab always shows the current prices.

### Input example

```json
{
  "startUrls": ["https://example.com"],
  "maxDepth": 3,
  "maxPages": 100,
  "analyzeJs": true,
  "findApiCalls": true
}
```

### Output: one row per page, one per API call

```json
{
  "type": "page",
  "url": "https://example.com/dashboard",
  "status": 200,
  "contentType": "text/html; charset=utf-8",
  "depth": 1,
  "foundAt": "https://example.com/",
  "error": null
}
```

```json
{
  "type": "api_call",
  "url": "https://example.com/api/v1/users",
  "status": null,
  "contentType": null,
  "depth": 2,
  "foundAt": "https://example.com/dashboard",
  "error": null
}
```

- `type` is `"page"` for a fetched page or script, `"api_call"` for an endpoint found in a page's
  scripts (reported with its URL, never fetched).
- `foundAt` is the page or script that linked to this URL (pages) or contained the endpoint
  reference (API calls). `null` for start URLs.
- `depth` is the link distance from a start URL.

The Storage tab has a table view showing type, URL, status, depth and where it was found.

### Limits, stated plainly

- **Same host only.** Page links, redirects and script files are followed only on the same host
  (the `www.` and non-`www.` versions count as different hosts). Third-party CDNs, tag managers
  and external APIs are never fetched, even when a page references them. Cross-host API calls
  found in scripts are reported with their real host, never fetched.
- **No browser.** Endpoints injected by JavaScript after the page renders are not seen. This is
  a static code scan of the initial HTML and scripts, not a dynamic trace.
- **Unreachable pages.** If 10 pages in a row get no answer at all (timeout, refused, TLS or DNS
  failure), the run stops and its status message says the remaining pages were not crawled. An
  HTTP error such as 403 or 500 is an answer and does not count.
- Only public `http(s)` URLs. `localhost`, private and cloud-metadata addresses and other schemes
  are refused, including when a hostname resolves to one or a redirect points into one.
- **Migration-safe billing.** A run that is migrated or restarted mid-crawl resumes from where it
  stopped: visited pages and queued links are persisted, and no page or endpoint is ever
  re-delivered or re-charged.

### FAQ

**Is it legal to crawl a website for its API endpoints?** It sends one ordinary GET request per
page, the same as a browser visit, and reads only what the site returns publicly. Only crawl
sites you own or are authorised to test, and follow each site's terms. You are responsible for
that permission.

**Why is an endpoint I know the app calls missing?** It is probably injected by JavaScript after
the page renders, or called only on a page the crawl did not reach within its depth and page
limits. This Actor does not run a browser.

**Why did a page fail?** The `error` column says: an HTTP status such as `HTTP 403`, a timeout,
a TLS or connection error, or a refused internal address. Failed pages are not charged.

**Can I crawl multiple sites in one run?** Yes, list them all in **Start URLs**. Each is crawled
separately; links from one to another are never followed.

**Something is broken or missing.** Open an issue on the
[Issues tab](https://apify.com/mjohnson7cd/api-endpoint-crawler/issues).

### Ready-made examples

One-click starting points. Each opens with the input filled in, ready to run or edit:

- [Find API endpoints in a website's JavaScript](https://apify.com/mjohnson7cd/api-endpoint-crawler/examples/find-api-endpoints-in-website-javascript)

### Other Actors by the same author

| Actor | What it does |
|---|---|
| [AliExpress Scraper](https://apify.com/mjohnson7cd/aliexpress-scraper) | Products, prices, discounts and units sold from AliExpress search |
| [Walmart Scraper](https://apify.com/mjohnson7cd/walmart-scraper) | Walmart search, product pages, seller offers and reviews in one Actor |
| [Walmart Search Scraper](https://apify.com/mjohnson7cd/walmart-search-scraper) | Walmart products and prices by keyword |
| [Walmart Product Scraper](https://apify.com/mjohnson7cd/walmart-product-scraper) | Walmart price, stock and seller offers by product URL or item ID |
| [Walmart Reviews Scraper](https://apify.com/mjohnson7cd/walmart-reviews-scraper) | Walmart customer reviews by product URL or item ID |
| [EU Company Registry & KYB Lookup](https://apify.com/mjohnson7cd/eu-company-registry-kyb) | Company lookups in the official FR, NO, FI and CZ registries |
| [Tech Stack Fingerprinter](https://apify.com/mjohnson7cd/tech-stack-fingerprinter) | Detects a website's server, CDN, frameworks, CMS, analytics and security headers |
| [Subdomain Finder](https://apify.com/mjohnson7cd/subdomain-finder) | Finds a domain's subdomains from certificate transparency and DNS, probed live |

### Affiliation

Not affiliated with or endorsed by any of the frameworks, services or APIs whose paths it extracts.

# Changelog

This Actor's version history is a separate document: https://apify.com/mjohnson7cd/api-endpoint-crawler/changelog.md

# Actor input Schema

## `startUrls` (type: `array`):

URLs to begin crawling from, up to 20 per run. Only enter sites you own or are authorised to test.

## `maxDepth` (type: `integer`):

Maximum link depth to follow

## `maxPages` (type: `integer`):

Maximum pages to crawl

## `analyzeJs` (type: `boolean`):

Extract endpoints from JavaScript bundles

## `findApiCalls` (type: `boolean`):

Report API-style paths (/api/, /v1/ and other versions, /graphql, /rest/, /endpoint(s)/, .json files) found in page scripts. Each unique path is charged as api-endpoint-found.

## Actor input object example

```json
{
  "startUrls": [
    "https://example.com"
  ],
  "maxDepth": 3,
  "maxPages": 100,
  "analyzeJs": true,
  "findApiCalls": true
}
```

# Actor output Schema

## `results` (type: `string`):

One row per URL fetched on your target host (with its HTTP status) and one row per API-style path found in its scripts (not requested)

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        "https://example.com"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("mjohnson7cd/api-endpoint-crawler").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "startUrls": ["https://example.com"] }

# Run the Actor and wait for it to finish
run = client.actor("mjohnson7cd/api-endpoint-crawler").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    "https://example.com"
  ]
}' |
apify call mjohnson7cd/api-endpoint-crawler --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mjohnson7cd/api-endpoint-crawler"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/fgB0fWmNZeulhUnm5/builds/SqJSp7zyMrCvqro1Q/openapi.json
