{
  "openapi": "3.0.1",
  "info": {
    "title": "Twitter Comments & Replies Scraper — X Thread Extractor",
    "description": "Ultra-fast Twitter (X) comments and replies scraper at $0.20/1k replies. Extract all replies, nested conversation threads, author analytics, metrics, media attachments, and timestamps from any X/Twitter post URL or Tweet ID. Includes 1-click English translation.",
    "version": "1.0",
    "x-build-id": "2z2rIykYIrP6YxD2Y"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/codescraper~twitter-comments-replies-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-codescraper-twitter-comments-replies-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~twitter-comments-replies-scraper/runs": {
      "post": {
        "operationId": "runs-sync-codescraper-twitter-comments-replies-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~twitter-comments-replies-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-codescraper-twitter-comments-replies-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": [
          "postUrls"
        ],
        "properties": {
          "postUrls": {
            "title": "Target Post URLs or IDs",
            "type": "array",
            "description": "List of X/Twitter post URLs or numeric IDs to scrape comments and conversation replies from.",
            "items": {
              "type": "string"
            }
          },
          "maxRepliesPerPost": {
            "title": "Max Replies Per Post",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum number of comments to extract per individual post. Leave empty or set to 0 for unlimited.",
            "default": 200
          },
          "resultLimit": {
            "title": "Global Maximum Results",
            "minimum": 1,
            "type": "integer",
            "description": "Total maximum comments/replies to extract across all posts combined. Leave empty for unlimited.",
            "default": 500
          },
          "includeFocalPost": {
            "title": "Include Original (Focal) Post in Dataset",
            "type": "boolean",
            "description": "When enabled, also saves the main original parent tweet in your dataset (marked with isFocalPost: true) alongside its replies.",
            "default": true
          },
          "sortOrder": {
            "title": "Reply Sort Order",
            "enum": [
              "Relevant",
              "Latest",
              "Top"
            ],
            "type": "string",
            "description": "Preferred sorting order for conversation replies.",
            "default": "Relevant"
          },
          "minLikes": {
            "title": "Minimum Likes on Comment",
            "minimum": 0,
            "type": "integer",
            "description": "Only include replies with at least this many likes (favorites)."
          },
          "minViews": {
            "title": "Minimum Views (Impressions)",
            "minimum": 0,
            "type": "integer",
            "description": "Only include replies with at least this many views/impressions."
          },
          "containsImages": {
            "title": "Must Contain Images",
            "type": "boolean",
            "description": "When enabled, only extracts replies that include photo attachments.",
            "default": false
          },
          "containsVideos": {
            "title": "Must Contain Videos / GIFs",
            "type": "boolean",
            "description": "When enabled, only extracts replies that include video or animated GIF attachments.",
            "default": false
          },
          "containsLinks": {
            "title": "Must Contain External Links",
            "type": "boolean",
            "description": "When enabled, only extracts replies that contain outbound links.",
            "default": false
          },
          "verifiedAccountsOnly": {
            "title": "Verified Commenters Only",
            "type": "boolean",
            "description": "When enabled, only extracts replies from verified or Premium (X Blue) accounts.",
            "default": false
          },
          "contentLanguage": {
            "title": "Comment Language",
            "enum": [
              "",
              "en",
              "es",
              "fr",
              "de",
              "it",
              "pt",
              "ja",
              "ko",
              "zh",
              "ar",
              "hi",
              "ru",
              "tr",
              "nl",
              "pl",
              "id"
            ],
            "type": "string",
            "description": "Filter replies by ISO 639-1 language code (e.g. 'en' for English, 'es' for Spanish, 'fr' for French, 'ja' for Japanese)."
          },
          "translateToEnglish": {
            "title": "🌐 Translate Comments to English",
            "type": "boolean",
            "description": "Automatically translates foreign-language comments and replies into English (matching the 'Translate post' feature on X). Preserves the original text in 'originalText' and marks 'isTranslated: true'.",
            "default": false
          },
          "includeUserAnalytics": {
            "title": "Include Author Analytics",
            "type": "boolean",
            "description": "When enabled, includes detailed commenter profile analytics (follower ratio, account age in days, 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, high-bitrate video MP4s, GIFs) into a clean array.",
            "default": true
          },
          "outputTransformFunction": {
            "title": "Custom Transform Function",
            "type": "string",
            "description": "Custom JavaScript function to transform each output object. The function receives the comment record and returns transformed data. Example: (item) => ({ text: item.fullText, author: item.authorHandle, likes: item.likesCount })"
          },
          "twitterCookies": {
            "title": "Twitter / X Cookies (JSON or String)",
            "type": "string",
            "description": "Paste exported cookies from Cookie-Editor (JSON array) or raw header string ('auth_token=...; ct0=...')."
          },
          "authToken": {
            "title": "auth_token (Optional Individual Cookie)",
            "type": "string",
            "description": "Your 40-character Twitter auth_token from Application > Cookies."
          },
          "csrfToken": {
            "title": "ct0 / CSRF Token (Optional Individual Cookie)",
            "type": "string",
            "description": "Your Twitter ct0 CSRF token string from Application > Cookies."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}