# B2B Agency Scraper - Marketing, Design & Dev Agency Leads (`scrapesage/b2b-agency-scraper`) Actor

Scrape B2B agencies from Sortlist & DesignRush: name, services, ratings, pricing, team size, location, socials & website contact emails. Marketing, SEO, design, web, app & software agencies — the clean Clutch alternative. Filter by category, score leads & monitor new agencies.

- **URL**: https://apify.com/scrapesage/b2b-agency-scraper.md
- **Developed by:** [Scrape Sage](https://apify.com/scrapesage) (community)
- **Categories:** Lead generation, Automation, SEO tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $8.00 / 1,000 agency lead scrapeds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## B2B Agency Scraper — Marketing, Design & Dev Agency Leads (Ratings, Pricing, Emails)

Extract **complete B2B agency data** from two of the cleanest agency directories on the web — **Sortlist** and **DesignRush** — in one run. Get agency name, full service list, star ratings & review counts, pricing (hourly rate, minimum budget, budget range), team size, founding year, location, social profiles, and each agency's **own website**. Optionally turn every agency into a **ready-to-contact B2B lead** by crawling its website for **contact emails, phone numbers and socials**.

No login, no API key, no browser — fast JSON/SSR extraction with a clean, consistent data path.

### Why this agency scraper?

The biggest agency directory, **Clutch.co, is locked behind a Cloudflare challenge** — so every Clutch scraper runs on flaky residential proxies or paid solvers. This actor goes after the **clean, no-browser sources** instead and ships the **richest agency dataset in the category**, deduplicated across both directories:

| Data | Typical scrapers | This actor |
|---|---|---|
| Agency name, profile, rating, reviews | ✅ | ✅ |
| Full service list (SEO, PPC, branding…) | partial | ✅ |
| Hourly rate / min budget / budget range | partial | ✅ |
| Team size & founding year | ❌ | ✅ |
| Location (city, region, country, address) | partial | ✅ |
| Agency's **own website** | ❌ | ✅ |
| Agency **contact emails & phones** | ❌ | ✅ opt-in |
| LinkedIn / Facebook / Instagram / X / YouTube | ❌ | ✅ |
| Multiple directories, deduplicated | ❌ single source | ✅ Sortlist + DesignRush |
| Lead score (0–100) per agency | ❌ | ✅ |
| Monitor mode — only NEW agencies | ❌ | ✅ |

### Use cases

- **Lead generation** — agencies are active B2B buyers: they need software (martech, project management, reporting, AI), white-label and outsourcing partners, recruiters, and lead vendors. Score them by `leadScore`, filter by service, rating or budget, and reach them via `email` / `linkedin`.
- **Partner & vendor sourcing** — find marketing, design, web, app, software or AI agencies by category and budget for outsourcing, referrals or reseller programs.
- **Competitive & market intelligence** — map who serves which service category, at what pricing tier and team size, in which markets.
- **Recruiting** — build target lists of agencies hiring for specific disciplines.
- **CRM enrichment** — append website, socials, pricing and team size to an existing agency list via the profile/website data.

### How to use

1. [Sign up for Apify](https://console.apify.com/sign-up) — the free plan is enough to try this actor.
2. Open the **B2B Agency Scraper**, choose service categories (and optionally directories, locations or URLs), and click **Start**.
3. Watch agency leads stream into the dataset table.
4. **Export** as JSON, CSV, Excel, XML or RSS — or pull results via the [Apify API](https://docs.apify.com/api/v2).

### Input

```json
{
    "serviceCategories": ["digital-marketing", "seo"],
    "sources": ["sortlist", "designrush"],
    "locations": ["us"],
    "maxResults": 200,
    "maxPagesPerSource": 3,
    "includeProfileDetails": true,
    "enrichContactEmails": true,
    "minRating": 4,
    "deduplicateAgencies": true,
    "monitorMode": false
}
````

- **serviceCategories** — friendly keys (`digital-marketing`, `seo`, `ppc`, `social-media-marketing`, `content-marketing`, `email-marketing`, `public-relations`, `advertising`, `branding`, `web-design`, `web-development`, `ecommerce`, `software-development`, `mobile-app-development`, `ui-ux-design`, `video-production`, `graphic-design`, `it-services`, `ai`, `cybersecurity`) or any raw Sortlist/DesignRush category slug.
- **sources** *(default both)* — `sortlist`, `designrush`.
- **locations** *(DesignRush only)* — geo suffixes such as `us`, `us-new-york`, `united-kingdom`. Sortlist listings are global per category; use `startUrls` for a specific Sortlist geo page.
- **startUrls** — paste any Sortlist/DesignRush listing or agency-profile URL.
- **maxResults / maxPagesPerSource** — caps. Each Sortlist page ≈ 20–23 agencies; DesignRush ≈ 50. Sortlist supports deep pagination (up to ~45 pages).
- **includeProfileDetails** *(default true)* — fetch each agency's profile page for its own website (the email wedge), team size, full address and extra socials.
- **enrichContactEmails** *(default false)* — crawl the agency's website (home + contact/about) for public emails, phones and socials. Directories don't publish agency emails — this is the only way to get them.
- **includeReviews / maxReviewsPerAgency** — emit client review records.
- **minRating / minReviews / withWebsiteOnly / withEmailOnly** — quality filters.
- **deduplicateAgencies** *(default true)* — collapse the same agency across sources/pages by website domain or name.
- **monitorMode** — emit only agencies not seen in previous runs (see below).

### Output

One record per agency (`type: "agency"`), plus optional client review records (`type: "review"`):

```json
{
    "type": "agency",
    "source": "sortlist",
    "agencyName": "Ninja Promo",
    "profileUrl": "https://www.sortlist.com/agency/ninjapromo-creative-digital-marketing-agency",
    "website": "https://ninjapromo.io",
    "websiteDomain": "ninjapromo.io",
    "tagline": "#1 Subscription-Based Digital Marketing Company",
    "description": "Ninja Promo is a full-service digital marketing company…",
    "rating": 5,
    "reviewCount": 50,
    "hourlyRate": "$50/hr",
    "minBudget": "$1,000+",
    "priceRange": "€1000 - €1000000",
    "teamSize": "50 - 99",
    "foundedYear": 2017,
    "services": ["Social Media", "SEO", "Branding & Positioning", "Email Marketing", "Online Advertising"],
    "areaServed": ["New York, NY, USA", "United Arab Emirates", "Stockholm, Sweden"],
    "category": "digital-marketing",
    "city": "Dubai",
    "country": "AE",
    "email": "hello@ninjapromo.io",
    "emails": ["hello@ninjapromo.io", "sales@ninjapromo.io"],
    "phone": "+1 212 555 0134",
    "linkedin": "https://www.linkedin.com/company/ninjapromo/",
    "instagram": "https://www.instagram.com/ninja.promo/",
    "twitter": "https://twitter.com/ninjapromoio",
    "youtube": "https://www.youtube.com/channel/UCZ7h2iqYhXzhnqGPBmH844A",
    "logo": "https://sortlist-core-api.s3.eu-west-1.amazonaws.com/26y394x",
    "leadScore": 92,
    "searchCategory": "digital-marketing",
    "scrapedAt": "2026-06-15T12:00:00.000Z"
}
```

Fields are `null` only when the data genuinely doesn't exist (e.g. an agency that doesn't publish a budget), never because the scraper skipped them.

### Monitor only new agencies

Turn on **monitorMode** and the actor remembers every agency it has returned (in a named key-value store) and emits only **new** ones on the next run. Combine it with [Schedules](https://docs.apify.com/platform/schedules) for a daily feed of newly listed agencies in your categories — perfect for a fresh lead pipeline. Monitor mode is fully compatible with the Apify scheduler: the schedule triggers the run, monitor mode deduplicates records across runs.

### Automate & schedule

Run this actor on autopilot and pull results into your own stack:

- **[Apify API](https://docs.apify.com/api/v2)** — start runs, fetch datasets and manage schedules over REST.
- **[apify-client for JavaScript](https://docs.apify.com/api/client/js/)** and **[apify-client for Python](https://docs.apify.com/api/client/python/)** — official SDKs.
- **[Schedules](https://docs.apify.com/platform/schedules)** — run it hourly/daily/weekly to monitor new agencies per category or location.
- **[Webhooks](https://docs.apify.com/platform/integrations/webhooks)** — trigger downstream actions (CRM import, Slack alert, email sequence) the moment a run finishes.

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

const client = new ApifyClient({ token: 'MY_APIFY_TOKEN' });

const run = await client.actor('scrapesage/b2b-agency-scraper').call({
    serviceCategories: ['seo', 'ppc'],
    sources: ['sortlist', 'designrush'],
    enrichContactEmails: true,
    maxResults: 200,
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(`Got ${items.length} agency leads`);
```

### Integrate with any app

Connect the dataset to 5,000+ apps — no code required:

- **[Make](https://docs.apify.com/platform/integrations/make)** — multi-step automation scenarios.
- **[Zapier](https://docs.apify.com/platform/integrations/zapier)** — push new agency leads straight into your CRM.
- **[Slack](https://docs.apify.com/platform/integrations/slack)** — get notified when a monitored search finds new agencies.
- **[Google Drive / Sheets](https://docs.apify.com/platform/integrations/drive)** — auto-export every run to a spreadsheet.
- **[Airbyte](https://docs.apify.com/platform/integrations/airbyte)** — pipe results into your data warehouse.
- **[GitHub](https://docs.apify.com/platform/integrations/github)** — trigger runs from commits or releases.

### Use with AI assistants (MCP)

The output is clean, LLM-ready JSON. Call this actor from Claude, ChatGPT or any agent framework through the **[Apify MCP server](https://docs.apify.com/platform/integrations/mcp)** — ask your assistant to "find top-rated SEO agencies in the US and list their contact emails" and let it run this scraper for you.

### More scrapers from scrapesage

Build a complete B2B lead-gen and competitive-intelligence stack:

- **[Houzz Scraper](https://apify.com/scrapesage/houzz-scraper)** — home-improvement pros, contacts & reviews.
- **[Bark Listing Scraper](https://apify.com/scrapesage/bark-listing-scraper)** — service-provider leads from Bark.
- **[FindLaw Scraper](https://apify.com/scrapesage/findlaw-scraper)** — lawyers, law firms & leads.
- **[TaxBuzz Scraper](https://apify.com/scrapesage/taxbuzz-scraper)** — CPAs, accountants & tax-preparer leads.
- **[Product Hunt Scraper](https://apify.com/scrapesage/product-hunt-scraper)** — launches, makers & startup leads.
- **[Y Combinator Scraper](https://apify.com/scrapesage/ycombinator-scraper)** — startups, founders & jobs.
- **[LinkedIn Ad Library Scraper](https://apify.com/scrapesage/linkedin-ad-library-scraper)** — competitor B2B ads & creatives.
- **[Facebook Ad Library Scraper](https://apify.com/scrapesage/facebook-ad-library-scraper)** — competitor ad intelligence.
- **[Google Ads Transparency Scraper](https://apify.com/scrapesage/google-ads-transparency-scraper)** — who's advertising what on Google.
- **[LinkedIn Jobs Scraper](https://apify.com/scrapesage/linkedin-jobs-scraper)** — job postings as hiring-intent signals.

### Tips

- **Breadth**: add more `serviceCategories` and turn up `maxPagesPerSource` (Sortlist supports up to ~45 pages per category). Each category × source is paginated independently.
- **Emails**: keep `includeProfileDetails` on (to resolve each agency's website) and turn on `enrichContactEmails` to crawl it for contacts.
- **Cost control**: profile and website-enrichment calls only fire for agencies that pass your filters; `deduplicateAgencies` prevents paying twice for the same agency across sources.
- **Recurring monitoring**: combine [Schedules](https://docs.apify.com/platform/schedules) with `monitorMode` to track only newly listed agencies.

### FAQ

**Which directories does it scrape?** Sortlist and DesignRush — both clean, no-browser SSR sources. Clutch.co is intentionally not used because it's behind a Cloudflare challenge that requires paid solvers and produces unreliable results.

**Where do the emails come from?** Never from the directory. With `enrichContactEmails` on, the actor visits the agency's own public website and extracts publicly listed contact emails — the same thing a human visitor would see.

**Can I scrape a specific city or country?** For DesignRush, add geo suffixes to `locations` (e.g. `us`, `us-new-york`). For Sortlist, paste a geo-specific listing URL into `startUrls`.

**Can I export to Google Sheets, CSV or Excel?** Yes — one click in the dataset view, or automatically on every run via the [Google Drive integration](https://docs.apify.com/platform/integrations/drive).

**How do I get only new agencies over time?** Turn on `monitorMode` and schedule the actor — it emits only agencies it hasn't returned before.

**Is scraping these directories legal?** This actor collects publicly available data only. You are responsible for using the data in compliance with applicable laws (GDPR/CCPA for personal data) and each site's terms.

### Need help?

Open an issue on the actor's **Issues** tab, or visit the [Apify help center](https://help.apify.com/). Feature requests are welcome — this actor is actively maintained.

# Actor input Schema

## `serviceCategories` (type: `array`):

Agency service categories to scrape, combined with every source. Use a friendly key (digital-marketing, seo, ppc, social-media-marketing, content-marketing, email-marketing, public-relations, advertising, branding, web-design, web-development, ecommerce, software-development, mobile-app-development, ui-ux-design, video-production, graphic-design, it-services, ai, cybersecurity) or paste any raw Sortlist/DesignRush category slug. Unknown slugs are tried as-is and skipped if the source has no such category.

## `sources` (type: `array`):

Which B2B agency directories to scrape. Both are clean, no-browser SSR sources; together they give the widest, deduplicated coverage.

## `locations` (type: `array`):

Optional geo filter applied to DesignRush listings as a URL suffix, e.g. "us", "us-new-york", "united-kingdom". Sortlist listings are global per category (use startUrls for a specific Sortlist geo page).

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

Paste any Sortlist or DesignRush listing or agency-profile URL. Profile URLs are scraped directly; listing URLs are paginated.

## `maxResults` (type: `integer`):

Total agency records to emit across all categories, sources and pages.

## `maxPagesPerSource` (type: `integer`):

How many listing pages to walk per source per category (each Sortlist page ≈ 20-23 agencies; DesignRush ≈ 50). Sortlist supports deep pagination (up to ~45 pages).

## `includeProfileDetails` (type: `boolean`):

Fetch each agency's profile page to capture the agency's own website (the email wedge), team size, full address and extra socials. Turn off for a faster, listing-only run.

## `includeReviews` (type: `boolean`):

Emit one extra record per client review (rating, author, date, body) found on the agency profile page.

## `maxReviewsPerAgency` (type: `integer`):

Cap reviews emitted per agency when 'Include client reviews' is on.

## `enrichContactEmails` (type: `boolean`):

For each agency with a website, crawl its home + contact/about pages for public contact emails, phone numbers and extra social links — the B2B lead wedge. Directories don't publish agency emails; this is the only way to get them.

## `minRating` (type: `integer`):

Only keep agencies with at least this star rating (0-5). 0 = no filter.

## `minReviews` (type: `integer`):

Only keep agencies with at least this many client reviews. 0 = no filter.

## `withWebsiteOnly` (type: `boolean`):

Drop agencies whose own website couldn't be resolved (requires profile details).

## `withEmailOnly` (type: `boolean`):

Drop agencies with no contact email (requires 'Enrich contact emails').

## `deduplicateAgencies` (type: `boolean`):

Collapse the same agency appearing on multiple sources / pages into one record (by website domain or name).

## `monitorMode` (type: `boolean`):

Remember agencies returned in previous runs (in a named key-value store) and emit only NEW ones on each run. Pair with Apify Schedules for a daily fresh-agency feed — it does not conflict with the scheduler.

## `monitorStoreName` (type: `string`):

Named key-value store used by monitor mode. Use distinct names to track different searches independently.

## `maxConcurrency` (type: `integer`):

Parallel requests. Lower it if you hit rate limits.

## `proxyConfiguration` (type: `object`):

Proxy settings. Defaults to Apify US datacenter proxies, which both sources serve cleanly.

## Actor input object example

```json
{
  "serviceCategories": [
    "digital-marketing"
  ],
  "sources": [
    "sortlist",
    "designrush"
  ],
  "locations": [],
  "startUrls": [],
  "maxResults": 100,
  "maxPagesPerSource": 3,
  "includeProfileDetails": true,
  "includeReviews": false,
  "maxReviewsPerAgency": 10,
  "enrichContactEmails": false,
  "minRating": 0,
  "minReviews": 0,
  "withWebsiteOnly": false,
  "withEmailOnly": false,
  "deduplicateAgencies": true,
  "monitorMode": false,
  "monitorStoreName": "b2b-agency-monitor",
  "maxConcurrency": 5,
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}
```

# Actor output Schema

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

All scraped agency lead records and optional review records as JSON items in the default dataset.

# 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 = {
    "serviceCategories": [
        "digital-marketing"
    ],
    "sources": [
        "sortlist",
        "designrush"
    ],
    "locations": [],
    "startUrls": [],
    "maxResults": 100,
    "maxPagesPerSource": 3,
    "maxReviewsPerAgency": 10,
    "minRating": 0,
    "minReviews": 0,
    "maxConcurrency": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("scrapesage/b2b-agency-scraper").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 = {
    "serviceCategories": ["digital-marketing"],
    "sources": [
        "sortlist",
        "designrush",
    ],
    "locations": [],
    "startUrls": [],
    "maxResults": 100,
    "maxPagesPerSource": 3,
    "maxReviewsPerAgency": 10,
    "minRating": 0,
    "minReviews": 0,
    "maxConcurrency": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("scrapesage/b2b-agency-scraper").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "serviceCategories": [
    "digital-marketing"
  ],
  "sources": [
    "sortlist",
    "designrush"
  ],
  "locations": [],
  "startUrls": [],
  "maxResults": 100,
  "maxPagesPerSource": 3,
  "maxReviewsPerAgency": 10,
  "minRating": 0,
  "minReviews": 0,
  "maxConcurrency": 5
}' |
apify call scrapesage/b2b-agency-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=scrapesage/b2b-agency-scraper",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "B2B Agency Scraper - Marketing, Design & Dev Agency Leads",
        "description": "Scrape B2B agencies from Sortlist & DesignRush: name, services, ratings, pricing, team size, location, socials & website contact emails. Marketing, SEO, design, web, app & software agencies — the clean Clutch alternative. Filter by category, score leads & monitor new agencies.",
        "version": "0.1",
        "x-build-id": "tuIZGJPAhnKuoTzck"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/scrapesage~b2b-agency-scraper/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-scrapesage-b2b-agency-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/scrapesage~b2b-agency-scraper/runs": {
            "post": {
                "operationId": "runs-sync-scrapesage-b2b-agency-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/scrapesage~b2b-agency-scraper/run-sync": {
            "post": {
                "operationId": "run-sync-scrapesage-b2b-agency-scraper",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "serviceCategories"
                ],
                "properties": {
                    "serviceCategories": {
                        "title": "Service categories",
                        "type": "array",
                        "description": "Agency service categories to scrape, combined with every source. Use a friendly key (digital-marketing, seo, ppc, social-media-marketing, content-marketing, email-marketing, public-relations, advertising, branding, web-design, web-development, ecommerce, software-development, mobile-app-development, ui-ux-design, video-production, graphic-design, it-services, ai, cybersecurity) or paste any raw Sortlist/DesignRush category slug. Unknown slugs are tried as-is and skipped if the source has no such category.",
                        "default": [
                            "digital-marketing"
                        ],
                        "items": {
                            "type": "string"
                        }
                    },
                    "sources": {
                        "title": "Directories",
                        "type": "array",
                        "description": "Which B2B agency directories to scrape. Both are clean, no-browser SSR sources; together they give the widest, deduplicated coverage.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "sortlist",
                                "designrush"
                            ],
                            "enumTitles": [
                                "Sortlist",
                                "DesignRush"
                            ]
                        },
                        "default": [
                            "sortlist",
                            "designrush"
                        ]
                    },
                    "locations": {
                        "title": "Locations (DesignRush only)",
                        "type": "array",
                        "description": "Optional geo filter applied to DesignRush listings as a URL suffix, e.g. \"us\", \"us-new-york\", \"united-kingdom\". Sortlist listings are global per category (use startUrls for a specific Sortlist geo page).",
                        "items": {
                            "type": "string"
                        }
                    },
                    "startUrls": {
                        "title": "Start URLs",
                        "type": "array",
                        "description": "Paste any Sortlist or DesignRush listing or agency-profile URL. Profile URLs are scraped directly; listing URLs are paginated.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "maxResults": {
                        "title": "Max agencies",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Total agency records to emit across all categories, sources and pages.",
                        "default": 100
                    },
                    "maxPagesPerSource": {
                        "title": "Max listing pages per source/category",
                        "minimum": 1,
                        "maximum": 45,
                        "type": "integer",
                        "description": "How many listing pages to walk per source per category (each Sortlist page ≈ 20-23 agencies; DesignRush ≈ 50). Sortlist supports deep pagination (up to ~45 pages).",
                        "default": 3
                    },
                    "includeProfileDetails": {
                        "title": "Include profile details (agency website + richer fields)",
                        "type": "boolean",
                        "description": "Fetch each agency's profile page to capture the agency's own website (the email wedge), team size, full address and extra socials. Turn off for a faster, listing-only run.",
                        "default": true
                    },
                    "includeReviews": {
                        "title": "Include client reviews",
                        "type": "boolean",
                        "description": "Emit one extra record per client review (rating, author, date, body) found on the agency profile page.",
                        "default": false
                    },
                    "maxReviewsPerAgency": {
                        "title": "Max reviews per agency",
                        "minimum": 1,
                        "type": "integer",
                        "description": "Cap reviews emitted per agency when 'Include client reviews' is on.",
                        "default": 10
                    },
                    "enrichContactEmails": {
                        "title": "Enrich contact emails (crawl agency website)",
                        "type": "boolean",
                        "description": "For each agency with a website, crawl its home + contact/about pages for public contact emails, phone numbers and extra social links — the B2B lead wedge. Directories don't publish agency emails; this is the only way to get them.",
                        "default": false
                    },
                    "minRating": {
                        "title": "Minimum rating",
                        "minimum": 0,
                        "maximum": 5,
                        "type": "integer",
                        "description": "Only keep agencies with at least this star rating (0-5). 0 = no filter.",
                        "default": 0
                    },
                    "minReviews": {
                        "title": "Minimum review count",
                        "minimum": 0,
                        "type": "integer",
                        "description": "Only keep agencies with at least this many client reviews. 0 = no filter.",
                        "default": 0
                    },
                    "withWebsiteOnly": {
                        "title": "Only agencies with a website",
                        "type": "boolean",
                        "description": "Drop agencies whose own website couldn't be resolved (requires profile details).",
                        "default": false
                    },
                    "withEmailOnly": {
                        "title": "Only agencies with an email",
                        "type": "boolean",
                        "description": "Drop agencies with no contact email (requires 'Enrich contact emails').",
                        "default": false
                    },
                    "deduplicateAgencies": {
                        "title": "Deduplicate agencies",
                        "type": "boolean",
                        "description": "Collapse the same agency appearing on multiple sources / pages into one record (by website domain or name).",
                        "default": true
                    },
                    "monitorMode": {
                        "title": "Monitor mode (only new agencies)",
                        "type": "boolean",
                        "description": "Remember agencies returned in previous runs (in a named key-value store) and emit only NEW ones on each run. Pair with Apify Schedules for a daily fresh-agency feed — it does not conflict with the scheduler.",
                        "default": false
                    },
                    "monitorStoreName": {
                        "title": "Monitor store name",
                        "type": "string",
                        "description": "Named key-value store used by monitor mode. Use distinct names to track different searches independently.",
                        "default": "b2b-agency-monitor"
                    },
                    "maxConcurrency": {
                        "title": "Max concurrency",
                        "minimum": 1,
                        "maximum": 12,
                        "type": "integer",
                        "description": "Parallel requests. Lower it if you hit rate limits.",
                        "default": 5
                    },
                    "proxyConfiguration": {
                        "title": "Proxy configuration",
                        "type": "object",
                        "description": "Proxy settings. Defaults to Apify US datacenter proxies, which both sources serve cleanly.",
                        "default": {
                            "useApifyProxy": true
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
