{
  "openapi": "3.0.1",
  "info": {
    "title": "Twitter Scraper – Tweet Scraper / X Scraper / X.com Scraper",
    "description": "Ultra-fast Twitter Scraper & X.com Tweet Extractor. Scrape tweets, user profiles, replies, media, and search with advanced filters. Extract views, bookmarks, likes, hashtags, and author analytics. Official Pay-Per-Event pricing ($0.30/1,000 tweets) with free guest mode and zero compute costs.",
    "version": "1.0",
    "x-build-id": "5EBcXVLbzME6wsbG2"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/codescraper~x-tweet-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-codescraper-x-tweet-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/codescraper~x-tweet-scraper/runs": {
      "post": {
        "operationId": "runs-sync-codescraper-x-tweet-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/codescraper~x-tweet-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-codescraper-x-tweet-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",
        "properties": {
          "userHandles": {
            "title": "User Handles",
            "type": "array",
            "description": "X (Twitter) handles to scrape posts from without '@' (e.g. 'NASA', 'OpenAI', 'elonmusk').",
            "items": {
              "type": "string"
            }
          },
          "queryTexts": {
            "title": "Search Queries",
            "type": "array",
            "description": "Search queries or hashtags (e.g. 'web scraping', 'artificial intelligence', '#AI lang:en', 'from:NASA since:2024-01-01'). Supports full Twitter advanced search syntax.",
            "items": {
              "type": "string"
            }
          },
          "sourceUrls": {
            "title": "Source URLs",
            "type": "array",
            "description": "List of X (Twitter) URLs to extract data from (e.g. 'https://x.com/NASA', 'https://x.com/NASA/status/1728108619189874825', 'https://x.com/i/lists/123456').",
            "items": {
              "type": "string"
            }
          },
          "threadIds": {
            "title": "Conversation Thread IDs",
            "type": "array",
            "description": "IDs of conversation threads to scrape all replies from (e.g. '1728108619189874825').",
            "items": {
              "type": "string"
            }
          },
          "twitterCookies": {
            "title": "Twitter / X Cookies (JSON or String)",
            "type": "string",
            "description": "Paste your exported X cookies (JSON array from Cookie-Editor, or raw string e.g. 'auth_token=824377ff...; ct0=d68abfb8...')."
          },
          "authToken": {
            "title": "Auth Token (auth_token)",
            "type": "string",
            "description": "Your X 'auth_token' cookie value (e.g. '824377ff3f6f9f1e581df86f2c537c56c80b3d77'). If entered, overrides cookie textarea."
          },
          "ct0": {
            "title": "CSRF Token (ct0)",
            "type": "string",
            "description": "Your X 'ct0' (CSRF token) cookie value (e.g. 'd68abfb81df39f3617f0fad2f1ded925a3d097bc...'). Used with auth_token for secure queries."
          },
          "resultLimit": {
            "title": "Maximum Results",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum number of posts to extract (e.g. 100, 150, 500, 1000). Default is 150 for quick test runs. Leave empty or enter 0 for unlimited results."
          },
          "sortOrder": {
            "title": "Sort Order",
            "enum": [
              "Recent",
              "Popular",
              "Recent + Popular",
              "Media"
            ],
            "type": "string",
            "description": "How to sort the results. 'Recent' orders by newest first. 'Popular' orders by engagement.",
            "default": "Recent"
          },
          "onlyReplies": {
            "title": "Only Replies",
            "type": "boolean",
            "description": "When enabled, extracts only reply posts (comments made to other posts). Note: For the complete dedicated Replies tab (/with_replies), add cookies in the Cookies section; otherwise free Guest mode filters the main timeline.",
            "default": false
          },
          "onlyReposts": {
            "title": "Only Reposts (Retweets)",
            "type": "boolean",
            "description": "When enabled, extracts only reposted / retweeted posts.",
            "default": false
          },
          "onlyMedia": {
            "title": "Only Posts with Media",
            "type": "boolean",
            "description": "When enabled, extracts only posts that contain photos, videos, or GIFs.",
            "default": false
          },
          "contentLanguage": {
            "title": "Post Language",
            "enum": [
              "",
              "en",
              "es",
              "fr",
              "de",
              "it",
              "pt",
              "ja",
              "ko",
              "zh",
              "ar",
              "hi",
              "ru",
              "tr",
              "nl",
              "pl",
              "sv",
              "id",
              "th",
              "vi"
            ],
            "type": "string",
            "description": "Filter posts by language using ISO 639-1 codes (e.g., 'en' for English, 'es' for Spanish)."
          },
          "verifiedAccountsOnly": {
            "title": "Verified Accounts Only",
            "type": "boolean",
            "description": "When enabled, only extracts posts from verified accounts.",
            "default": false
          },
          "premiumSubscribersOnly": {
            "title": "Premium (X Blue) Subscribers Only",
            "type": "boolean",
            "description": "When enabled, only extracts posts from X Premium (formerly Twitter Blue) subscribers.",
            "default": false
          },
          "containsImages": {
            "title": "Must Contain Images",
            "type": "boolean",
            "description": "When enabled, only extracts posts that include image attachments.",
            "default": false
          },
          "containsVideos": {
            "title": "Must Contain Videos",
            "type": "boolean",
            "description": "When enabled, only extracts posts that include video content.",
            "default": false
          },
          "containsLinks": {
            "title": "Must Contain Links",
            "type": "boolean",
            "description": "When enabled, only extracts posts that contain external links.",
            "default": false
          },
          "containsPolls": {
            "title": "Must Contain Polls",
            "type": "boolean",
            "description": "When enabled, only extracts posts that include polls.",
            "default": false
          },
          "quotedPostsOnly": {
            "title": "Quoted Posts Only",
            "type": "boolean",
            "description": "When enabled, only extracts posts that are quote posts.",
            "default": false
          },
          "excludeReposts": {
            "title": "Exclude Reposts (Retweets)",
            "type": "boolean",
            "description": "When enabled, filters out reposted/retweeted content from results.",
            "default": false
          },
          "excludeReplies": {
            "title": "Exclude Replies",
            "type": "boolean",
            "description": "When enabled, filters out reply posts from results.",
            "default": false
          },
          "postedBy": {
            "title": "Posted By (Author)",
            "type": "string",
            "description": "Filter posts by a specific author handle without '@' (e.g. 'NASA', 'OpenAI', 'TechCrunch')."
          },
          "replyingTo": {
            "title": "In Reply To",
            "type": "string",
            "description": "Filter posts that are replies to a specific user without '@' (e.g. 'elonmusk')."
          },
          "mentionsUser": {
            "title": "Mentions User",
            "type": "string",
            "description": "Filter posts that mention a specific user without '@' (e.g. 'ChatGPTapp', 'sama')."
          },
          "minLikes": {
            "title": "Minimum Likes",
            "minimum": 0,
            "type": "integer",
            "description": "Only include posts with at least this many likes/favorites (e.g. 50, 100, 500)."
          },
          "minReposts": {
            "title": "Minimum Reposts",
            "minimum": 0,
            "type": "integer",
            "description": "Only include posts with at least this many reposts/retweets (e.g. 10, 25, 100)."
          },
          "minReplies": {
            "title": "Minimum Replies",
            "minimum": 0,
            "type": "integer",
            "description": "Only include posts with at least this many replies (e.g. 5, 20)."
          },
          "minBookmarks": {
            "title": "Minimum Bookmarks",
            "minimum": 0,
            "type": "integer",
            "description": "Only include posts with at least this many bookmarks (e.g. 10, 50)."
          },
          "minViews": {
            "title": "Minimum Views (Impressions)",
            "minimum": 0,
            "type": "integer",
            "description": "Only include posts with at least this many views/impressions (e.g. 1000, 10000)."
          },
          "minAuthorFollowers": {
            "title": "Minimum Author Followers",
            "minimum": 0,
            "type": "integer",
            "description": "Only include posts from authors with at least this many followers (e.g. 5000, 50000)."
          },
          "fromDate": {
            "title": "From Date",
            "type": "string",
            "description": "Only include posts published on or after this date (format: YYYY-MM-DD, e.g. '2026-01-01')."
          },
          "toDate": {
            "title": "To Date",
            "type": "string",
            "description": "Only include posts published on or before this date (format: YYYY-MM-DD, e.g. '2026-12-31')."
          },
          "nearLocation": {
            "title": "Near Location",
            "type": "string",
            "description": "Filter posts geotagged near a location (e.g. 'New York', 'San Francisco', 'London')."
          },
          "locationRadius": {
            "title": "Location Radius",
            "type": "string",
            "description": "Radius around the location to include (e.g. '15mi', '25km')."
          },
          "geoCoordinates": {
            "title": "Geo Coordinates",
            "type": "string",
            "description": "Filter by coordinates. Format: 'latitude,longitude,radius' (e.g. '37.7749,-122.4194,10mi')."
          },
          "placeId": {
            "title": "Place ID",
            "type": "string",
            "description": "Filter posts tagged with a specific X Place ID (e.g. '5a110d312052166f')."
          },
          "includeUserAnalytics": {
            "title": "Include Author Analytics",
            "type": "boolean",
            "description": "When enabled, includes detailed author profile analytics (follower ratio, account age, verification category).",
            "default": true
          },
          "extractHashtags": {
            "title": "Extract Hashtags Array",
            "type": "boolean",
            "description": "When enabled, extracts all hashtags into a separate array field for easy analysis.",
            "default": true
          },
          "extractMentions": {
            "title": "Extract Mentioned Users Array",
            "type": "boolean",
            "description": "When enabled, extracts all mentioned users into a separate array field.",
            "default": true
          },
          "extractMediaUrls": {
            "title": "Extract Media URLs Array",
            "type": "boolean",
            "description": "When enabled, extracts all media (images, videos, GIFs) direct URLs into a separate array.",
            "default": true
          },
          "extractReplies": {
            "title": "Extract Reply Threads",
            "type": "boolean",
            "description": "When enabled, also extracts replies/conversation threads for each post found.",
            "default": false
          },
          "includeQueryInOutput": {
            "title": "Include Query in Output",
            "type": "boolean",
            "description": "When enabled, adds the search query that found each post to the output data.",
            "default": false
          },
          "outputTransformFunction": {
            "title": "Custom Transform Function",
            "type": "string",
            "description": "Custom JavaScript function to transform each output object. The function receives the post object and should return the transformed data. Example: (post) => ({ text: post.fullText, likes: post.likesCount })"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}