{
  "openapi": "3.0.1",
  "info": {
    "title": "Social Media Sentiment Analyzer",
    "description": "Analyze social media sentiment for any keyword, hashtag, or brand across Reddit, YouTube, X/Twitter, and Instagram. Returns per-post sentiment, emotion, aspect breakdown, language, and toxicity, plus an AI brand-health report with top praise, complaints, and crisis signals. MCP/API-ready.",
    "version": "1.4",
    "x-build-id": "IJ566CSdlSqc0vayp"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/khadinakbar~social-media-sentiment-analyzer/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-khadinakbar-social-media-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~social-media-sentiment-analyzer/runs": {
      "post": {
        "operationId": "runs-sync-khadinakbar-social-media-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~social-media-sentiment-analyzer/run-sync": {
      "post": {
        "operationId": "run-sync-khadinakbar-social-media-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",
        "properties": {
          "query": {
            "title": "Search keyword, hashtag or brand",
            "type": "string",
            "description": "The keyword, hashtag, brand or topic to search for on each platform, e.g. 'Tesla', 'climate change', '#AI'. Leave empty only if you give post links or your own texts below."
          },
          "postUrls": {
            "title": "Post or video links (optional)",
            "type": "array",
            "description": "Links to specific posts or videos whose comments you want analyzed (YouTube, TikTok, Instagram, Facebook, Reddit). Used in addition to the keyword.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "texts": {
            "title": "Your own texts (optional)",
            "type": "array",
            "description": "Paste your own reviews, comments or messages (one per entry). When filled, the Actor skips data collection and only scores these. Up to 1,000 entries.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "platforms": {
            "title": "Platforms to analyze",
            "type": "array",
            "description": "Which platforms to search. All eight work with no login or cookies. Defaults to Reddit + YouTube.",
            "items": {
              "type": "string",
              "enum": [
                "reddit",
                "youtube",
                "tiktok",
                "twitter",
                "instagram",
                "threads"
              ],
              "enumTitles": [
                "Reddit posts",
                "YouTube comments",
                "TikTok comments",
                "X / Twitter posts",
                "Instagram posts (by hashtag)",
                "Threads posts"
              ]
            },
            "default": [
              "reddit",
              "youtube"
            ]
          },
          "maxItems": {
            "title": "Max posts to analyze (total)",
            "minimum": 10,
            "maximum": 1000,
            "type": "integer",
            "description": "Hard cap on how many posts/comments are analyzed across all platforms combined, split evenly. Default 100, range 10-1000. Each analyzed post is one charge, so this bounds your cost. Free plan: up to 25 per run.",
            "default": 100
          },
          "timeRange": {
            "title": "Time window",
            "enum": [
              "24h",
              "7d",
              "30d",
              "all"
            ],
            "type": "string",
            "description": "How far back to look for posts, where the platform supports it. '24h' for breaking/crisis monitoring, '7d' for launch tracking, '30d' for steady-state, 'all' for no limit. Default '7d'. Some sources (e.g. Instagram hashtag) ignore this and always return the most recent posts.",
            "default": "7d"
          },
          "engine": {
            "title": "Sentiment engine",
            "enum": [
              "llm",
              "lexicon"
            ],
            "type": "string",
            "description": "'llm' (default) uses AI for sentiment, emotion, topics and language. 'lexicon' is a fast offline word-list scorer (polarity only, English). If no AI key is available the Actor falls back to 'lexicon' with a warning.",
            "default": "llm"
          },
          "llmProvider": {
            "title": "LLM provider",
            "enum": [
              "openai",
              "anthropic"
            ],
            "type": "string",
            "description": "Only used with your own AI key below. Without your own key the Actor uses its built-in small model.",
            "default": "openai"
          },
          "llmApiKey": {
            "title": "LLM API key (optional, BYOK)",
            "type": "string",
            "description": "Optional. Your own OpenAI or Anthropic key. With it, AI work is billed to your account and the report also uses your key. Leave blank to use the built-in model. Stored encrypted."
          },
          "includeToxicity": {
            "title": "Score toxicity",
            "type": "boolean",
            "description": "When enabled, the AI engine also returns a 0-1 toxicity score per post (hate, harassment, threats, profanity). Useful for community moderation and brand-safety screening. Adds reasoning per post but no extra per-post fee. Only applies when engine is 'llm'; ignored for lexicon.",
            "default": false
          },
          "includeReport": {
            "title": "Generate AI brand-health report",
            "type": "boolean",
            "description": "If true (default), one AI brand-health report is added: score 0-100, sentiment split, praise, complaints, crisis signals, recommendations. One extra report charge. Set false for per-post data only.",
            "default": true
          },
          "responseFormat": {
            "title": "Per-post detail level",
            "enum": [
              "concise",
              "detailed"
            ],
            "type": "string",
            "description": "'concise' returns short text + sentiment label + score per post (~90 tokens/item — best for AI agents). 'detailed' returns full text, author, engagement, URL, emotions, aspects, language, and toxicity (~280 tokens/item — best for dashboards). Default 'detailed'. Does not affect the aggregate report.",
            "default": "detailed"
          },
          "maxCostUsd": {
            "title": "Max cost ceiling (USD)",
            "minimum": 0,
            "type": "number",
            "description": "Hard cap on this run's total charges (posts + report). The Actor stops gracefully when reached. 0 = no cap.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}