> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scrapellm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Perplexity

> Extract structured data from the Perplexity AI web interface - numbered citations, source snippets, and follow-up questions - as clean JSON.

<Info>
  **Web search on by default**

  Web search is enabled for all requests. Set `web_search=false` for a faster answer without live citations.
</Info>

## 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

<CodeGroup>
  ```bash cURL theme={null}
  # 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"
  ```

  ```python Python theme={null}
  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())
  ```

  ```javascript JavaScript theme={null}
  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();
  ```
</CodeGroup>

## Response schema

Includes [common response fields](/guides/making-requests#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?

The `result` 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 returns `links[]` which are sources mentioned but not always position-mapped.


## OpenAPI

````yaml GET /scrapers/perplexity
openapi: 3.1.0
info:
  title: ScrapeLLM — Perplexity Scraper
  version: 1.0.0
  description: >
    Scrape the real Perplexity AI web interface via ScrapeLLM's browser pool.
    Returns the

    full response — including numbered inline citations, web sources with
    snippets, and

    suggested follow-up questions — as structured JSON.


    **Base URL:** `https://api.scrapellm.com`


    **Credits:** 3 per request · 500 free credits · No credit card required


    Get your API key at [scrapellm.com/signup](https://scrapellm.com/signup).
  contact:
    email: hello@scrapellm.com
    url: https://scrapellm.com
  license:
    name: ScrapeLLM Terms of Service
    url: https://scrapellm.com/terms
servers:
  - url: https://api.scrapellm.com
    description: Production
security:
  - ApiKeyHeader: []
  - ApiKeyQuery: []
tags:
  - name: Perplexity Scraper
    description: Submit prompts to Perplexity AI and receive structured responses.
paths:
  /scrapers/perplexity:
    get:
      tags:
        - Perplexity Scraper
      summary: Send a Perplexity Scraping Request
      description: >
        Send a prompt to Perplexity AI via a pool of real browsers and get the
        full response

        as structured JSON. Blocks until Perplexity responds or `timeout` is
        reached.


        Responses include the plain-text answer with inline citation markers
        (e.g. `[1][2]`),

        a Markdown-formatted version, the web sources behind those citations,
        and Perplexity's

        suggested follow-up questions.


        **Authentication** — pass your API key via the `X-API-Key` header or as
        `?api_key=`

        in the URL.
      operationId: scrapePerplexity
      parameters:
        - name: prompt
          in: query
          required: true
          description: The prompt to send to Perplexity. Maximum 4,000 characters.
          schema:
            type: string
            minLength: 1
            maxLength: 4000
          example: What brands do marketers recommend for email automation?
        - name: country
          in: query
          required: false
          description: >
            ISO 3166-1 alpha-2 country code. Routes the request through
            infrastructure in

            that region for localised responses. Defaults to `US`.
          schema:
            type: string
            minLength: 2
            maxLength: 2
            default: US
          example: US
        - name: web_search
          in: query
          required: false
          description: >
            Enable live web search in Perplexity's response. Set to `false` for
            a faster,

            non-search answer based on training data only. Defaults to `true`.
          schema:
            type: boolean
            default: true
        - name: bypass_cache
          in: query
          required: false
          description: Skip the response cache and always fetch a fresh result.
          schema:
            type: boolean
            default: false
        - name: timeout
          in: query
          required: false
          description: >-
            Maximum seconds to wait for Perplexity to respond. Must be between
            10 and 600.
          schema:
            type: number
            format: float
            minimum: 10
            maximum: 600
            default: 300
      responses:
        '200':
          description: Scrape completed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PerplexityScrapeResponse'
              example:
                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
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                detail: >-
                  Missing API key. Pass your key in the X-API-Key header or as
                  ?api_key= in the URL.
        '408':
          description: Perplexity did not respond within the timeout period.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Credit limit reached or scraper queue is full — retry shortly.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Scraper returned an unexpected error — safe to retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Scraper pool is still warming up — retry in a few seconds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '504':
          description: Network timeout reaching the scraper machine.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      x-codeSamples:
        - lang: Shell
          label: cURL
          source: >
            # 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"
        - lang: Python
          label: Python
          source: |
            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())
        - lang: JavaScript
          label: JavaScript
          source: |
            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);
        - lang: TypeScript
          label: TypeScript
          source: |
            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);
components:
  schemas:
    PerplexityScrapeResponse:
      type: object
      required:
        - scraper
        - status
        - job_id
        - prompt
        - country
        - result
        - credits_used
        - elapsed_ms
        - cached
      properties:
        scraper:
          type: string
          description: Always `"perplexity"`.
          example: perplexity
        status:
          type: string
          description: '`"done"` on success.'
          example: done
        job_id:
          type: string
          description: Unique identifier for this scrape job.
          example: job_abc123
        prompt:
          type: string
          description: The prompt that was submitted.
          example: What brands do marketers recommend for email automation?
        country:
          type: string
          description: The country the request was routed through.
          example: US
        result:
          type: string
          description: >
            Plain-text response from Perplexity, with inline citation markers
            (e.g. `[1][2]`)

            corresponding to positions in `sources`.
          example: >-
            Marketers commonly recommend Mailchimp, HubSpot, and Klaviyo
            [1][2]...
        result_markdown:
          type: string
          nullable: true
          description: >-
            Markdown-formatted response from Perplexity with inline citation
            markers.
          example: >-
            Marketers commonly recommend **Mailchimp**, **HubSpot**, and
            **Klaviyo** [1][2]...
        sources:
          type: array
          description: >
            Web sources cited by Perplexity. The position in this array
            corresponds to the

            numbered inline citations in `result` and `result_markdown`.
          items:
            $ref: '#/components/schemas/PerplexitySource'
        related_questions:
          type: array
          description: Follow-up questions suggested by Perplexity.
          items:
            type: string
          example:
            - What is the best email automation tool for e-commerce?
            - How does Klaviyo compare to Mailchimp?
        credits_used:
          type: integer
          description: Credits consumed by this request. Always `3` for Perplexity.
          example: 3
        elapsed_ms:
          type: number
          format: float
          description: Total end-to-end request duration in milliseconds.
          example: 9142.3
        cached:
          type: boolean
          description: '`true` if this response was served from cache.'
          example: false
        markdown_url:
          type: string
          nullable: true
          description: |
            Hosted `.md` URL for this response. Expires after 24 hours.
          example: https://scrapellm.com/md/job_abc123.md
    ErrorResponse:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: Human-readable description of the error.
          example: Invalid API key.
    PerplexitySource:
      type: object
      required:
        - title
        - url
      properties:
        title:
          type: string
          description: Title of the cited web page.
          example: Best Email Marketing Platforms 2025
        snippet:
          type: string
          nullable: true
          description: Excerpt from the cited page as shown by Perplexity.
          example: We tested 12 tools across deliverability, automation, and pricing...
        url:
          type: string
          format: uri
          description: Absolute URL of the cited source.
          example: https://example.com/email-marketing-comparison
  securitySchemes:
    ApiKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
      description: Your ScrapeLLM API key passed in the request header.
    ApiKeyQuery:
      type: apiKey
      in: query
      name: api_key
      description: Your ScrapeLLM API key passed as a query parameter.

````