{
  "openapi": "3.0.1",
  "info": {
    "title": "Brand Sentiment Analyzer — Multi-Source Mentions + AI",
    "description": "Monitor brand sentiment across Reddit, Google News, and Trustpilot. Returns an executive summary with sentiment score, top complaints, top praise, crisis signals, and share-of-voice vs an optional competitor — plus per-mention details. AI theme extraction via Claude.",
    "version": "1.5",
    "x-build-id": "ldK4DjGw7MYVo4UaY"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/khadinakbar~brand-sentiment-analyzer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-khadinakbar-brand-sentiment-analyzer",
        "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/khadinakbar~brand-sentiment-analyzer/runs": {
      "post": {
        "operationId": "runs-sync-khadinakbar-brand-sentiment-analyzer",
        "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/khadinakbar~brand-sentiment-analyzer/run-sync": {
      "post": {
        "operationId": "run-sync-khadinakbar-brand-sentiment-analyzer",
        "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": [
          "brandName"
        ],
        "properties": {
          "brandName": {
            "title": "Brand name or keyword",
            "type": "string",
            "description": "The brand, product, or keyword to monitor. Used as a search query across all enabled sources. Examples: 'OpenAI', 'Tesla', 'iPhone 17 Pro', 'Apify'. Use exact spelling for best precision. NOT a profile URL or social handle — for those, use the platform-specific scrapers.",
            "default": "Apify"
          },
          "competitorBrand": {
            "title": "Competitor brand (optional)",
            "type": "string",
            "description": "An optional second brand to monitor in parallel for share-of-voice comparison. The AI summary will include side-by-side mention counts and sentiment splits. Example: if brandName is 'Apify', set this to 'Bright Data'. Leave empty to skip competitor analysis.",
            "default": ""
          },
          "platforms": {
            "title": "Sources to monitor",
            "type": "array",
            "description": "Default 3 sources (Reddit, Google News, Trustpilot) are scraped directly via public endpoints — fast and reliable. 'twitter' and 'youtube' are reserved for v1.3 and will return empty with a notice if selected. Cost scales linearly per platform — disable any you don't need. Each mention costs $0.005.",
            "items": {
              "type": "string",
              "enum": [
                "reddit",
                "google-news",
                "trustpilot",
                "twitter",
                "youtube"
              ],
              "enumTitles": [
                "Reddit (live)",
                "Google News (live)",
                "Trustpilot reviews (live — limited)",
                "Twitter / X (v1.3 — coming soon)",
                "YouTube comments (v1.3 — coming soon)"
              ]
            },
            "default": [
              "reddit",
              "google-news",
              "trustpilot"
            ]
          },
          "maxMentionsPerPlatform": {
            "title": "Max mentions per platform",
            "minimum": 5,
            "maximum": 500,
            "type": "integer",
            "description": "Hard cap on how many mentions to pull from each source. Default 25 keeps a typical run under $1. Set higher for deeper analysis (e.g., 100 for a comprehensive report). Total mentions across all platforms ≤ this number × number of platforms. Each mention costs $0.005.",
            "default": 25
          },
          "timeRange": {
            "title": "Time window",
            "enum": [
              "24h",
              "7d",
              "30d",
              "all"
            ],
            "type": "string",
            "description": "How far back to search for mentions. '24h' for crisis monitoring, '7d' for launch tracking, '30d' for steady-state brand health, 'all' for historical analysis. Note: not every source supports every range — older content may be sparse on some platforms.",
            "default": "7d"
          },
          "language": {
            "title": "Language filter",
            "enum": [
              "en",
              "es",
              "de",
              "fr",
              "pt",
              "it",
              "ja",
              "all"
            ],
            "type": "string",
            "description": "Two-letter language code (ISO 639-1). Filters mentions to this language only. Use 'en' for English, 'es' for Spanish, 'de' for German, 'fr' for French, 'all' for no filter. Default 'en'. Affects search query construction and sentiment-analysis quality.",
            "default": "en"
          },
          "includeAiInsights": {
            "title": "Generate AI insights report",
            "type": "boolean",
            "description": "If true (default), runs Claude Haiku over collected mentions to produce: brand health score (0-10), sentiment breakdown, top 5 complaints, top 5 praise themes, crisis signals, and executive summary. Adds $0.30 to run cost. Set false to get raw mentions only with lexicon-based per-mention sentiment.",
            "default": true
          },
          "responseFormat": {
            "title": "Response detail level",
            "enum": [
              "concise",
              "detailed"
            ],
            "type": "string",
            "description": "'concise' returns short mention text + sentiment label only (~80 tokens/item — best for AI agents). 'detailed' returns full text, author, engagement metrics, URLs, and individual sentiment confidence (~250 tokens/item — best for analytics dashboards). Default 'detailed'.",
            "default": "detailed"
          },
          "maxCostUsd": {
            "title": "Max cost ceiling (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Hard spending cap per run. Actor stops gracefully when reached. Useful for bulk/scheduled runs to avoid surprise bills. Leave at 0 for no cap. Example: 5 means actor stops after spending $5. Recommended: set this to 2-3x your typical run cost as a safety net.",
            "default": 0
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}