Scrapers
Perplexity
Extract structured data from the Perplexity AI web interface - numbered citations, source snippets, and follow-up questions - as clean JSON.
GET
/
scrapers
/
perplexity
cURL
# Streaming can take up to 300s - --max-time matches the server timeout
curl --max-time 300 \
-G "https://api.scrapellm.com/scrapers/perplexity" \
--data-urlencode "api_key=YOUR_API_KEY" \
--data-urlencode "prompt=What brands do marketers recommend for email automation?" \
--data-urlencode "country=US"import requests
response = requests.get(
"https://api.scrapellm.com/scrapers/perplexity",
params={
"api_key": "YOUR_API_KEY",
"prompt": "What brands do marketers recommend for email automation?",
"country": "US",
}
)
print(response.json())
const params = new URLSearchParams({
api_key: "YOUR_API_KEY",
prompt: "What brands do marketers recommend for email automation?",
country: "US",
});
const response = await fetch(
`https://api.scrapellm.com/scrapers/perplexity?${params}`
);
const data = await response.json();
console.log(data);
const params = new URLSearchParams({
api_key: "YOUR_API_KEY",
prompt: "What brands do marketers recommend for email automation?",
country: "US",
});
const response = await fetch(
`https://api.scrapellm.com/scrapers/perplexity?${params}`
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.scrapellm.com/scrapers/perplexity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.scrapellm.com/scrapers/perplexity"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.scrapellm.com/scrapers/perplexity")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrapellm.com/scrapers/perplexity")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"scraper": "perplexity",
"status": "done",
"job_id": "job_abc123",
"prompt": "What brands do marketers recommend for email automation?",
"country": "US",
"result": "Marketers commonly recommend Mailchimp, HubSpot, and Klaviyo [1][2]...",
"result_markdown": "Marketers commonly recommend **Mailchimp**, **HubSpot**, and **Klaviyo** [1][2]...",
"sources": [
{
"title": "Best Email Marketing Platforms 2025",
"snippet": "We tested 12 tools across deliverability, automation, and pricing...",
"url": "https://example.com/email-marketing-comparison"
}
],
"related_questions": [
"What is the best email automation tool for e-commerce?",
"How does Klaviyo compare to Mailchimp?"
],
"credits_used": 3,
"elapsed_ms": 9142.3,
"cached": false,
"markdown_url": "https://scrapellm.com/md/job_abc123.md"
}{
"detail": "Missing API key. Pass your key in the X-API-Key header or as ?api_key= in the URL."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}Web search on by defaultWeb search is enabled for all requests. Set
web_search=false for a faster answer without live citations.Overview
Perplexity is a research-first AI that cites every claim with a numbered source. Use this endpoint to monitor brand mentions in AI search, track which sources Perplexity trusts for your industry, and extract follow-up questions as content and keyword ideas.Unique features
- Numbered citations: Every source is numbered and mapped to inline
[1][2]references in the response text - Source snippets: Full text excerpts from each cited page - not just the URL
- Related questions: Perplexity’s suggested follow-up questions for further research
Example request
# Streaming can take up to 300s - --max-time matches the server timeout
curl --max-time 300 \
-G "https://api.scrapellm.com/scrapers/perplexity" \
--data-urlencode "api_key=YOUR_API_KEY" \
--data-urlencode "prompt=What brands do marketers recommend for email automation?" \
--data-urlencode "country=US"
import requests
response = requests.get(
"https://api.scrapellm.com/scrapers/perplexity",
headers={"X-API-Key": "YOUR_API_KEY"},
params={
"prompt": "What brands do marketers recommend for email automation?",
"country": "US",
}
)
print(response.json())
const params = new URLSearchParams({
prompt: "What brands do marketers recommend for email automation?",
country: "US",
});
const response = await fetch(
`https://api.scrapellm.com/scrapers/perplexity?${params}`,
{ headers: { "X-API-Key": "YOUR_API_KEY" } }
);
const data = await response.json();
Response schema
Includes common response fields plus:| Field | Type | Description |
|---|---|---|
result | string | Plain-text response. Inline citation markers like [1] map to positions in sources[] |
result_markdown | string | Markdown-formatted response |
sources | array | Cited web sources - each has title, url, and snippet |
sources[].title | string | Article title of the cited page |
sources[].url | string | URL of the cited source |
sources[].snippet | string | Text excerpt from the source page |
related_questions | array | Perplexity’s suggested follow-up questions |
credits_used | integer | Credits consumed - always 3 for Perplexity |
elapsed_ms | float | End-to-end request duration in milliseconds |
cached | boolean | true if served from cache |
Common questions
How do inline citation numbers map to sources?
Theresult field contains inline markers like [1][2]. The number is the 1-based position of the source in the sources[] array - [1] refers to sources[0], [2] to sources[1], and so on.
When should I set web_search=false?
When you need a fast, low-latency answer and don’t need cited sources - for example, generating summaries or using Perplexity as a general-purpose language model. Responses without web search are typically 2–4× faster.
How is Perplexity different from ChatGPT for citation monitoring?
Perplexity returns richer source metadata (full text snippets per source) and uses numbered inline citations that map directly to positions in the response text. ChatGPT returnslinks[] which are sources mentioned but not always position-mapped.Authorizations
ApiKeyHeaderApiKeyQuery
Query Parameters
Response
Scrape completed successfully.
cURL
# Streaming can take up to 300s - --max-time matches the server timeout
curl --max-time 300 \
-G "https://api.scrapellm.com/scrapers/perplexity" \
--data-urlencode "api_key=YOUR_API_KEY" \
--data-urlencode "prompt=What brands do marketers recommend for email automation?" \
--data-urlencode "country=US"import requests
response = requests.get(
"https://api.scrapellm.com/scrapers/perplexity",
params={
"api_key": "YOUR_API_KEY",
"prompt": "What brands do marketers recommend for email automation?",
"country": "US",
}
)
print(response.json())
const params = new URLSearchParams({
api_key: "YOUR_API_KEY",
prompt: "What brands do marketers recommend for email automation?",
country: "US",
});
const response = await fetch(
`https://api.scrapellm.com/scrapers/perplexity?${params}`
);
const data = await response.json();
console.log(data);
const params = new URLSearchParams({
api_key: "YOUR_API_KEY",
prompt: "What brands do marketers recommend for email automation?",
country: "US",
});
const response = await fetch(
`https://api.scrapellm.com/scrapers/perplexity?${params}`
);
const data = await response.json();
console.log(data);
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.scrapellm.com/scrapers/perplexity",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.scrapellm.com/scrapers/perplexity"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-Key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.scrapellm.com/scrapers/perplexity")
.header("X-API-Key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.scrapellm.com/scrapers/perplexity")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-Key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"scraper": "perplexity",
"status": "done",
"job_id": "job_abc123",
"prompt": "What brands do marketers recommend for email automation?",
"country": "US",
"result": "Marketers commonly recommend Mailchimp, HubSpot, and Klaviyo [1][2]...",
"result_markdown": "Marketers commonly recommend **Mailchimp**, **HubSpot**, and **Klaviyo** [1][2]...",
"sources": [
{
"title": "Best Email Marketing Platforms 2025",
"snippet": "We tested 12 tools across deliverability, automation, and pricing...",
"url": "https://example.com/email-marketing-comparison"
}
],
"related_questions": [
"What is the best email automation tool for e-commerce?",
"How does Klaviyo compare to Mailchimp?"
],
"credits_used": 3,
"elapsed_ms": 9142.3,
"cached": false,
"markdown_url": "https://scrapellm.com/md/job_abc123.md"
}{
"detail": "Missing API key. Pass your key in the X-API-Key header or as ?api_key= in the URL."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}{
"detail": "Invalid API key."
}