# Perplexity Search Scraper (`easyapi/perplexity-search-scraper`) Actor

Scrape Perplexity AI answers with cited sources, citation URLs, and optional related questions — no Perplexity key required in web mode.

- **URL**: https://apify.com/easyapi/perplexity-search-scraper.md
- **Developed by:** [EasyApi](https://apify.com/easyapi) (community)
- **Categories:** Agents
- **Stats:** 4 total users, 3 monthly users, 18.2% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.99 / 1,000 results

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/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

## Perplexity Search Scraper

Extract Perplexity AI search answers at scale. Get the generated answer text, cited sources (title / URL / snippet / dates), ordered citation URLs, and optionally related questions and images.

Each successful query becomes one dataset record with fields such as `query`, `text`, `sources`, `citationUrls`, `relatedQuestions`, and `images`.

### Modes

| Mode | How it works | Auth |
|------|----------------|------|
| `web` (default) | Real Chrome (`puppeteer-real-browser`) + Perplexity public SSE ask | No key. Optional `cookies` if anonymous hits a signup wall. |
| `api` | Official Perplexity Sonar Chat Completions API | Requires `apiKey` |

> Note: Perplexity increasingly shows **“Sign up and repeat your request”** for anonymous traffic. For reliable web-mode runs, pass logged-in `cookies` and/or a residential proxy. Or switch to `mode: "api"`.

Failed queries are written to a separate **`errors`** dataset so the main dataset stays clean.

### Input

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| queries | string | Yes | One query per line |
| mode | string | No | `web` or `api` (default `web`) |
| apiKey | string | For api | Perplexity API key |
| cookies | string | No | Cookie header from logged-in perplexity.ai |
| perplexitySearch.searchRecency | string | No | `day` / `week` / `month` / `year` |
| perplexitySearch.returnImages | boolean | No | Include images |
| perplexitySearch.returnRelatedQuestions | boolean | No | Include follow-ups |
| proxyConfiguration | object | No | Proxy settings |

#### Input example

```json
{
    "queries": "What are the top 5 CRM tools",
    "mode": "web",
    "perplexitySearch": {
        "returnImages": false,
        "returnRelatedQuestions": true
    }
}
```

#### API mode example

```json
{
    "queries": "best SEO tools\napify web scraping",
    "mode": "api",
    "apiKey": "pplx-xxxxx",
    "perplexitySearch": {
        "returnRelatedQuestions": true
    }
}
```

### Output

One dataset item per successful query:

```json
{
    "query": "what is python",
    "text": "**Python** is a high-level...",
    "sources": [
        {
            "title": "Python Programming Language...",
            "url": "https://www.python.org/",
            "snippet": "...",
            "date": "2025-08-12",
            "lastUpdated": null,
            "source": "web"
        }
    ],
    "citationUrls": ["https://www.python.org/"],
    "relatedQuestions": [],
    "images": [],
    "threadUrl": "https://www.perplexity.ai/search/...",
    "scrapedAt": "2026-10-22T01:00:00.000Z"
}
```

#### Errors dataset

```json
{
    "query": "best web scraping tools 2025",
    "error": "Perplexity requires sign-in for this request (anonymous signup wall). ..."
}
```

### Use cases

- GEO / AEO brand citation monitoring
- Competitive AI-answer comparison
- Content research (which sources Perplexity cites)
- Bulk query collection for dashboards

# Actor input Schema

## `queries` (type: `string`):

Queries to send to Perplexity AI. Enter one query per line.

## `mode` (type: `string`):

web = scrape perplexity.ai in a real browser (default). api = use official Perplexity Sonar API (requires apiKey).

## `apiKey` (type: `string`):

Required when mode is api. Official Perplexity API key (Sonar).

## `cookies` (type: `string`):

Optional cookie header from a logged-in perplexity.ai session. Helps bypass anonymous signup walls in web mode.

## `countryCode` (type: `string`):

Preferred country code for proxy / locale (informational; use proxyConfiguration for geo).

## `perplexitySearch` (type: `object`):

Options that control how Perplexity answers your queries.

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

Optional proxy. Residential / US proxies improve web-mode success against Cloudflare and signup walls.

## Actor input object example

```json
{
  "queries": "what is python\nbest SEO tools",
  "mode": "web",
  "countryCode": "us",
  "perplexitySearch": {
    "returnImages": false,
    "returnRelatedQuestions": false
  },
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

Successful Perplexity answers in the default dataset.

## `errors` (type: `string`):

Queries that returned no Perplexity result, with the failure reason.

# 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 = {
    "queries": `what is python
best SEO tools`,
    "mode": "web",
    "countryCode": "us"
};

// Run the Actor and wait for it to finish
const run = await client.actor("easyapi/perplexity-search-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 = {
    "queries": """what is python
best SEO tools""",
    "mode": "web",
    "countryCode": "us",
}

# Run the Actor and wait for it to finish
run = client.actor("easyapi/perplexity-search-scraper").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 '{
  "queries": "what is python\\nbest SEO tools",
  "mode": "web",
  "countryCode": "us"
}' |
apify call easyapi/perplexity-search-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,easyapi/perplexity-search-scraper"
        }
    }
}
```

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/W3Hk7eWbFwQmgij9o/builds/ygLlBaaUrAn5z01iG/openapi.json
