Perplexity
The Perplexity Search API endpoint fetches response data from a results page of a Perplexity prompt. Results can be returned in raw HTML format or as a structured JSON format.
curl --request GET \
--url "https://api.scraperapi.com/structured/perplexity/search/v1?api_key=API_KEY&\
query=QUERY&output_format=OUTPUT_FORMAT&include_html=Boolean"import requests
payload = {
'api_key': 'API_KEY',
'query': 'QUERY',
'output_format': 'OUTPUT_FORMAT',
'include_html': 'Boolean' #True/False
}
r = requests.get('https://api.scraperapi.com/structured/perplexity/search/v1',params=payload)
print(r.text)import fetch from 'node-fetch';
fetch(
'https://api.scraperapi.com/structured/perplexity/search/v1?api_key=API_KEY&query=QUERY&output_format=OUTPUT_FORMAT&include_html=Boolean'
)
.then(response => response.json())
.then(data => {
console.log(data);
})
.catch(error => {
console.error(error);
});Supported Parameters
API_KEY (required)
Your API Key.
QUERY (required)
The prompt to send to Perplexity.
OUTPUT_FORMAT
json returns parsed structured data (default). html returns raw HTML.
INCLUDE_HTML
Determines whether raw HTML is included in the response (this can increase the size of the response). Can be set to true or false (default).
JSON Response
{
"query": "string", // the submitted prompt, echoed back
"url": "string|null", // result/thread URL for the answer
"model": "string|null", // model that produced the answer (see notes)
"answer": "string", // the full answer, in Markdown
"sources": [ // citations / web results (may be empty)
{
"title": "string",
"url": "string",
"domain": "string", // bare hostname, www. stripped
"snippet": "string" // may be empty when the engine gives none
}
],
"related_queries": ["string"] // follow-up suggestions (may be empty)
}Field Reference
query
string
yes
Echoed prompt
url
string | null
yes
Result/thread URL
model
string | null
yes
Best-effort. null when not surfaced
answer
string (Markdown)
yes
The answer body
sources[]
array of object
yes (may be empty)
{ title, url, domain, snippet }
related_queries[]
array of string
yes (may be empty)
Follow-up suggestions
All fields are always present in the JSON (empty array or null rather than omitted).
Specifics
model
Populated for Perplexity. For example
turbo.
sources
Present in the response.
snippet
domain is normalized to a bare hostname (www. stripped) across all engines.
related_queries
Present in the response (may be empty).
Example
Pricing
Perplexity queries run on ScraperAPI's standard credit system.
Request Type
Credits Charged
Any Parameter
25

