DEV Community

Sami
Sami

Posted on

Automating Perplexity AI Searches for Content Research and Brand Monitoring

Perplexity AI has become one of the most popular AI-powered search engines, giving users synthesized answers with cited sources instead of a list of blue links. For marketers, content strategists, and SEO professionals, a new discipline has emerged: Answer Engine Optimization (AEO) — the practice of getting your brand mentioned and cited in AI-generated search results.

The challenge is that monitoring how Perplexity answers queries about your brand, competitors, or industry requires manually searching one query at a time. If you want to track visibility across dozens or hundreds of queries on a regular schedule, you need automation.

This article walks through how to automate Perplexity AI searches at scale using the zhorex/perplexity-ai-scraper Actor on Apify — no Perplexity API key required.


TL;DR

  • What: Extract AI-generated answers, cited sources, and related questions from Perplexity AI
  • How: zhorex/perplexity-ai-scraper on Apify
  • Cost: $0.02 per query ($20 per 1,000 queries)
  • No API key: Scrapes the public web interface directly via headless browser
  • Two modes: Full search results, or brand mention monitoring

Why Automate Perplexity Searches?

Answer Engine Optimization (AEO)

As more users shift from Google to AI search engines like Perplexity, ChatGPT, and Google AI Overviews, monitoring your visibility in AI-generated answers is becoming critical. AEO focuses on:

  • Is your brand mentioned when users ask about your product category?
  • What position does your brand appear in the AI answer?
  • Which competitors are mentioned alongside you?
  • What sources does Perplexity cite — and is your content among them?

Content Strategy

Perplexity curates answers from multiple sources and cites them. By analyzing which URLs get cited for your target keywords, you can identify content gaps: if your competitors are cited but you are not, that signals where to invest in content.

Competitive Intelligence

Track how Perplexity positions your competitors for your target keywords. Which brands does it recommend? How does it describe them? This gives you a direct view into how AI search engines perceive your market.


Two Modes of Operation

Mode 1: Search — Extract Full AI Answers

Submit any query and get the full AI-generated answer with all cited sources.

Input:

{
  "mode": "search",
  "queries": [
    "best CRM software for small business 2026",
    "top project management tools for startups"
  ]
}
Enter fullscreen mode Exit fullscreen mode

Output:

{
  "query": "best CRM software for small business 2026",
  "answer": "For 2026, the best CRM overall is...",
  "sources": [
    {
      "position": 1,
      "title": "The Best CRM Software for 2026",
      "url": "https://www.pcmag.com/picks/the-best-crm-software",
      "domain": "pcmag.com",
      "snippet": "Customers are vital to any business..."
    }
  ],
  "relatedQuestions": [
    "Zoho CRM vs Salesforce which is better for small businesses",
    "Best free or low-cost CRM alternatives for startups 2026"
  ],
  "totalSources": 10,
  "answerLength": 1542,
  "searchUrl": "https://www.perplexity.ai/search?q=...",
  "scrapedAt": "2026-04-09T15:00:00+00:00"
}
Enter fullscreen mode Exit fullscreen mode

Mode 2: Brand Monitor — Track Brand Mentions in AI Answers

Automatically detect whether your brand appears in Perplexity's answer for a set of queries, and see which competitors are mentioned.

Input:

{
  "mode": "brand_monitor",
  "brandName": "HubSpot",
  "queries": [
    "best CRM software 2026",
    "top email marketing platforms for ecommerce"
  ]
}
Enter fullscreen mode Exit fullscreen mode

Output:

{
  "brand": "HubSpot",
  "query": "best CRM software 2026",
  "mentioned": true,
  "mentionContext": "HubSpot is the easiest all-around option for teams that want a simple start...",
  "position": "Mentioned early in the answer (top section)",
  "competitorsMentioned": ["Zoho CRM", "Salesforce", "Pipedrive"],
  "sourcesCount": 10,
  "scrapedAt": "2026-04-09T15:00:00+00:00"
}
Enter fullscreen mode Exit fullscreen mode

Practical Use Cases

1. Weekly AEO Dashboard

Schedule the actor to run weekly with your core keyword list (e.g., "best [your category] software 2026"). Track over time whether your brand is being recommended, and whether your visibility is improving after content investments.

2. Competitor Monitoring

Run brand_monitor mode with your top competitor names. See which queries they appear for that you do not — those are opportunities.

3. Content Gap Analysis

For your target queries, look at which sources Perplexity cites. If your content is not cited, study what the cited sources cover that you do not. Use this to prioritize content creation.

4. Market Research at Scale

Need AI-curated answers to dozens of research questions? Use search mode with a list of queries and get structured, sourced answers in bulk — with full attribution for verification.


Python and JavaScript Integration

Python:

from apify_client import ApifyClient

client = ApifyClient("YOUR_API_TOKEN")
run = client.actor("zhorex/perplexity-ai-scraper").call(run_input={
    "mode": "brand_monitor",
    "brandName": "YourBrand",
    "queries": ["best project management tools 2026"]
})

for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item["mentioned"], item["competitorsMentioned"])
Enter fullscreen mode Exit fullscreen mode

JavaScript:

import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_API_TOKEN' });
const run = await client.actor('zhorex/perplexity-ai-scraper').call({
    mode: 'search',
    queries: ['best CRM software 2026'],
});

const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items[0].answer);
Enter fullscreen mode Exit fullscreen mode

How It Works Under the Hood

The actor opens Perplexity.ai in a headless Chromium browser (Playwright), navigates to the search URL for each query, waits for the AI to finish generating its streamed answer, then extracts the full answer text, cited sources with URLs, and related questions. Results are pushed to a structured Apify dataset.

Performance:

  • ~15-30 seconds per query (AI answer generation takes time)
  • 1024 MB RAM recommended (Playwright + Chromium)
  • Sequential queries with 5s delay to avoid rate limiting

Perplexity API vs. This Actor

Aspect Perplexity Sonar API This Actor
API key required Yes (paid subscription) No
Cost Sonar Pro pricing $0.02 per query
Speed Fast (direct API) ~15-30s per query
Sources/citations Included Included
Brand monitoring Build it yourself Built-in mode
Related questions Not included Included

The trade-off is speed: the API is faster, but this actor requires no API key or subscription.


Pricing

$0.02 per query ($20 per 1,000 queries). You can test with Apify's free tier which gives you $5 of monthly usage — enough for 250 queries.


FAQ

How is this different from the Perplexity API?
The official Perplexity API (Sonar) gives programmatic access but requires a paid API key. This Actor scrapes the free public web interface — same answers, same sources, no API key required. The trade-off is speed (~15-30s per query).

What is AEO?
Answer Engine Optimization is the practice of getting your brand mentioned in AI search results. As more users shift to AI search engines, monitoring your visibility in AI-generated answers is becoming as important as traditional SEO.

Can I schedule regular monitoring runs?
Yes. Use Apify Schedules to run the actor daily, weekly, or at any interval. Combine with webhooks to send Slack or email alerts when your brand visibility changes.

Are the answers always the same?
No. AI answers are non-deterministic — the same query can produce slightly different answers on different runs. This is a characteristic of AI search, not a limitation of the actor.


Get Started

https://apify.com/zhorex/perplexity-ai-scraper

Try a single query in search mode to see the output quality, then build out your keyword list for systematic monitoring.

Top comments (0)