{
  "openapi": "3.0.1",
  "info": {
    "title": "X (Twitter) Keyword Monitor – Track Mentions, Hashtags",
    "description": "Monitor X (Twitter) for keywords, hashtags, cashtags & @mentions in real time. Scrape the latest matching tweets or run scheduled checks that return only new posts since the last run. Filter by language, likes & retweets, push results to a webhook, and export JSON/CSV/Excel.",
    "version": "0.0",
    "x-build-id": "CcbnLDYpILdogPxy1"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/b2b_leads~X-Keyword-Mention-Monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-b2b_leads-X-Keyword-Mention-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/b2b_leads~X-Keyword-Mention-Monitor/runs": {
      "post": {
        "operationId": "runs-sync-b2b_leads-X-Keyword-Mention-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/b2b_leads~X-Keyword-Mention-Monitor/run-sync": {
      "post": {
        "operationId": "run-sync-b2b_leads-X-Keyword-Mention-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",
        "properties": {
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Plain terms to watch, auto-combined into OR queries (e.g. \"customer support\", \"data breach\"). Terms starting with # are treated as hashtags and terms starting with $ as cashtags (e.g. #ai, $tsla). Leave empty if you use Queries or Mentions instead.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "queries": {
            "title": "Advanced queries",
            "type": "array",
            "description": "Full X search query strings, passed through verbatim. Supports operators such as min_faves:, lang:, -is:retweet, from:, to:, filter:links, and quoted phrases. Use this for precise control.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "mentions": {
            "title": "Mentions",
            "type": "array",
            "description": "X handles to monitor for mentions, with or without the leading @ (e.g. openai, @nasa). Each handle is added to the watched queries as @handle.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "runMode": {
            "title": "Run mode",
            "enum": [
              "latest",
              "incremental"
            ],
            "type": "string",
            "description": "How this run should behave. \"Latest tweets\" fetches the most recent posts matching your keywords (default — good for one-off runs). \"New since last run\" is for scheduled monitoring: only tweets posted since the previous run are returned, using saved state.",
            "default": "latest"
          },
          "stateKey": {
            "title": "Monitor ID",
            "type": "string",
            "description": "A unique name for this monitor's saved history. The Actor remembers the newest tweet it has seen under this name, so the next scheduled run continues from there. Use one ID per schedule — e.g. brand-monitor, competitor-monitor. Leave as default if you only have one incremental monitor. Ignored when Run mode is Latest tweets.",
            "default": "default"
          },
          "language": {
            "title": "Language filter",
            "type": "string",
            "description": "Optional ISO language code (e.g. en, es, ja). Applied in the query and re-validated after fetch. Leave empty for all languages.",
            "default": ""
          },
          "minLikes": {
            "title": "Minimum likes",
            "minimum": 0,
            "type": "integer",
            "description": "Only keep tweets with at least this many likes. Set 0 to disable. Applied both in the query and re-validated after fetch.",
            "default": 0
          },
          "excludeRetweets": {
            "title": "Exclude retweets",
            "type": "boolean",
            "description": "Exclude retweets from the results.",
            "default": false
          },
          "maxNewPerQuery": {
            "title": "Max tweets per query",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum tweets to return for each query in one run. In \"Latest tweets\" mode this is the number of most recent posts to fetch (default 100). In \"New since last run\" mode this caps how many new tweets are collected per query per run (0 = unlimited within Max items).",
            "default": 100
          },
          "maxItems": {
            "title": "Max items per run",
            "minimum": 0,
            "type": "integer",
            "description": "Global ceiling on total tweets returned across all queries in one run. 0 = unlimited (up to 100,000). Use max tweets per query to cap each keyword individually.",
            "default": 0
          },
          "webhookUrl": {
            "title": "Webhook URL",
            "type": "string",
            "description": "Optional http(s) endpoint. New tweets are POSTed here in per-query JSON batches as they are found. Delivery is best-effort: tweets are always saved to the dataset first, so a webhook failure never loses data.",
            "default": ""
          },
          "webhookBatchSize": {
            "title": "Webhook batch size",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum tweets per webhook POST. Larger batches mean fewer requests; smaller batches mean smaller payloads.",
            "default": 100
          },
          "includeRaw": {
            "title": "Include raw payload",
            "type": "boolean",
            "description": "Attach the untouched upstream payload under a \"raw\" key on each tweet record (for power users). Increases record size.",
            "default": false
          },
          "maxRetries": {
            "title": "Max retries",
            "minimum": 0,
            "type": "integer",
            "description": "Automatic retries on rate limits (429) and server errors (5xx) before giving up on a request.",
            "default": 5
          },
          "retryBaseDelayMs": {
            "title": "Retry base delay (ms)",
            "minimum": 0,
            "type": "integer",
            "description": "Base backoff delay between retries; grows exponentially and is capped by the max delay.",
            "default": 2000
          },
          "retryMaxDelayMs": {
            "title": "Retry max delay (ms)",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum backoff delay between retries.",
            "default": 30000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}