{
  "openapi": "3.0.1",
  "info": {
    "title": "Reddit Posts Scraper: Buyer Question Detection",
    "description": "Reddit Posts Scraper: Extract posts, comments, authors, timestamps, scores, and engagement data while detecting buyer-intent questions. Identify purchase discussions, customer needs, product demand, and sales opportunities for market research and lead generation.",
    "version": "0.1",
    "x-build-id": "S6QoQEiQmoBCgJGvK"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/api-empire~reddit-posts-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-api-empire-reddit-posts-scraper",
        "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/api-empire~reddit-posts-scraper/runs": {
      "post": {
        "operationId": "runs-sync-api-empire-reddit-posts-scraper",
        "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/api-empire~reddit-posts-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-api-empire-reddit-posts-scraper",
        "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",
        "required": [
          "startUrls"
        ],
        "properties": {
          "startUrls": {
            "title": "🔎 Subreddits, keywords or post URLs",
            "type": "array",
            "description": "One entry per line. Accepts:\n• 📌 Subreddit — e.g. `buildapc` or `r/SaaS`\n• 🔍 Keyword — e.g. `crm recommendation` (runs a Reddit search)\n• 🌐 Full URL — e.g. https://www.reddit.com/r/marketing/\n\nDuplicate subreddits are merged. At least one entry is required.",
            "items": {
              "type": "string"
            }
          },
          "questionsOnly": {
            "title": "❓ Keep only questions",
            "type": "boolean",
            "description": "When on, only posts detected as a question (title ends with `?`, opens with how/what/which/should/anyone…, etc.) are saved. Example: on → skips a plain link-share post. Default is off.",
            "default": false
          },
          "buyingIntentOnly": {
            "title": "🛒 Keep only buying-intent posts",
            "type": "boolean",
            "description": "When on, only posts that match a purchase-intent phrase (looking for, recommend, worth it, alternative to, budget, best … for…, etc.) are saved. Default is off.",
            "default": false
          },
          "unansweredOnly": {
            "title": "🕳️ Keep only unanswered threads",
            "type": "boolean",
            "description": "When on, only posts at or below the comment threshold below are saved — still-open questions nobody has answered. Default is off.",
            "default": false
          },
          "maxCommentsToQualify": {
            "title": "🔢 Unanswered comment threshold",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "A post counts as 'unanswered' when it has this many comments or fewer. Example: 3 → a post with 2 comments is unanswered, one with 9 is not. Default is 5.",
            "default": 5
          },
          "intentKeywords": {
            "title": "➕ Extra buying-intent phrases",
            "type": "array",
            "description": "Optional custom phrases (lowercased, substring match on title+body) added to the built-in buying-intent list — e.g. `demo`, `pricing`, `switching from`. One per line.",
            "items": {
              "type": "string"
            }
          },
          "maxPosts": {
            "title": "📄 Max qualifying posts per source",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Max posts to SAVE per subreddit/keyword after filters (1–1000). With filters on, the actor pages deeper to find this many matches. With 3 sources and 50, up to 150 posts total.",
            "default": 10
          },
          "maxComments": {
            "title": "💬 Comments to fetch per post",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Top-level comments to pull for each saved post (0–1000). Set **0** to skip comments and run faster (metadata + lead signals only). Default is 5.",
            "default": 5
          },
          "sortOrder": {
            "title": "📋 Sort order",
            "enum": [
              "hot",
              "new",
              "top",
              "rising"
            ],
            "type": "string",
            "description": "How Reddit orders the scanned posts. Hot = trending, New = latest, Top = most upvoted, Rising = gaining traction. New/Top are best for fresh leads.",
            "default": "new"
          },
          "timeFilter": {
            "title": "⏱️ Time window",
            "enum": [
              "hour",
              "day",
              "week",
              "month",
              "year",
              "all"
            ],
            "type": "string",
            "description": "Recency window. ⚠️ Only applies when Sort order is **Top** or **Rising** (ignored for Hot/New).",
            "default": "week"
          },
          "aiEnhancement": {
            "title": "🤖 Enable AI intent/sentiment classification",
            "type": "boolean",
            "description": "Adds aiIntent, aiSentiment, aiBuyerStage, aiTopics and aiSummary per post. Default is off (regex detection still runs either way).",
            "default": false
          },
          "aiModel": {
            "title": "🧠 AI model / provider",
            "enum": [
              "claude-haiku-4-5",
              "claude-sonnet-5",
              "claude-opus-4-8",
              "gpt-4o-mini",
              "gpt-4o",
              "gpt-4.1-mini",
              "o3-mini",
              "gemini-2.0-flash-lite",
              "gemini-2.0-flash",
              "gemini-2.5-flash",
              "grok-3-mini",
              "deepseek-chat",
              "sonar",
              "mistral-small-latest"
            ],
            "type": "string",
            "description": "Provider auto-detected from the name: claude-*=Anthropic, gpt-*/o1/o3=OpenAI, gemini-*=Google, grok-*=xAI, deepseek-*=DeepSeek, sonar*=Perplexity, mistral-*=Mistral. Cheap mini/flash/haiku models are recommended for classification.",
            "default": "claude-haiku-4-5"
          },
          "aiApiKey": {
            "title": "🔑 AI API key",
            "type": "string",
            "description": "API key for the selected provider. Used only when AI enrichment is on. Falls back to the provider env var (ANTHROPIC_API_KEY / OPENAI_API_KEY / GEMINI_API_KEY / XAI_API_KEY / DEEPSEEK_API_KEY / PERPLEXITY_API_KEY / MISTRAL_API_KEY) when left blank."
          },
          "proxyConfiguration": {
            "title": "🔐 Proxy configuration",
            "type": "object",
            "description": "The fetch layer uses old.reddit.com HTML. If a page is blocked, the actor auto-escalates: direct → datacenter → residential. ✅ Residential is recommended for large runs."
          },
          "requestDelay": {
            "title": "⏳ Delay between pages (seconds)",
            "minimum": 0,
            "maximum": 60,
            "type": "integer",
            "description": "Pause between paginated requests and sources to ease rate limits. Default is 1.",
            "default": 1
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}