{
  "openapi": "3.0.1",
  "info": {
    "title": "X (Twitter) Advanced Search Scraper & API",
    "description": "Run up to 25 advanced X/Twitter searches by keywords, hashtags, accounts, dates, media, and engagement. Export structured posts, authors, metrics, media, Cards, quotes, reposts, and X Articles—no login, cookies, API key, or proxy setup.",
    "version": "0.1",
    "x-build-id": "nVYjgI9E4vz3O7gim"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/arjun_code~x-twitter-advanced-search-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-arjun_code-x-twitter-advanced-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/arjun_code~x-twitter-advanced-search-scraper/runs": {
      "post": {
        "operationId": "runs-sync-arjun_code-x-twitter-advanced-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/arjun_code~x-twitter-advanced-search-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-arjun_code-x-twitter-advanced-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": [
          "searchMode",
          "maxPostsPerQuery"
        ],
        "properties": {
          "searchQueries": {
            "title": "Search terms or X queries",
            "maxItems": 25,
            "type": "array",
            "description": "Enter one keyword search or complete X search expression per line. Each line runs as a separate search. Leave this empty when starting with an exact phrase, hashtags, cashtags, or an account field. Up to 25 unique searches are allowed per run.",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "exactPhrase": {
            "title": "Exact phrase",
            "type": "string",
            "description": "Match one exact phrase in the same word order. This field can start a search by itself. Example: artificial intelligence."
          },
          "anyWords": {
            "title": "Any of these words or phrases",
            "type": "array",
            "description": "Enter one word or phrase per line. Posts may match any one of the values (OR). Multi-word values are matched as phrases. Example: ChatGPT and Claude.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          },
          "hashtags": {
            "title": "Hashtags to include",
            "type": "array",
            "description": "Enter hashtags with or without #. Posts may match any one of the hashtags (OR). This field can start a search by itself. Example: AI and MachineLearning.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          },
          "cashtags": {
            "title": "Stock symbols / cashtags",
            "type": "array",
            "description": "Find posts mentioning any of these stock or crypto symbols. Enter symbols with or without $. Multiple symbols are matched with OR. This field can start a search by itself. Example: AAPL and BTC.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          },
          "excludeWords": {
            "title": "Words or phrases to exclude",
            "type": "array",
            "description": "Enter one word or phrase per line. Posts containing any entered value are excluded. This field refines another search and cannot start one by itself. Example: giveaway and promotion.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          },
          "excludeHashtags": {
            "title": "Hashtags to exclude",
            "type": "array",
            "description": "Exclude posts containing any of these hashtags. Enter hashtags with or without #. This field refines another search and cannot start one by itself. Example: sponsored and giveaway.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          },
          "fromUsers": {
            "title": "Posts from accounts",
            "type": "array",
            "description": "Find posts written by any of these X accounts. Example: OpenAI.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          },
          "toUsers": {
            "title": "Replies to accounts",
            "type": "array",
            "description": "Find posts sent as replies to any of these X accounts. Example: OpenAI.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          },
          "mentionUsers": {
            "title": "Posts mentioning accounts",
            "type": "array",
            "description": "Find posts that mention any of these X accounts. Example: OpenAI.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          },
          "excludeFromUsers": {
            "title": "Exclude posts from accounts",
            "type": "array",
            "description": "Exclude posts written by these X accounts. Enter usernames with or without @. This field refines another search and cannot start one by itself.",
            "items": {
              "type": "string",
              "minLength": 1
            },
            "default": []
          },
          "searchMode": {
            "title": "Result order",
            "enum": [
              "Latest",
              "Top"
            ],
            "type": "string",
            "description": "Latest returns recent posts. Top follows X's relevance ranking.",
            "default": "Latest"
          },
          "maxPostsPerQuery": {
            "title": "Posts to save per search (0 = all)",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of unique posts to save for each separate search. Keep 100 for a typical export, or enter 0 to continue until X provides no further result page.",
            "default": 100
          },
          "language": {
            "title": "Post language",
            "enum": [
              "",
              "ar",
              "bn",
              "bg",
              "ca",
              "zh",
              "cs",
              "da",
              "nl",
              "en",
              "fi",
              "fr",
              "de",
              "el",
              "gu",
              "he",
              "hi",
              "hu",
              "id",
              "it",
              "ja",
              "kn",
              "ko",
              "ms",
              "mr",
              "no",
              "fa",
              "pl",
              "pt",
              "ro",
              "ru",
              "sr",
              "sk",
              "es",
              "sv",
              "ta",
              "th",
              "tr",
              "uk",
              "ur",
              "vi"
            ],
            "type": "string",
            "description": "Only return posts X classifies in the selected language. Detection may be less exact for very short or mixed-language posts.",
            "default": ""
          },
          "startDate": {
            "title": "Posted on or after",
            "type": "string",
            "description": "Include posts published on or after this UTC date."
          },
          "endDate": {
            "title": "Posted on or before",
            "type": "string",
            "description": "Include the entire selected UTC date. The Actor converts it to X's exclusive until boundary automatically."
          },
          "postType": {
            "title": "Post type",
            "enum": [
              "any",
              "originals",
              "replies",
              "retweets",
              "quotes"
            ],
            "type": "string",
            "description": "Choose whether to return all posts, original posts, replies, reposts, or quote posts.",
            "default": "any"
          },
          "mediaType": {
            "title": "Media or link requirement",
            "enum": [
              "any",
              "media",
              "images",
              "videos",
              "links"
            ],
            "type": "string",
            "description": "Only return posts containing the selected content type.",
            "default": "any"
          },
          "minLikes": {
            "title": "Minimum likes",
            "minimum": 0,
            "type": "integer",
            "description": "Only return posts with at least this many likes.",
            "default": 0
          },
          "minRetweets": {
            "title": "Minimum reposts",
            "minimum": 0,
            "type": "integer",
            "description": "Only return posts with at least this many reposts.",
            "default": 0
          },
          "minReplies": {
            "title": "Minimum replies",
            "minimum": 0,
            "type": "integer",
            "description": "Only return posts with at least this many replies.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}