Tutorial

How to Monitor Perplexity Citations

Track which sources Perplexity cites when answering prompts about your brand or category. Build a daily citation monitor with Scavio.

Perplexity's answer engine returns sources inline with every answer. For brands, the question is which sources get cited and how often. This tutorial walks through building a daily citation monitor that queries Perplexity with your prompts and extracts the cited URLs.

Prerequisites

  • Python 3.8+
  • A Scavio API key
  • A list of brand-relevant prompts

Walkthrough

Step 1: Define monitored prompts

Curate a list of prompts that represent how users describe your category.

Python
PROMPTS = [
    'best AI agent framework in 2026',
    'top Claude Code alternatives',
    'best search API for LangGraph'
]

Step 2: Query Perplexity via Scavio

Scavio's ask endpoint supports Perplexity as a platform.

Python
import requests, os

def ask_perplexity(prompt):
    r = requests.post('https://api.scavio.dev/api/v1/ask',
        headers={'x-api-key': os.environ['SCAVIO_API_KEY']},
        json={'platform': 'perplexity', 'prompt': prompt})
    return r.json()

Step 3: Extract citations

Perplexity returns citations as a list of source URLs.

Python
def extract_citations(response):
    return response.get('citations', [])

Step 4: Aggregate by domain

Group citations by domain to see which sites dominate.

Python
from urllib.parse import urlparse
from collections import Counter

def top_domains(all_citations):
    domains = [urlparse(c).netloc for c in all_citations]
    return Counter(domains).most_common(10)

Step 5: Log and compare

Run daily and compare against prior runs to spot gains and losses.

Python
import json

all_cites = []
for p in PROMPTS:
    resp = ask_perplexity(p)
    all_cites.extend(extract_citations(resp))

print(top_domains(all_cites))

Python Example

Python
import os, requests
from urllib.parse import urlparse
from collections import Counter

API_KEY = os.environ['SCAVIO_API_KEY']
PROMPTS = ['best AI agent framework 2026', 'top SerpAPI alternatives']

def ask(prompt):
    r = requests.post('https://api.scavio.dev/api/v1/ask',
        headers={'x-api-key': API_KEY},
        json={'platform': 'perplexity', 'prompt': prompt})
    return r.json().get('citations', [])

all_cites = []
for p in PROMPTS:
    all_cites.extend(ask(p))

domains = Counter(urlparse(c).netloc for c in all_cites)
print(domains.most_common(5))

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
const PROMPTS = ['best AI agent framework 2026'];
const allCites = [];
for (const p of PROMPTS) {
  const r = await fetch('https://api.scavio.dev/api/v1/ask', {
    method: 'POST',
    headers: { 'x-api-key': API_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ platform: 'perplexity', prompt: p })
  });
  allCites.push(...((await r.json()).citations || []));
}
const domains = {};
allCites.forEach(c => { const d = new URL(c).hostname; domains[d] = (domains[d] || 0) + 1; });
console.log(Object.entries(domains).sort((a, b) => b[1] - a[1]).slice(0, 5));

Expected Output

JSON
A list of top-cited domains for your monitored prompts, e.g. [('github.com', 12), ('langchain.com', 8), ('anthropic.com', 7), ('scavio.dev', 5)]. Over time, track your own domain's citation rate vs competitors.

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Python 3.8+. A Scavio API key. A list of brand-relevant prompts. A Scavio API key gives you 500 free credits per month.

Yes. The free tier includes 500 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Track which sources Perplexity cites when answering prompts about your brand or category. Build a daily citation monitor with Scavio.