{
  "openapi": "3.0.1",
  "info": {
    "title": "X Media Scraper & Downloader",
    "description": "Extract photo, video and GIF metadata and source URLs from public X (Twitter) posts or profile media tabs: one row per asset with type, dimensions, duration, quality variants, alt text and the parent post. Optional image downloads. No login, no cookies. Pay only for media saved.",
    "version": "1.0",
    "x-build-id": "JukKX3ITUnb7agVWD"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/coregent~x-media-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-coregent-x-media-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/coregent~x-media-scraper/runs": {
      "post": {
        "operationId": "runs-sync-coregent-x-media-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/coregent~x-media-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-coregent-x-media-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": {
          "handles": {
            "title": "Profiles (media tab)",
            "maxItems": 100,
            "type": "array",
            "description": "Public X profiles whose media tab to collect, newest first: a handle (<code>NASA</code> or <code>@NASA</code>) or a profile URL (<code>https://x.com/NASA</code>, <code>https://x.com/NASA/media</code>). Private and suspended accounts are not supported.",
            "default": [
              "NASA"
            ],
            "items": {
              "type": "string"
            }
          },
          "tweetUrls": {
            "title": "Post URLs",
            "maxItems": 1000,
            "type": "array",
            "description": "Public X posts, one per entry: a post URL (<code>https://x.com/elonmusk/status/1808168603721650364</code>) or just the numeric post ID. Each post costs one request whether or not it has media; posts without media are free. A post listed twice runs once.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "Maximum media items",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Stops the whole run after this many saved media rows, across all profiles and posts. Sources share the limit fairly: each gets an equal share, and one with fewer items leaves its share to the others.",
            "default": 10
          },
          "mediaTypes": {
            "title": "Media types",
            "type": "array",
            "description": "Which kinds of media to save. Filtering happens after the data is fetched, so narrowing it reduces rows, not requests.",
            "items": {
              "type": "string",
              "enum": [
                "image",
                "video",
                "gif"
              ],
              "enumTitles": [
                "Photos",
                "Videos",
                "GIFs"
              ]
            },
            "default": [
              "image",
              "video",
              "gif"
            ]
          },
          "since": {
            "title": "Posted since (profiles only)",
            "type": "string",
            "description": "Profiles only: skip media from posts older than this date, and stop paging a profile once a whole page is older. Post URLs are always returned."
          },
          "minWidth": {
            "title": "Minimum width (pixels)",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Skip media narrower than this, when X reports the width. Media without a known width is kept: photos from profiles come without one, so on profiles this filters videos and GIFs only. 0 = no minimum.",
            "default": 0
          },
          "excludeIds": {
            "title": "Skip list (media or post IDs)",
            "type": "array",
            "description": "Media IDs, post IDs or post URLs from earlier runs to leave out. Useful for scheduled runs that should only save new media. Skipped items are not charged.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "includePostMetadata": {
            "title": "Include post details",
            "type": "boolean",
            "description": "Add the parent post's text, language and like, repost, reply, quote and view counts to every row. Costs nothing extra. The post's ID, link, date and author are always included.",
            "default": true
          },
          "preferredQuality": {
            "title": "Preferred quality",
            "enum": [
              "best",
              "large",
              "medium",
              "small"
            ],
            "type": "string",
            "description": "Which file <code>mediaUrl</code> points to. Photos: the image size (<b>Best</b> = original). Videos and GIFs: the MP4 variant (<b>Best</b> and <b>Large</b> = highest bitrate, <b>Medium</b> = middle, <b>Small</b> = lowest). Every video variant is still listed in <code>variants</code>.",
            "default": "best"
          },
          "downloadMedia": {
            "title": "Download images",
            "type": "boolean",
            "description": "Store each saved photo as a file in the run's key-value store, with its key and link on the row. Charged per stored file. <b>Photos only</b>: video and GIF files are not downloaded (their links and variants are on every row). Off by default.",
            "default": false
          },
          "maxDownloadBytes": {
            "title": "Download budget per run (bytes)",
            "minimum": 1,
            "maximum": 2147483648,
            "type": "integer",
            "description": "Stop downloading once the stored files reach this size in total. Rows are still saved, with the reason in <code>downloadError</code>. Default 104857600 (100 MB).",
            "default": 104857600
          },
          "maxFileBytes": {
            "title": "Maximum file size (bytes)",
            "minimum": 1,
            "maximum": 52428800,
            "type": "integer",
            "description": "Skip any single file larger than this. Default 26214400 (25 MB); X photos are usually under 5 MB.",
            "default": 26214400
          },
          "maxPagesPerUser": {
            "title": "Maximum pages per profile",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "Page limit for each profile's media tab (about 20 posts per page). 0 = automatic, sized from Maximum media items.",
            "default": 0
          },
          "maxUpstreamCalls": {
            "title": "Maximum requests per run",
            "minimum": 0,
            "maximum": 100000,
            "type": "integer",
            "description": "Hard limit on data-provider requests in one run, as a cost guardrail. 0 = automatic, sized from your inputs and Maximum media items.",
            "default": 0
          },
          "failOnPartial": {
            "title": "Fail on partial results",
            "type": "boolean",
            "description": "Mark the run as failed when any post or profile failed or the run stopped early. Saved rows are kept either way.",
            "default": false
          },
          "debug": {
            "title": "Debug: save raw pages",
            "type": "boolean",
            "description": "Save the first three raw data-provider responses to the key-value store (DEBUG_RAW_PAGE_1 to 3). For troubleshooting only.",
            "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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}