Perplexity
The perplexity source lets you send prompts and capture complete responses directly from Perplexity. It returns both the generated text and relevant metadata in a structured format, along with a Markdown version of the result.
Request samples
The code examples below illustrate how to send prompts to Perplexity and retrieve parsed responses.
curl 'https://realtime.oxylabs.io/v1/queries' \
--user 'USERNAME:PASSWORD' \
-H 'Content-Type: application/json' \
-d '{
"source": "perplexity",
"prompt": "top 3 smartphones in 2025, compare pricing across US marketplaces",
"geo_location": "United States",
"parse": true
}'import requests
from pprint import pprint
# Structure payload.
payload = {
'source': 'perplexity',
'prompt': 'top 3 smartphones in 2025, compare pricing across US marketplaces',
'geo_location': 'United States',
'parse': True
}
# Get a response.
response = requests.post(
'https://realtime.oxylabs.io/v1/queries',
auth=('USERNAME', 'PASSWORD'),
json=payload
)
# Print prettified response to stdout.
pprint(response.json())const https = require("https");
const username = "USERNAME";
const password = "PASSWORD";
const body = {
source: "perplexity",
prompt: "top 3 smartphones in 2025, compare pricing across US marketplaces",
geo_location: "United States",
parse: true
};
const options = {
hostname: "realtime.oxylabs.io",
path: "/v1/queries",
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization:
"Basic " + Buffer.from(`${username}:${password}`).toString("base64"),
},
};
const request = https.request(options, (response) => {
let data = "";
response.on("data", (chunk) => {
data += chunk;
});
response.on("end", () => {
const responseData = JSON.parse(data);
console.log(JSON.stringify(responseData, null, 2));
});
});
request.on("error", (error) => {
console.error("Error:", error);
});
request.write(JSON.stringify(body));
request.end();https://realtime.oxylabs.io/v1/queries?source=perplexity&prompt=top%203%20smartphones%20in%202025%2C%20compare%20pricing%20across%20US%20marketplaces&geo_location=United%20States&parse=true&access_token=12345abcde<?php
$params = array(
'source' => 'perplexity',
'prompt' => 'top 3 smartphones in 2025, compare pricing across US marketplaces',
'geo_location' => 'United States',
'parse' => true
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://realtime.oxylabs.io/v1/queries");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($params));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_USERPWD, "USERNAME" . ":" . "PASSWORD");
$headers = array();
$headers[] = "Content-Type: application/json";
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
echo $result;
if (curl_errno($ch)) {
echo 'Error:' . curl_error($ch);
}
curl_close($ch);package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
const Username = "USERNAME"
const Password = "PASSWORD"
payload := map[string]interface{}{
"source": "perplexity",
"prompt": "top 3 smartphones in 2025, compare pricing across US marketplaces",
"geo_location": "United States",
"parse": true,
}
jsonValue, _ := json.Marshal(payload)
client := &http.Client{}
request, _ := http.NewRequest("POST",
"https://realtime.oxylabs.io/v1/queries",
bytes.NewBuffer(jsonValue),
)
request.SetBasicAuth(Username, Password)
response, _ := client.Do(request)
responseText, _ := io.ReadAll(response.Body)
fmt.Println(string(responseText))
}
using System;
using System.Collections.Generic;
using System.Net.Http;
using System.Net.Http.Json;
using System.Threading.Tasks;
namespace OxyApi
{
class Program
{
static async Task Main()
{
const string Username = "USERNAME";
const string Password = "PASSWORD";
var parameters = new
{
source = "perplexity",
prompt = "top 3 smartphones in 2025, compare pricing across US marketplaces",
geo_location = "United States",
parse = true
};
var client = new HttpClient();
Uri baseUri = new Uri("https://realtime.oxylabs.io");
client.BaseAddress = baseUri;
var requestMessage = new HttpRequestMessage(HttpMethod.Post, "/v1/queries");
requestMessage.Content = JsonContent.Create(parameters);
var authenticationString = $"{Username}:{Password}";
var base64EncodedAuthenticationString = Convert.ToBase64String(System.Text.ASCIIEncoding.UTF8.GetBytes(authenticationString));
requestMessage.Headers.Add("Authorization", "Basic " + base64EncodedAuthenticationString);
var response = await client.SendAsync(requestMessage);
var contents = await response.Content.ReadAsStringAsync();
Console.WriteLine(contents);
}
}
}package org.example;
import okhttp3.*;
import org.json.JSONArray;
import org.json.JSONObject;
import java.util.concurrent.TimeUnit;
public class Main implements Runnable {
private static final String AUTHORIZATION_HEADER = "Authorization";
public static final String USERNAME = "USERNAME";
public static final String PASSWORD = "PASSWORD";
public void run() {
JSONObject jsonObject = new JSONObject();
jsonObject.put("source", "perplexity");
jsonObject.put("prompt", "top 3 smartphones in 2025, compare pricing across US marketplaces");
jsonObject.put("geo_location", "United States");
jsonObject.put("parse", true);
Authenticator authenticator = (route, response) -> {
String credential = Credentials.basic(USERNAME, PASSWORD);
return response
.request()
.newBuilder()
.header(AUTHORIZATION_HEADER, credential)
.build();
};
var client = new OkHttpClient.Builder()
.authenticator(authenticator)
.readTimeout(180, TimeUnit.SECONDS)
.build();
var mediaType = MediaType.parse("application/json; charset=utf-8");
var body = RequestBody.create(jsonObject.toString(), mediaType);
var request = new Request.Builder()
.url("https://realtime.oxylabs.io/v1/queries")
.post(body)
.build();
try (var response = client.newCall(request).execute()) {
if (response.body() != null) {
try (var responseBody = response.body()) {
System.out.println(responseBody.string());
}
}
} catch (Exception exception) {
System.out.println("Error: " + exception.getMessage());
}
System.exit(0);
}
public static void main(String[] args) {
new Thread(new Main()).start();
}
}{
"source": "perplexity",
"prompt": "top 3 smartphones in 2025, compare pricing across US marketplaces",
"geo_location": "United States",
"parse": true
}Our examples use the Realtime (synchronous) integration method. To use Proxy Endpoint or Push-Pull (asynchronous), refer to the integration methods section.
Request parameter values
Generic
Basic setup and configuration parameters for retrieving Perplexity responses.
- mandatory parameter
Structured data
Web Scraper API returns either an HTML document or a JSON object of Perplexity's output, which contains structured data from the results page.
Output data dictionary
HTML example

