{
  "openapi": "3.0.1",
  "info": {
    "title": "Twitter (X) Media Downloader",
    "description": "Download videos, photos, GIFs, audio and poster images from public Twitter/X posts - no login, no cookies. Works with post links or usernames, supports every video quality, audio-only M4A/MP3, quoted-post media and public signed download links.",
    "version": "1.0",
    "x-build-id": "b2lfr5bXEkHVsmX4j"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/dataspryva~twitter-x-media-downloader/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-dataspryva-twitter-x-media-downloader",
        "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/dataspryva~twitter-x-media-downloader/runs": {
      "post": {
        "operationId": "runs-sync-dataspryva-twitter-x-media-downloader",
        "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/dataspryva~twitter-x-media-downloader/run-sync": {
      "post": {
        "operationId": "run-sync-dataspryva-twitter-x-media-downloader",
        "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": {
          "postUrls": {
            "title": "Post links or IDs",
            "type": "array",
            "description": "Paste links of posts to download media from. Accepts x.com and twitter.com links, i/web/status links, or bare post IDs. Optional if you provide usernames or profile links below.",
            "items": {
              "type": "string"
            }
          },
          "usernames": {
            "title": "Usernames or profile links to scan",
            "type": "array",
            "description": "Scan a profile's media posts and download their photos, videos and GIFs. Type handles with or without @, or paste full profile links. Optional if you provide post links above.",
            "items": {
              "type": "string"
            }
          },
          "maxPostsPerUser": {
            "title": "Maximum media posts to check per username",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "How many of each profile's most recent media posts to look at. Posts without matching media or filtered-out posts are skipped.",
            "default": 20
          },
          "maxItems": {
            "title": "Maximum media files to collect",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Hard cap on dataset rows for the whole run. The actor stops collecting and downloading once this many files are emitted.",
            "default": 100
          },
          "mediaTypes": {
            "title": "Media types to download",
            "type": "array",
            "description": "Choose which kinds of media to download. All types are selected by default.",
            "items": {
              "type": "string",
              "enum": [
                "video",
                "photo",
                "gif"
              ],
              "enumTitles": [
                "Videos",
                "Photos",
                "GIFs"
              ]
            },
            "default": [
              "video",
              "photo",
              "gif"
            ]
          },
          "imageQuality": {
            "title": "Photo quality",
            "enum": [
              "orig",
              "large",
              "medium",
              "small"
            ],
            "type": "string",
            "description": "Quality to use for photos (and video poster images). Original is the full-resolution file posted on X.",
            "default": "orig"
          },
          "videoQuality": {
            "title": "Video quality",
            "enum": [
              "best",
              "2160p",
              "1080p",
              "720p",
              "480p",
              "worst"
            ],
            "type": "string",
            "description": "Preferred video resolution. The actor picks the closest available quality when the exact one is not offered.",
            "default": "best"
          },
          "downloadAllQualities": {
            "title": "Download every video quality",
            "type": "boolean",
            "description": "Emit and download one separate file for every progressive MP4 quality X offers (for example 1080p, 720p, 480p) instead of only the preferred one. Every quality gets its own row, filename and download link.",
            "default": false
          },
          "includePosterImage": {
            "title": "Also save video poster images",
            "type": "boolean",
            "description": "Save the thumbnail/poster image of each video or GIF as an additional photo file.",
            "default": true
          },
          "includeAltText": {
            "title": "Include image alt text",
            "type": "boolean",
            "description": "Attach the alt text (image description) X stores for each photo or video thumbnail to the media row.",
            "default": true
          },
          "audioOnly": {
            "title": "Audio only (extract sound from videos)",
            "type": "boolean",
            "description": "Download only the audio track of videos. Photos and GIFs are skipped. Files are extracted with ffmpeg and file saving is enabled automatically.",
            "default": false
          },
          "audioFormat": {
            "title": "Audio file format",
            "enum": [
              "m4a",
              "mp3"
            ],
            "type": "string",
            "description": "Format used when Audio only is on.",
            "default": "m4a"
          },
          "includeQuotedMedia": {
            "title": "Include media from quoted posts",
            "type": "boolean",
            "description": "Also download the photos, videos and GIFs that appear inside a quoted post (a post embedded in the linked post). Those rows are marked with mediaSource \"quoted post\".",
            "default": true
          },
          "includeMetadata": {
            "title": "Include post and author metadata",
            "type": "boolean",
            "description": "Attach the post text, date, conversation and reply/quote flags, hashtags, mentions, links, like/repost/reply/quote/bookmark/view counts, author name, avatar, verification and follower count, and a derived engagement rate to every downloaded file.",
            "default": true
          },
          "minLikes": {
            "title": "Minimum likes (profile scans)",
            "minimum": 0,
            "maximum": 1000000000,
            "type": "integer",
            "description": "When scanning usernames, skip posts with fewer likes than this. Posts whose like count is unknown are kept. Leave at 0 to keep every post.",
            "default": 0
          },
          "minRetweets": {
            "title": "Minimum reposts (profile scans)",
            "minimum": 0,
            "maximum": 1000000000,
            "type": "integer",
            "description": "When scanning usernames, skip posts with fewer reposts than this. Posts whose repost count is unknown are kept. Leave at 0 to keep every post.",
            "default": 0
          },
          "onlyVerifiedAuthors": {
            "title": "Only verified authors (profile scans)",
            "type": "boolean",
            "description": "When scanning usernames, skip posts whose author is not verified. Posts where verification is unknown are kept.",
            "default": false
          },
          "saveToFile": {
            "title": "Save files and return download links",
            "type": "boolean",
            "description": "Download each file into this run's key-value store and add a public signed download link. Turn off to collect metadata and direct CDN links only.",
            "default": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}