{
  "openapi": "3.0.1",
  "info": {
    "title": "X.com (Twitter) Tweet Scraper",
    "description": "Scrape tweets from X.com by profile handle, tweet URL, search query (advanced operators), or list. Pay per tweet. Optional add-ons: full author enrichment, thread expansion, media URLs, language detection.",
    "version": "0.0",
    "x-build-id": "l6XdwF89dOCmNdCJu"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/lurkapi~x-twitter-tweet-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-lurkapi-x-twitter-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/lurkapi~x-twitter-tweet-scraper/runs": {
      "post": {
        "operationId": "runs-sync-lurkapi-x-twitter-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/lurkapi~x-twitter-tweet-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-lurkapi-x-twitter-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": {
          "searchQueries": {
            "title": "🔍 Search queries",
            "type": "array",
            "description": "X advanced-search queries. Supports the full operator syntax: from:elonmusk, since:2024-01-01, until:2024-12-31, min_faves:100, min_retweets:50, min_replies:10, lang:en, filter:media, filter:images, filter:videos, filter:links, -filter:replies, -filter:nativeretweets, \"exact phrase\". (Limited to 10 free queries per calendar month for Apify free plans). 📚 [Documentation](https://github.com/igorbrigadir/twitter-advanced-search)",
            "items": {
              "type": "string"
            }
          },
          "handles": {
            "title": "👤 X handles / profile URLs",
            "type": "array",
            "description": "Usernames (e.g. elonmusk) or profile URLs (https://x.com/elonmusk). Scrapes the user's recent tweets. No monthly limit on any plan.",
            "items": {
              "type": "string"
            }
          },
          "tweetUrls": {
            "title": "🔗 Tweet URLs / IDs",
            "type": "array",
            "description": "Specific tweet URLs (https://x.com/user/status/123) or numeric IDs. One tweet per entry. No monthly limit on any plan.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "Max tweets per run",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on total tweets returned across all inputs. Default 100.",
            "default": 100
          },
          "sortBy": {
            "title": "Sort (search queries only)",
            "enum": [
              "Latest",
              "Top",
              "Media"
            ],
            "type": "string",
            "description": "Result sort for search queries. Top = most-engaged first. Latest = chronological. Media = media-only feed. Ignored for handle/tweet-URL inputs.",
            "default": "Latest"
          },
          "dateFrom": {
            "title": "From date",
            "type": "string",
            "description": "Earliest tweet date (YYYY-MM-DD)."
          },
          "dateTo": {
            "title": "To date",
            "type": "string",
            "description": "Latest tweet date (YYYY-MM-DD)."
          },
          "language": {
            "title": "Language",
            "enum": [
              "",
              "en",
              "es",
              "pt",
              "ja",
              "ar",
              "ko",
              "fr",
              "de",
              "id",
              "tr",
              "ru",
              "it",
              "th",
              "hi",
              "nl",
              "pl",
              "sv",
              "zh",
              "vi",
              "fa",
              "ro",
              "uk",
              "he",
              "el",
              "cs",
              "hu",
              "no",
              "da",
              "fi",
              "bg",
              "sk",
              "sl",
              "hr",
              "sr",
              "ms",
              "ca",
              "tl",
              "lv",
              "lt",
              "et",
              "und",
              "qam",
              "qct",
              "qht",
              "qme",
              "qst",
              "zxx"
            ],
            "type": "string",
            "description": "Keep only tweets in this language. Search queries: injected as `lang:<code>`. Handles/tweet URLs: applied as a post-filter. Includes X's non-language pseudo-codes (mentions-only, hashtags-only, media-only, etc).",
            "default": ""
          },
          "minLikes": {
            "title": "Minimum likes",
            "minimum": 0,
            "type": "integer",
            "description": "Drop tweets below this favorite count."
          },
          "minRetweets": {
            "title": "Minimum retweets",
            "minimum": 0,
            "type": "integer",
            "description": "Drop tweets below this retweet count."
          },
          "minReplies": {
            "title": "Minimum replies",
            "minimum": 0,
            "type": "integer",
            "description": "Drop tweets below this reply count."
          },
          "minViews": {
            "title": "Minimum views",
            "minimum": 0,
            "type": "integer",
            "description": "Drop tweets below this view count."
          },
          "onlyVerified": {
            "title": "Only from verified accounts",
            "type": "boolean",
            "description": "Drop tweets from unverified accounts.",
            "default": false
          },
          "excludeReplies": {
            "title": "Exclude replies",
            "type": "boolean",
            "description": "Drop reply tweets.",
            "default": false
          },
          "excludeRetweets": {
            "title": "Exclude retweets",
            "type": "boolean",
            "description": "Drop retweets.",
            "default": false
          },
          "mustHaveMedia": {
            "title": "Must have media",
            "type": "boolean",
            "description": "Keep only tweets with attached photo/video.",
            "default": false
          },
          "mustHaveLink": {
            "title": "Must have link",
            "type": "boolean",
            "description": "Keep only tweets with at least one external link.",
            "default": false
          },
          "enrichAuthors": {
            "title": "Full author enrichment ($)",
            "type": "boolean",
            "description": "For each unique author seen in the run, fetch full profile: followers, following, bio, location, joined date, tweet count, banner, website. Charged per unique author successfully resolved (not per tweet).",
            "default": false
          },
          "expandThreads": {
            "title": "Expand threads ($)",
            "type": "boolean",
            "description": "When a tweet is part of a conversation, fetch all sibling tweets in the thread. Attached as `threadTweets[]` on the parent row. Charged once per unique thread expanded.",
            "default": false
          },
          "extractMedia": {
            "title": "Download media files ($)",
            "type": "boolean",
            "description": "Download every photo and video attached to a tweet into the run's key-value store. Each media[] item gets kvKey + kvUrl (signed public link) + bytes. Files: jpg/png/webp/gif for photos, mp4 for video/animated_gif. Charged once per tweet with ≥1 file downloaded.",
            "default": false
          },
          "detectLanguage": {
            "title": "Language detection ($)",
            "type": "boolean",
            "description": "Local language detection on tweet text (populates `detectedLanguage`). Useful when X did not return a `lang` code. Charged only when detection returned a result.",
            "default": false
          },
          "outputId": {
            "title": "id",
            "type": "boolean",
            "description": "Numeric tweet ID.",
            "default": true
          },
          "outputUrl": {
            "title": "url",
            "type": "boolean",
            "description": "Canonical tweet URL.",
            "default": true
          },
          "outputFullText": {
            "title": "fullText",
            "type": "boolean",
            "description": "Full tweet text (long-form notes never 280-char truncated).",
            "default": true
          },
          "outputCreatedAt": {
            "title": "createdAt",
            "type": "boolean",
            "description": "ISO-8601 creation timestamp.",
            "default": true
          },
          "outputLang": {
            "title": "lang",
            "type": "boolean",
            "description": "Source language as returned by X.",
            "default": true
          },
          "outputReplyCount": {
            "title": "replyCount",
            "type": "boolean",
            "description": "Reply count.",
            "default": true
          },
          "outputRetweetCount": {
            "title": "retweetCount",
            "type": "boolean",
            "description": "Retweet count.",
            "default": true
          },
          "outputLikeCount": {
            "title": "likeCount",
            "type": "boolean",
            "description": "Favorite/like count.",
            "default": true
          },
          "outputQuoteCount": {
            "title": "quoteCount",
            "type": "boolean",
            "description": "Quote-tweet count.",
            "default": true
          },
          "outputBookmarkCount": {
            "title": "bookmarkCount",
            "type": "boolean",
            "description": "Bookmark count.",
            "default": true
          },
          "outputViewCount": {
            "title": "viewCount",
            "type": "boolean",
            "description": "View count (populated for retweets/quoted tweets, unlike some competitors).",
            "default": true
          },
          "outputIsReply": {
            "title": "isReply",
            "type": "boolean",
            "description": "Boolean flag for reply tweets.",
            "default": true
          },
          "outputIsRetweet": {
            "title": "isRetweet",
            "type": "boolean",
            "description": "Boolean flag for retweets.",
            "default": true
          },
          "outputIsQuote": {
            "title": "isQuote",
            "type": "boolean",
            "description": "Boolean flag for quote tweets.",
            "default": true
          },
          "outputConversationId": {
            "title": "conversationId",
            "type": "boolean",
            "description": "Conversation root ID (useful for grouping threads).",
            "default": true
          },
          "outputInReplyTo": {
            "title": "inReplyTo*",
            "type": "boolean",
            "description": "inReplyToTweetId + inReplyToScreenName when the tweet is a reply.",
            "default": true
          },
          "outputMentions": {
            "title": "mentions",
            "type": "boolean",
            "description": "@-mentions array.",
            "default": true
          },
          "outputHashtags": {
            "title": "hashtags",
            "type": "boolean",
            "description": "Hashtags array.",
            "default": true
          },
          "outputUrls": {
            "title": "urls",
            "type": "boolean",
            "description": "Expanded URLs in tweet.",
            "default": true
          },
          "outputMedia": {
            "title": "media",
            "type": "boolean",
            "description": "Media array. Only present when the extractMedia add-on is enabled.",
            "default": true
          },
          "outputAuthor": {
            "title": "author",
            "type": "boolean",
            "description": "Author block (id, screenName, name, profileImageUrl, verification flags).",
            "default": true
          },
          "outputQuotedTweet": {
            "title": "quotedTweet",
            "type": "boolean",
            "description": "Nested quoted-tweet object when present.",
            "default": true
          },
          "outputRetweetedTweet": {
            "title": "retweetedTweet",
            "type": "boolean",
            "description": "Nested retweeted-tweet object when present.",
            "default": true
          },
          "forceFreePlanForTesting": {
            "title": "Force free-plan code path (testing only)",
            "type": "boolean",
            "description": "Internal testing toggle. When true, the free-trial cap activates even if the Apify account is on a paid plan.",
            "default": 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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}