JSON structure
The structured perplexity output includes fields such as url, model, answer_results, and more. The table below breaks down the page elements we parse, along with descriptions, data types, and relevant metadata.
url
The URL of Perplexity's conversation.
string
page
Page number.
integer
content
An object containing parsed Perplexity page data.
object
model
Perplexity model used to generate the answer.
string
prompt_query
The original prompt submitted to Perplexity.
string
displayed_tabs
Tabs displayed in Perplexity's interface (e.g., shopping, images).
list
answer_results
The complete Perplexity response containing text or nested content.
list or string
answer_results_md
The entire answer rendered in Markdown format.
string
related_queries
A list of queries related to the main prompt.
list
top_images
A list of top images with their titles and URLs.
array
top_sources
A list of top cited sources with their titles, sources, and URLs.
array
inline_products
A list of inline products with titles, prices, links, and other metadata.
array
additional_results.hotels_results
A list of hotels with titles, URLs, addresses, and other hotel details.
array
additional_results.places_results
A list of places with titles, URLs, coordinates,, and other metadata.
array
additional_results.videos_results
A list of videos with thumbnails, titles, URLs, and sources.
array
additional_results.shopping_results
A list of shopping items with titles, prices, URLs, and other product metadata.
array
additional_results.sources_results
A list of cited sources with their titles and URLs.
array
additional_results.images_results
A list of related images with titles, image URLs, and source page URLs.
array
parse_status_code
Status code of the parsing operation.
integer
created_at
The timestamp when the scraping job was created.
timestamp
updated_at
The timestamp when the scraping job was finished.
timestamp
job_id
The ID of the job associated with the scraping job.
string
geo_location
Proxy location from which the prompt was submitted.
string
status_code
The status code of the scraping job. You can see the scraper status codes described here.
integer
parser_type
The type of the parser used for breaking down the HTML content.
string
Additional results and inline products
Along with the main AI response, we return extra data under additional_results, such as
images_resultssources_resultsshopping_resultsvideos_resultsplaces_resultshotels_results
These arrays are extracted from the tabs on the original results page and are included only if relevant content is available:

Moreover, the inline_products array contains products that are directly embedded in the response:

Last updated
Was this helpful?

