# Perplexity (`winbayai/perplexity`) Actor

Our advanced API, powered by AI, enables seamless Google、Bing、Wiki... data search and analysis, transforming raw data into actionable insights. It streamlines data retrieval for market research and trend tracking, enhancing decision-making accuracy across diverse industries.

- **URL**: https://apify.com/winbayai/perplexity.md
- **Developed by:** [Winbay](https://apify.com/winbayai) (community)
- **Categories:** AI, Agents, SEO tools
- **Stats:** 354 total users, 0 monthly users, 50.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 api queries

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Perplexity on Apify

**Project Link**: <https://apify.com/winbayai/perplexity>

Our advanced API, powered by AI, enables seamless Google data search and analysis, transforming raw data into actionable insights. It streamlines data retrieval for market research and trend tracking, enhancing decision-making accuracy across diverse industries.

Whether for market research, trend analysis, or content optimization, this Actor delivers precise data support, giving you a competitive edge in today's fast-paced digital landscape.

### ✨ Key Features

- **🧠 AI-Powered Analysis**: Leverages a sophisticated AI engine to analyze and organize information, identifying patterns and trends that might otherwise go unnoticed.
- **📈 Market Insights**: Gain a deeper understanding of consumer behavior, market dynamics, and emerging opportunities.
- **🔍 Efficient Data Retrieval**: Streamlines the process of retrieving information from Google's vast database, saving you time.
- **🌐 Versatile Applications**: Ideal for a wide range of industries, including marketing, academic research, content strategy, and more.
- **🤖 Simple to Use**: With a user-friendly interface and robust features, you can get complex analysis with just one simple request.

### 🚀 How to Use on Apify

You can run this Actor in two ways: directly from the Apify Console for ease of use, or programmatically via the API for integration into your own applications.

#### 1. Using Apify Console (The Easy Way)

1. Find this Actor in the [Apify Store](https://apify.com/store).
2. Click **Run**.
3. Go to the **Input** tab.
4. In the JSON editor, enter your query in the `content` field.
5. Click the **Start** button.
6. When the run finishes, check the **Output** tab for your results.

#### 2. Using the API

To use the API, you'll need your **Apify API token**. You can find it in your Apify account settings under the **Integrations** tab.

##### API Endpoint

The endpoint for running this Actor is:

```
https://api.apify.com/v2/acts/winbayai/perplexity/runs?token=YOUR_APIFY_TOKEN
```

You need to send a `POST` request to this endpoint with your query in the request body.

### ⚙️ Input and Output

#### Input

The Actor requires a JSON object with a single `content` field for your query.

**Example Input**:

```json
{
    "content": "What is today's news in America?"
}
```

#### Output

The Actor returns a JSON object containing the original query, the AI-generated response, and the list of source search results.

**Example Output Structure**:

```json
{
    "query": "What is today's news in America?",
    "choices": "A summary of today's top news stories in America, covering politics, technology, and sports...",
    "results": [
        {
            "title": "Major Tech Bill Passes in Senate",
            "link": "https://example.com/news/tech-bill",
            "snippet": "The Senate passed a landmark bill aimed at regulating artificial intelligence...",
            "position": 1
        },
        {
            "title": "New York Giants Win Thriller Game",
            "link": "https://example.com/news/sports-giants-win",
            "snippet": "In a last-minute victory, the New York Giants defeated their rivals...",
            "position": 2
        }
    ]
}
```

### 💻 Code Examples

Here are some request examples in common languages. Remember to replace `YOUR_APIFY_TOKEN` with your actual Apify API token.

#### cURL

```bash
curl -X POST \
  "https://api.apify.com/v2/acts/winbayai/perplexity/runs?token=YOUR_APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "What is today'\''s news in America?"
  }'
```

#### Python (using `requests`)

```python
import requests
import json

## The Actor's run URL
actor_run_url = "https://api.apify.com/v2/acts/winbayai/perplexity/runs?token=YOUR_APIFY_TOKEN"

payload = {
    "content": "What is today's news in America?"
}

headers = {
    "Content-Type": "application/json"
}

response = requests.post(actor_run_url, json=payload, headers=headers)

if response.status_code == 200:
    # The actual Actor output is nested in the 'data' field
    data = response.json().get('data', {})
    print(json.dumps(data, indent=4))
else:
    print(f"Error: {response.status_code}")
    print(response.text)
```

#### JavaScript (using `fetch`)

```javascript
const actorRunUrl = 'https://api.apify.com/v2/acts/winbayai/perplexity/runs?token=YOUR_APIFY_TOKEN';

const payload = {
    content: "What is today's news in America?"
};

const options = {
    method: 'POST',
    headers: {
        'Content-Type': 'application/json'
    },
    body: JSON.stringify(payload)
};

async function runActor() {
    try {
        const response = await fetch(actorRunUrl, options);
        if (!response.ok) {
            throw new Error(`HTTP error! status: ${response.status}`);
        }
        // The actual Actor output is nested in the 'data' field
        const result = await response.json();
        console.log(JSON.stringify(result.data, null, 4));
    } catch (error) {
        console.error('Error:', error);
    }
}

runActor();
```

### 🌐 Links

- **Official Website**: [Winbay](https://winbay.io)
- **GitHub**: [Perplexity-API](https://github.com/winbayai/Perplexity-API)

# Actor input Schema

## `content` (type: `string`):

Enter the question you want to ask the AI.

## Actor input object example

```json
{
  "content": "What is todays news in america?"
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {};

// Run the Actor and wait for it to finish
const run = await client.actor("winbayai/perplexity").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {}

# Run the Actor and wait for it to finish
run = client.actor("winbayai/perplexity").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{}' |
apify call winbayai/perplexity --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,winbayai/perplexity"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/bbwOoPijzbSHfYfM6/builds/kkSJQhbgTH5iRcdL1/openapi.json
