{
  "openapi": "3.0.1",
  "info": {
    "title": "Perplexity Search API: Answers, Sources & Citations in Bulk",
    "description": "Perplexity answers with numbered citations, source domains and brand checks from Perplexity's official Sonar API. Inputs: questions, fileUrl (CSV or Google Sheet), datasetId, model, brands, domains, competitors, monitor. Charged per answer returned. Agent-ready: x402, MCP.",
    "version": "0.1",
    "x-build-id": "nIGTheLw5eiT2DXZN"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/nerolabs~perplexity-search-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-nerolabs-perplexity-search-api",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/nerolabs~perplexity-search-api/runs": {
      "post": {
        "operationId": "runs-sync-nerolabs-perplexity-search-api",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/nerolabs~perplexity-search-api/run-sync": {
      "post": {
        "operationId": "run-sync-nerolabs-perplexity-search-api",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "questions": {
            "title": "Questions",
            "type": "array",
            "description": "The questions or search queries to ask Perplexity, one per line. Each one returns Perplexity's full answer with its numbered citations and is charged once, only when an answer with text comes back. Or give a CSV, Google Sheet or dataset below instead.",
            "items": {
              "type": "string"
            }
          },
          "fileUrl": {
            "title": "File or Google Sheet URL",
            "type": "string",
            "description": "A public link to a CSV, TSV, Excel, JSON or JSON Lines file with one question per row. A normal Google Sheets link works (share it as 'Anyone with the link can view'). Every other column is kept on the output row. Used when 'Questions' is empty."
          },
          "datasetId": {
            "title": "Dataset",
            "type": "string",
            "description": "An Apify dataset with one question per row, for example a keyword list from another Actor. Every original column is kept. Use the picker rather than typing an ID. Used when 'Questions' and 'File or Google Sheet URL' are empty."
          },
          "questionField": {
            "title": "Question column",
            "type": "string",
            "description": "For a file or dataset: the column that holds the question. Leave empty to detect it (looks for question, query, prompt, keyword)."
          },
          "questionTemplate": {
            "title": "Question template",
            "type": "string",
            "description": "Optional. Turns each row into a full question, for example 'Best CRM for {question}' with a row 'real estate agents'. {question} is replaced by the row's text. Useful when a sheet holds keywords, not questions."
          },
          "fileFormat": {
            "title": "File format",
            "enum": [
              "auto",
              "csv",
              "tsv",
              "json",
              "jsonl",
              "xlsx"
            ],
            "type": "string",
            "description": "Leave on auto unless the file is detected wrongly.",
            "default": "auto"
          },
          "sheetName": {
            "title": "Excel sheet name",
            "type": "string",
            "description": "For an Excel file: which sheet to read. Leave empty for the first sheet."
          },
          "model": {
            "title": "Perplexity model",
            "enum": [
              "sonar",
              "sonar-pro"
            ],
            "type": "string",
            "description": "sonar is fast and cheap (about $0.005 of model cost per answer, billed to your Apify account by Apify's OpenRouter proxy). sonar-pro reads more sources and gives longer answers (about $0.01 to $0.02 of model cost per answer). Both are charged the same Actor price per answer.",
            "default": "sonar"
          },
          "brands": {
            "title": "Your brand names",
            "type": "array",
            "description": "Optional. Your brand or product names, for example 'HubSpot'. Each answer reports brandMentioned and brandPosition (1 = named first among all your brands and competitors that appear).",
            "items": {
              "type": "string"
            }
          },
          "domains": {
            "title": "Your website domains",
            "type": "array",
            "description": "Optional. Your website domains, for example 'hubspot.com'. Each answer lists ownDomainsCited with the citation number Perplexity gave each one.",
            "items": {
              "type": "string"
            }
          },
          "competitors": {
            "title": "Competitors",
            "type": "array",
            "description": "Optional. Competitor names or domains, for example 'Salesforce'. Each answer lists competitorsMentioned in the order named, and the summary ranks them by share of answers.",
            "items": {
              "type": "string"
            }
          },
          "searchRecency": {
            "title": "Source recency",
            "enum": [
              "any",
              "hour",
              "day",
              "week",
              "month",
              "year"
            ],
            "type": "string",
            "description": "Optional. Ask Perplexity to use only sources from the last hour, day, week, month or year. Leave on 'any' for no limit.",
            "default": "any"
          },
          "searchContextSize": {
            "title": "Search depth",
            "enum": [
              "low",
              "medium",
              "high"
            ],
            "type": "string",
            "description": "How much web content Perplexity reads per question. Low is the cheapest; medium and high cost a little more model fee.",
            "default": "low"
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Optional two-letter country code (US, GB, DE) to answer as a user in that country. A 'country' column in the file overrides it per row."
          },
          "systemPrompt": {
            "title": "Instructions to Perplexity",
            "type": "string",
            "description": "Optional style instruction, for example 'Answer in 3 bullet points' or 'Answer in Spanish'. Perplexity follows it loosely and always answers the question itself; to change what is asked, use 'Question template'."
          },
          "monitor": {
            "title": "Monitor mode",
            "type": "boolean",
            "description": "Remember each question's last answer (in a named key-value store) and, on the next run, mark only what changed: new and dropped citations (isNew on each citation), newly cited or dropped sites, and brand or competitor mentions gained or lost. Schedule the run daily or weekly. Off by default.",
            "default": false
          },
          "monitorName": {
            "title": "Monitor name",
            "type": "string",
            "description": "Keeps separate monitors apart, for example one per client. Letters, numbers and dashes.",
            "default": "default"
          },
          "onlyChanged": {
            "title": "Only output changed questions",
            "type": "boolean",
            "description": "In monitor mode, write only rows that are new or changed since the last run. Every answered question is still charged once, because Perplexity was asked.",
            "default": false
          },
          "keepOriginalFields": {
            "title": "Keep original columns",
            "type": "boolean",
            "description": "Copy every other column of the input row onto the output row.",
            "default": true
          },
          "concurrency": {
            "title": "Questions at once",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many questions are asked at the same time.",
            "default": 5
          },
          "maxItems": {
            "title": "Max questions",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Stop after this many rows from the source."
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}