{
  "openapi": "3.0.1",
  "info": {
    "title": "Twitter (X) Scraper",
    "description": "Collect public X posts, profiles, network members, and trends by region or city. Filter posts by date, language, media, links, and engagement. Save the data to an Apify dataset without X credentials.",
    "version": "6.0",
    "x-build-id": "n6tOUff40trtCBKDY"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/maximedupre~twitter-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-maximedupre-twitter-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/maximedupre~twitter-scraper/runs": {
      "post": {
        "operationId": "runs-sync-maximedupre-twitter-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/maximedupre~twitter-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-maximedupre-twitter-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": [
          "target"
        ],
        "properties": {
          "maxNbItemsToScrape": {
            "title": "Maximum results",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many rows. Leave it empty or use 0 to collect all available results."
          },
          "target": {
            "title": "Result type",
            "enum": [
              "searchPosts",
              "searchProfiles",
              "trendingTopics"
            ],
            "type": "string",
            "description": "Choose the kind of data to collect. Use one result type per run."
          },
          "postDiscoveryMethod": {
            "title": "Find posts by",
            "enum": [
              "searchQuery",
              "directPosts",
              "conversationIds",
              "sourceUrls"
            ],
            "type": "string",
            "description": "Choose one way to find public posts. Values for the other methods are ignored.",
            "default": "searchQuery"
          },
          "searchQuery": {
            "title": "Search query: Queries",
            "minItems": 1,
            "type": "array",
            "description": "Enter one or more search queries. Each entry is one full query, including any spaces or line breaks. Use plain text or X search syntax, such as OpenAI or from:OpenAI. X allows 512 characters per search, and filters use some of them. With default settings, each entry has room for 473 characters. With all four post kinds and default dates, it has room for 490. More filters leave less room. Spaces and line breaks count, and an emoji can count as 2 or more. A search that is too long returns no posts.",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "directPostUrls": {
            "title": "Direct post URLs or IDs: Posts",
            "minItems": 1,
            "type": "array",
            "description": "Add one or more public X or Twitter post URLs or numeric IDs to fetch those exact posts.",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "conversationIds": {
            "title": "Conversation IDs: IDs",
            "minItems": 1,
            "type": "array",
            "description": "Find public posts in these conversations. Open the original post that started each conversation. Copy the digits after /status/ in its URL, not a reply's ID. For example, https://x.com/NASA/status/2110798512795377741 gives 2110798512795377741. To reach the original post, open earlier posts' timestamp links in new tabs if needed.",
            "items": {
              "type": "string",
              "pattern": "^[0-9]+$"
            }
          },
          "postSearchUrls": {
            "title": "Source URLs: URLs",
            "minItems": 1,
            "type": "array",
            "description": "Add complete public X or Twitter search, profile, list, or conversation URLs, such as https://x.com/Alina_with_Ai. Search URLs need q with the search text. Leave f blank or use live or top. Use Search mode to set the order. Leave pf and lf blank. The search text and added filters share a limit of 512 characters. Count the search as you type it, before URL codes such as %20. An emoji can count as 2 or more. A search that is too long returns no posts.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "hashtags": {
            "title": "Hashtags",
            "minItems": 1,
            "type": "array",
            "description": "Keep posts that contain these hashtags. Enter each tag without #. Each tag uses its length plus up to 5 characters of X's 512-character search limit. The main search and all other filters share this limit. Keep the list short, because a search that is too long returns no posts.",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "fromUsers": {
            "title": "From authors",
            "minItems": 1,
            "type": "array",
            "description": "Keep only posts written by these handles. Enter each handle without @.",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "authorVerification": {
            "title": "Author verification",
            "enum": [
              "any",
              "verified",
              "notVerified"
            ],
            "type": "string",
            "description": "Choose whether to include authors with any status, only verified authors, or authors not marked verified.",
            "default": "any"
          },
          "mentions": {
            "title": "Mentioning users",
            "minItems": 1,
            "type": "array",
            "description": "Keep only posts that mention these handles. Enter each handle without @. Each handle uses its length plus up to 5 characters of X's 512-character search limit. The main search and all other filters share this limit. Keep the list short, because a search that is too long returns no posts.",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "toUsers": {
            "title": "Replying to users",
            "minItems": 1,
            "type": "array",
            "description": "Keep only posts addressed to these handles. Enter each handle without @. Each handle uses its length plus up to 7 characters of X's 512-character search limit. The main search and all other filters share this limit. Keep the list short, because a search that is too long returns no posts.",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "searchMode": {
            "title": "Search mode",
            "enum": [
              "latest",
              "top",
              "latestAndTop"
            ],
            "type": "string",
            "description": "Choose how search results are ordered. Latest puts new posts first. Top uses X ranking. Latest + Top runs both and saves each post once.",
            "default": "latest"
          },
          "startDate": {
            "title": "Start date",
            "minLength": 1,
            "type": "string",
            "description": "Only keep posts on or after this date. If you set Start date, it applies along with any since: or until: dates in the query. If you leave Start date blank, each search starts 30 days ago unless a since: date applies to the whole query. An until: date on its own still uses the 30-day start. If you include a time in JSON, use UTC, such as 2026-08-08T17:22:58.797Z."
          },
          "endDate": {
            "title": "End date",
            "minLength": 1,
            "type": "string",
            "description": "Only keep posts on or before this date. If you include a time in JSON, use UTC, such as 2026-08-08T17:22:58.797Z."
          },
          "language": {
            "title": "Language code",
            "minLength": 1,
            "type": "string",
            "description": "Keep posts in this language code, such as en, es, fr, or ja."
          },
          "placeId": {
            "title": "Place ID",
            "minLength": 1,
            "type": "string",
            "description": "Set an X or Twitter place ID. Find a public post with an attached location and copy its location link. Use the ID after /places/, such as 5a110d312052166f from /places/5a110d312052166f. A city name or address is not a place ID. Many posts have no attached location. Copying the link can show the ID even if opening it asks you to sign in."
          },
          "links": {
            "title": "Links",
            "enum": [
              "include",
              "onlyLinks",
              "onlyWithoutLinks"
            ],
            "type": "string",
            "description": "Choose whether matching posts may include links.",
            "default": "include"
          },
          "media": {
            "title": "Media",
            "enum": [
              "include",
              "onlyMedia",
              "onlyImages",
              "onlyVideos"
            ],
            "type": "string",
            "description": "Choose whether matching posts must contain media.",
            "default": "include"
          },
          "postKinds": {
            "title": "Post kinds",
            "minItems": 1,
            "uniqueItems": true,
            "type": "array",
            "description": "Choose one or more post kinds to keep.",
            "items": {
              "type": "string",
              "enum": [
                "originalPosts",
                "quotePosts",
                "replies",
                "reposts"
              ],
              "enumTitles": [
                "Original posts",
                "Quote posts",
                "Replies",
                "Reposts"
              ]
            },
            "default": [
              "originalPosts",
              "quotePosts",
              "replies"
            ]
          },
          "minLikes": {
            "title": "Minimum likes",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only posts with at least this many likes."
          },
          "minReplies": {
            "title": "Minimum replies",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only posts with at least this many replies."
          },
          "minRetweets": {
            "title": "Minimum reposts",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only posts with at least this many reposts."
          },
          "sinceId": {
            "title": "Minimum post ID",
            "minLength": 1,
            "type": "string",
            "description": "Keep posts after this X post ID."
          },
          "maxId": {
            "title": "Maximum post ID",
            "minLength": 1,
            "type": "string",
            "description": "Keep posts at or before this X post ID."
          },
          "profileDiscoveryMethod": {
            "title": "Find profiles by",
            "enum": [
              "searchPhrases",
              "directTargets",
              "followers",
              "following",
              "retweeters"
            ],
            "type": "string",
            "description": "Choose how to find public profiles.",
            "default": "searchPhrases"
          },
          "profileSearchQueries": {
            "title": "Search phrases: Queries",
            "minItems": 1,
            "type": "array",
            "description": "Enter one or more phrases to find public X profiles. A lone @handle or a URL for one profile is searched as the handle. For exact lookup, choose Handles, URLs, or IDs and use Profile targets. Each phrase can use up to 500 bytes. English letters, digits, and spaces use 1 byte each. Accented, Greek, and Cyrillic letters often use 2. Common Chinese, Japanese, and Korean characters use 3. Emoji often use 4 or more. A phrase that is too long returns no profiles.",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "retweeterPostUrlsOrIds": {
            "title": "Post retweeters: Posts",
            "minItems": 1,
            "type": "array",
            "description": "Add one or more public post URLs or IDs. The Actor finds profiles that retweeted them when X exposes that audience.",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "profileLookupTargets": {
            "title": "Profile targets",
            "minItems": 1,
            "type": "array",
            "description": "Add public profile handles, complete profile URLs, or numeric user IDs for Handles, URLs, or IDs, Followers, or Following. Enter handles without @.",
            "items": {
              "type": "string",
              "minLength": 1
            }
          },
          "includeArchivedVerificationHistory": {
            "title": "Include past verification details",
            "type": "boolean",
            "description": "Add past X verification details when available. Under the local pricing configuration, you pay for each profile that gets past entries. This can make the run take much longer. Leave it off to skip past entries. Current verification details and dates are still collected when available.",
            "default": false
          },
          "maxPastVerificationEntriesPerProfile": {
            "title": "Past verification entries per profile",
            "minimum": 0,
            "type": "integer",
            "description": "When Include past verification details is on, save a sample of up to this many past verification entries for each profile, where available. Leave it empty to use 10. Use 0 to collect all available entries. This can take hours for well-known accounts. When the switch is off, no past entries are collected.",
            "default": 10
          },
          "includeUsernameHistory": {
            "title": "Include username history",
            "type": "boolean",
            "description": "Add past handles, known change times, or first and last seen dates, when available. A profile can get a change time on its own. Under the local pricing configuration, you pay for each profile that gets any history. Leave it off to skip it.",
            "default": false
          },
          "maxUsernameHistoryEntriesPerProfile": {
            "title": "Past handles per profile",
            "minimum": 0,
            "type": "integer",
            "description": "When Include username history is on, save up to this many past handles for each profile, where available. Leave it empty to use 10. Use 0 to collect all available handles. When the switch is off, no past handles are collected.",
            "default": 10
          },
          "includeUsernameChangeCount": {
            "title": "Include username change count",
            "type": "boolean",
            "description": "Add how many times the profile changed its handle, when available. The count gives no list of handles. Under the local pricing configuration, you pay for each profile that gets a count. Leave it off to skip it.",
            "default": false
          },
          "includeAccountRegion": {
            "title": "Include account region",
            "type": "boolean",
            "description": "Add the country X shows for the profile and any available accuracy details. Under the local pricing configuration, you pay only when a profile gets a country. Leave it off to skip it.",
            "default": false
          },
          "includeConnectionSource": {
            "title": "Include connection source",
            "type": "boolean",
            "description": "Add the app or web source X shows for the profile, when available. Under the local pricing configuration, you pay for each profile that gets this information. Leave it off to skip it.",
            "default": false
          },
          "trendDiscoveryMethod": {
            "title": "Find trends by",
            "enum": [
              "region",
              "city"
            ],
            "type": "string",
            "description": "Choose a region or cities. Values for the other choice are ignored.",
            "default": "region"
          },
          "trendRegionId": {
            "title": "Region: Location",
            "enum": [
              "1",
              "23424740",
              "23424747",
              "23424748",
              "23424750",
              "23424753",
              "23424765",
              "23424757",
              "23424768",
              "23424775",
              "23424782",
              "23424787",
              "23424796",
              "23424800",
              "23424801",
              "23424802",
              "23424819",
              "23424829",
              "23424824",
              "23424833",
              "23424834",
              "23424848",
              "23424846",
              "23424803",
              "23424852",
              "23424853",
              "23424856",
              "23424860",
              "23424863",
              "23424868",
              "23424870",
              "23424874",
              "23424873",
              "23424901",
              "23424900",
              "23424909",
              "23424916",
              "23424908",
              "23424910",
              "23424898",
              "23424922",
              "23424924",
              "23424919",
              "23424934",
              "23424923",
              "23424925",
              "23424935",
              "23424930",
              "23424936",
              "23424938",
              "23424948",
              "23424942",
              "23424950",
              "23424954",
              "23424957",
              "23424960",
              "23424969",
              "23424976",
              "23424738",
              "23424975",
              "23424977",
              "23424982",
              "23424984"
            ],
            "type": "string",
            "description": "Choose Worldwide or one country for its trend topics.",
            "default": "1"
          },
          "trendListScope": {
            "title": "Region: Trend lists",
            "enum": [
              "newest",
              "recent"
            ],
            "type": "string",
            "description": "Newest list only gets the latest trend list. Recent history gets up to 24 recent lists, counting the newest one, each with its time. The lists come at uneven times, not once each hour, and go back less than a full day. Some lists can repeat the same trends.",
            "default": "newest"
          },
          "trendCities": {
            "title": "City: Cities",
            "minItems": 1,
            "type": "array",
            "description": "Add one or more cities to get their current trends. Enter each city with its country, because city names can repeat across countries. Several hundred cities are covered, but not every city. Each city and country pair must match a covered city. The Actor does not change spelling or pick a close match.",
            "items": {
              "type": "object",
              "properties": {
                "city": {
                  "title": "City",
                  "type": "string",
                  "editor": "textfield",
                  "description": "Enter only the city's name, such as Tokyo. Put the country in the Country field.",
                  "minLength": 1
                },
                "country": {
                  "title": "Country",
                  "type": "string",
                  "editor": "textfield",
                  "description": "Enter the name of the city's country, such as Japan. Do not use a country code such as JP.",
                  "minLength": 1
                }
              },
              "required": [
                "city",
                "country"
              ]
            }
          },
          "transformFunction": {
            "title": "Transform each result",
            "type": "string",
            "description": "Optional JavaScript function that takes one result as item and returns one object. Use fixed rules to change the data. For example: (item) => ({ ...item, label: \"X\" }). Leave empty to keep the original data. This applies to every result type."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}