{
  "openapi": "3.0.1",
  "info": {
    "title": "🐦 Twitter (X) Search Scraper",
    "description": "Scrape Twitter (X) search results, including tweets, authors, hashtags, engagement metrics, media, timestamps, and URLs. Ideal for brand monitoring, sentiment analysis, trend tracking, market research, lead generation, and social media analytics.",
    "version": "0.1",
    "x-build-id": "cfn2TNVbeMCYOeU9j"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/api-empire~twitter-search-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-api-empire-twitter-search-scraper",
        "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/api-empire~twitter-search-scraper/runs": {
      "post": {
        "operationId": "runs-sync-api-empire-twitter-search-scraper",
        "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/api-empire~twitter-search-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-api-empire-twitter-search-scraper",
        "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": [
          "authToken",
          "csrfToken"
        ],
        "properties": {
          "searchQueries": {
            "title": "🔎 Search queries",
            "type": "array",
            "description": "One or more search terms (bulk supported). Each line is searched separately. Plain text or X advanced-search syntax both work, e.g. <code>ai agents</code> or <code>from:openai filter:videos</code>.",
            "items": {
              "type": "string"
            }
          },
          "tweetsDesired": {
            "title": "🔢 Max tweets per query",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of tweets to collect for each search query.",
            "default": 10
          },
          "repliesDepth": {
            "title": "💬 Replies depth",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "How many levels of replies to scrape. <b>0</b> = no replies, <b>1</b> = tweet + its direct replies, <b>2</b> = replies of replies, etc. Higher values are much slower.",
            "default": 0
          },
          "includeUserInfo": {
            "title": "👤 Include author profile in every tweet",
            "type": "boolean",
            "description": "Attach the full author profile (followers, bio, location, join date, …) to every tweet. Slightly slower but far richer data.",
            "default": true
          },
          "authToken": {
            "title": "🔑 X auth_token cookie (required)",
            "type": "string",
            "description": "Paste your X <code>auth_token</code> cookie (from a logged-in browser session) so the scraper uses your session."
          },
          "csrfToken": {
            "title": "🔑 X ct0 cookie (required)",
            "type": "string",
            "description": "Paste your X <code>ct0</code> (CSRF) cookie that matches the auth_token above."
          },
          "since": {
            "title": "📅 Tweets newer than (since)",
            "pattern": "^$|^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$|^(\\d+)\\s*(day|week|month|year)s?$",
            "type": "string",
            "description": "Oldest date to include, format <code>YYYY-MM-DD</code>. Relative values like <code>1 month</code> or <code>2 days</code> also work."
          },
          "until": {
            "title": "📅 Tweets older than (until)",
            "pattern": "^$|^(\\d{4})-(0[1-9]|1[0-2])-(0[1-9]|[12]\\d|3[01])$|^(\\d+)\\s*(day|week|month|year)s?$",
            "type": "string",
            "description": "Newest date to include, format <code>YYYY-MM-DD</code>. Relative values like <code>1 month</code> also work."
          },
          "minReplies": {
            "title": "↩️ Minimum replies",
            "minimum": 0,
            "type": "integer",
            "description": "Only keep tweets with at least this many replies.",
            "default": 0
          },
          "minRetweets": {
            "title": "🔁 Minimum retweets",
            "minimum": 0,
            "type": "integer",
            "description": "Only keep tweets with at least this many retweets.",
            "default": 0
          },
          "minLikes": {
            "title": "❤️ Minimum likes",
            "minimum": 0,
            "type": "integer",
            "description": "Only keep tweets with at least this many likes.",
            "default": 0
          },
          "fromTheseAccounts": {
            "title": "📤 From these accounts",
            "type": "array",
            "description": "Only tweets authored by these usernames (with or without @).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "toTheseAccounts": {
            "title": "📥 To these accounts",
            "type": "array",
            "description": "Only tweets that are replies to these usernames.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "mentioningTheseAccounts": {
            "title": "📣 Mentioning these accounts",
            "type": "array",
            "description": "Only tweets that mention these usernames.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "nativeRetweets": {
            "title": "🔁 Only native retweets",
            "type": "boolean",
            "description": "Include only native retweets (retweets without comment).",
            "default": false
          },
          "media": {
            "title": "🖼️ Only tweets with media",
            "type": "boolean",
            "description": "Include only tweets that contain media (images, videos, gifs).",
            "default": false
          },
          "images": {
            "title": "🌅 Only tweets with images",
            "type": "boolean",
            "description": "Include only tweets that contain images.",
            "default": false
          },
          "videos": {
            "title": "🎬 Only tweets with videos",
            "type": "boolean",
            "description": "Include only tweets that contain videos.",
            "default": false
          },
          "news": {
            "title": "📰 Only tweets with news",
            "type": "boolean",
            "description": "Include only tweets that contain news links.",
            "default": false
          },
          "verified": {
            "title": "✔️ Only from verified users",
            "type": "boolean",
            "description": "Include only tweets from verified accounts.",
            "default": false
          },
          "nativeVideo": {
            "title": "📹 Only tweets with native video",
            "type": "boolean",
            "description": "Include only tweets that contain native video.",
            "default": false
          },
          "replies": {
            "title": "↩️ Only replies",
            "type": "boolean",
            "description": "Include only tweets that are replies.",
            "default": false
          },
          "links": {
            "title": "🔗 Only tweets with links",
            "type": "boolean",
            "description": "Include only tweets that contain links.",
            "default": false
          },
          "safe": {
            "title": "⚠️ Only sensitive-marked tweets",
            "type": "boolean",
            "description": "Include only tweets marked as potentially sensitive.",
            "default": false
          },
          "quote": {
            "title": "💬 Only quote tweets",
            "type": "boolean",
            "description": "Include only tweets that quote other tweets.",
            "default": false
          },
          "proVideo": {
            "title": "🎥 Only tweets with pro video",
            "type": "boolean",
            "description": "Include only tweets that contain pro video.",
            "default": false
          },
          "excludeNativeRetweets": {
            "title": "🚫🔁 Exclude native retweets",
            "type": "boolean",
            "description": "Exclude native retweets from the results.",
            "default": false
          },
          "excludeMedia": {
            "title": "🚫🖼️ Exclude tweets with media",
            "type": "boolean",
            "description": "Exclude tweets that contain media.",
            "default": false
          },
          "excludeImages": {
            "title": "🚫🌅 Exclude tweets with images",
            "type": "boolean",
            "description": "Exclude tweets that contain images.",
            "default": false
          },
          "excludeVideos": {
            "title": "🚫🎬 Exclude tweets with videos",
            "type": "boolean",
            "description": "Exclude tweets that contain videos.",
            "default": false
          },
          "excludeNews": {
            "title": "🚫📰 Exclude tweets with news",
            "type": "boolean",
            "description": "Exclude tweets that contain news links.",
            "default": false
          },
          "excludeVerified": {
            "title": "🚫✔️ Exclude verified users",
            "type": "boolean",
            "description": "Exclude tweets from verified accounts.",
            "default": false
          },
          "excludeNativeVideo": {
            "title": "🚫📹 Exclude native video",
            "type": "boolean",
            "description": "Exclude tweets that contain native video.",
            "default": false
          },
          "excludeReplies": {
            "title": "🚫↩️ Exclude replies",
            "type": "boolean",
            "description": "Exclude tweets that are replies.",
            "default": false
          },
          "excludeLinks": {
            "title": "🚫🔗 Exclude tweets with links",
            "type": "boolean",
            "description": "Exclude tweets that contain links.",
            "default": false
          },
          "excludeSafe": {
            "title": "🚫⚠️ Exclude sensitive-marked tweets",
            "type": "boolean",
            "description": "Exclude tweets marked as potentially sensitive.",
            "default": false
          },
          "excludeQuote": {
            "title": "🚫💬 Exclude quote tweets",
            "type": "boolean",
            "description": "Exclude tweets that quote other tweets.",
            "default": false
          },
          "excludeProVideo": {
            "title": "🚫🎥 Exclude pro video",
            "type": "boolean",
            "description": "Exclude tweets that contain pro video.",
            "default": false
          },
          "language": {
            "title": "🌍 Tweet language",
            "enum": [
              "any",
              "ar",
              "bn",
              "bg",
              "ca",
              "hr",
              "cs",
              "da",
              "nl",
              "en",
              "fi",
              "fr",
              "de",
              "el",
              "gu",
              "he",
              "hi",
              "hu",
              "id",
              "it",
              "ja",
              "kn",
              "ko",
              "mr",
              "no",
              "fa",
              "pl",
              "pt",
              "ro",
              "ru",
              "sr",
              "zh-cn",
              "sk",
              "sl",
              "es",
              "sv",
              "ta",
              "th",
              "zh-tw",
              "tr",
              "uk",
              "ur",
              "vi"
            ],
            "type": "string",
            "description": "Restrict results to a single language.",
            "default": "any"
          },
          "near": {
            "title": "📍 Near location",
            "type": "string",
            "description": "Search near a location (e.g. a city name)."
          },
          "textLengthLessThan": {
            "title": "✂️ Text length less than",
            "minimum": 1,
            "type": "integer",
            "description": "Keep only tweets whose text is shorter than this many characters."
          },
          "proxyConfiguration": {
            "title": "🛰️ Proxy configuration",
            "type": "object",
            "description": "By default the scraper runs with no proxy and automatically falls back to a datacenter, then a residential proxy if X blocks the connection. Pick RESIDENTIAL here to start (and stay) on residential immediately — recommended for large runs.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}