{
  "openapi": "3.0.1",
  "info": {
    "title": "Review Insights AI: Sentiment Analysis of Customer Reviews",
    "description": "Analyze customer reviews with AI: sentiment, top complaints, praise, feature requests and reply templates. Works with a CSV or reviews you already have from Google Maps, Trustpilot, App Store or Amazon. 100 reviews + 1 report = $0.251.",
    "version": "0.1",
    "x-build-id": "upvkAg5OTtKS0k3Db"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datatools-ai~review-insights-ai/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datatools-ai-review-insights-ai",
        "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/datatools-ai~review-insights-ai/runs": {
      "post": {
        "operationId": "runs-sync-datatools-ai-review-insights-ai",
        "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/datatools-ai~review-insights-ai/run-sync": {
      "post": {
        "operationId": "run-sync-datatools-ai-review-insights-ai",
        "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": {
          "datasetId": {
            "title": "Reviews dataset",
            "type": "string",
            "description": "Dataset from a reviews scrape you already ran (Google Maps, Trustpilot, App Store, Google Play, Amazon, Booking, etc.). Text, rating, date and business name are detected automatically. Leave empty if you use csvUrl or reviews."
          },
          "csvUrl": {
            "title": "Or: CSV URL",
            "type": "string",
            "description": "Public CSV URL (e.g. Google Sheets → Publish to web → CSV) with a review text column. Leave empty if you use datasetId or reviews."
          },
          "reviews": {
            "title": "Or: reviews JSON",
            "type": "array",
            "description": "Array of review objects. Accepted fields (auto-detected): text or review/content/comment; rating or stars/score; date or publishedAtDate/time; title or name/business/app (entity). Example: [{\"title\":\"Café Aurora\",\"stars\":5,\"publishedAtDate\":\"2026-10-02\",\"text\":\"Best flat white in town.\"}]."
          },
          "language": {
            "title": "Output language",
            "enum": [
              "en",
              "es"
            ],
            "type": "string",
            "description": "Language for labels, summaries and the insights report (en or es). Reviews themselves can be in any language.",
            "default": "en"
          },
          "generateSummary": {
            "title": "Generate insights report per business/product",
            "type": "boolean",
            "description": "If true (default), also write one HTML + Markdown + JSON insights report per business/product (charged $0.05 each): top complaints, praise, requests, trends, actions and reply templates.",
            "default": true
          },
          "businessContext": {
            "title": "Business context (optional)",
            "type": "string",
            "description": "Short description of the business, e.g. 'Coffee shop chain with 12 locations in Mexico City'. Improves recommended actions and reply templates."
          },
          "maxReviews": {
            "title": "Max reviews to analyze",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Optional cap on reviews processed and charged. Use this to test on a sample first.",
            "default": 1000
          },
          "includeReviewText": {
            "title": "Include original review text in the output",
            "type": "boolean",
            "description": "If true, the analyzed review item includes the source text. Turn off if you only need labels.",
            "default": true
          },
          "groupByField": {
            "title": "Group reports by this field",
            "type": "string",
            "description": "Optional field name used to split reports (e.g. location or product). Empty = auto-detect a business/product name."
          },
          "textField": {
            "title": "Review text field name",
            "type": "string",
            "description": "Optional override if auto-detection misses your text column (e.g. 'review_body')."
          },
          "ratingField": {
            "title": "Rating field name",
            "type": "string",
            "description": "Optional override for the rating/stars column (e.g. 'score')."
          },
          "model": {
            "title": "Model",
            "enum": [
              "gpt-4.1-mini",
              "gpt-4o-mini"
            ],
            "type": "string",
            "description": "OpenAI model used for analysis. The price per review and per report is the same.",
            "default": "gpt-4.1-mini"
          },
          "batchSize": {
            "title": "Reviews per AI request",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "How many reviews are sent in one model call.",
            "default": 20
          },
          "concurrency": {
            "title": "Parallel requests",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "How many model requests run at the same time.",
            "default": 5
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}