{
  "openapi": "3.0.1",
  "info": {
    "title": "Google Reviews Monitor & AI Reply Drafts",
    "description": "Monitor new and edited Google Maps reviews across locations, detect urgent feedback, and create safe AI reply drafts for human approval.",
    "version": "0.1",
    "x-build-id": "yMo2C6oOrBfXHKzzN"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/i-scraper~google-reviews-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-i-scraper-google-reviews-monitor",
        "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/i-scraper~google-reviews-monitor/runs": {
      "post": {
        "operationId": "runs-sync-i-scraper-google-reviews-monitor",
        "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/i-scraper~google-reviews-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-i-scraper-google-reviews-monitor",
        "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": [
          "places"
        ],
        "properties": {
          "places": {
            "title": "Locations",
            "minItems": 1,
            "maxItems": 20,
            "type": "array",
            "description": "Add a Google Maps place URL or a 27-character Google Place ID for each location.",
            "items": {
              "type": "object",
              "additionalProperties": false,
              "properties": {
                "url": {
                  "title": "Google Maps URL",
                  "description": "Direct URL of one Google Maps place. Use either this field or Google Place ID.",
                  "type": "string",
                  "editor": "textfield"
                },
                "placeId": {
                  "title": "Google Place ID",
                  "description": "Supported 27-character Place ID starting with ChIJ or GhIJ. Use either this field or URL.",
                  "type": "string",
                  "editor": "textfield"
                },
                "label": {
                  "title": "Location label",
                  "description": "Optional name used in output and summaries.",
                  "type": "string",
                  "editor": "textfield",
                  "maxLength": 120
                }
              }
            }
          },
          "monitorId": {
            "title": "Monitor ID",
            "pattern": "^[A-Za-z0-9_-]+$",
            "minLength": 3,
            "maxLength": 80,
            "type": "string",
            "description": "Stable ID for scheduled monitoring. If omitted, an ID is derived from the normalized location list."
          },
          "firstRunPolicy": {
            "title": "First run behavior",
            "enum": [
              "baselineOnly",
              "emitRecent",
              "emitAllFetched"
            ],
            "type": "string",
            "description": "Store only a baseline, emit reviews from the lookback window, or emit everything fetched.",
            "default": "emitRecent"
          },
          "lookbackDays": {
            "title": "First-run lookback (days)",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "With Emit recent reviews, include reviews published within this many days on the first run.",
            "default": 30
          },
          "maxReviewsPerPlace": {
            "title": "Maximum reviews per location",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Reviews are requested newest-first from the upstream provider.",
            "default": 100
          },
          "alertAtOrBelowStars": {
            "title": "Alert at or below stars",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "Always flag reviews at or below this rating, without requiring AI.",
            "default": 3
          },
          "includeAnsweredReviews": {
            "title": "Include reviews with owner replies",
            "type": "boolean",
            "description": "When disabled, suppress emitted review events that already have an owner response while still tracking them in state.",
            "default": true
          },
          "onlyNew": {
            "title": "Only new or changed reviews",
            "type": "boolean",
            "description": "After the first successful run, suppress unchanged known reviews.",
            "default": true
          },
          "alertKeywords": {
            "title": "Additional alert keywords",
            "maxItems": 30,
            "type": "array",
            "description": "Case-insensitive phrases that should always raise an alert.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 80
            },
            "default": []
          },
          "aiMode": {
            "title": "AI assistance",
            "enum": [
              "off",
              "triage",
              "triageAndReply"
            ],
            "type": "string",
            "description": "AI requires the encrypted OpenAI API key input or an OPENAI_API_KEY environment variable. Drafts are never posted automatically.",
            "default": "off"
          },
          "openaiApiKey": {
            "title": "OpenAI API key",
            "type": "string",
            "description": "Optional encrypted API key used only for AI triage and reply drafts. The OPENAI_API_KEY environment variable is also supported."
          },
          "replyTone": {
            "title": "Reply tone",
            "enum": [
              "professional",
              "warm",
              "concise"
            ],
            "type": "string",
            "description": "Preferred tone for AI reply drafts when triage and reply mode is enabled.",
            "default": "professional"
          },
          "replyLanguage": {
            "title": "Reply language",
            "maxLength": 20,
            "type": "string",
            "description": "Use auto to reply in the original review language.",
            "default": "auto"
          },
          "brandContext": {
            "title": "Brand context",
            "maxLength": 4000,
            "type": "string",
            "description": "Optional facts the AI may use. Do not include secrets or personal data."
          },
          "brandRules": {
            "title": "Brand reply rules",
            "maxItems": 30,
            "type": "array",
            "description": "Optional short instructions for draft tone and wording; safety rules always take precedence.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 300
            },
            "default": []
          },
          "maxAiReviews": {
            "title": "Maximum AI-processed reviews",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "Run-level safety cap for new or changed text reviews sent to the AI service.",
            "default": 25
          },
          "aiBudgetUsd": {
            "title": "Estimated AI budget (USD)",
            "minimum": 0,
            "maximum": 100,
            "type": "number",
            "description": "Stops starting new AI calls once the conservative estimated cost reaches this amount.",
            "default": 1
          },
          "generateLocationDigest": {
            "title": "Generate location summaries",
            "type": "boolean",
            "description": "Write one automation-friendly summary row for every successfully checked location.",
            "default": true
          },
          "resetState": {
            "title": "Reset saved baseline",
            "type": "boolean",
            "description": "Treat this as a first run and replace prior state for this monitor.",
            "default": false
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Reserved for a future direct provider. The maintained upstream Actor manages acquisition networking.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}