{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Scraper",
    "description": "Search videos, get playlists, single videos with comments and all in any language",
    "version": "0.1",
    "x-build-id": "FvqWhnX4qct4DwEg2"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ecommerce_leads~youtube-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ecommerce_leads-youtube-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/ecommerce_leads~youtube-scraper/runs": {
      "post": {
        "operationId": "runs-sync-ecommerce_leads-youtube-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/ecommerce_leads~youtube-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-ecommerce_leads-youtube-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": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "1. Mode — pick what to scrape",
            "enum": [
              "channel",
              "playlist",
              "search",
              "video"
            ],
            "type": "string",
            "description": "Choose one. Then fill in ONLY the fields for that mode below; every other field is ignored.\n\n• Channel — all videos, shorts or streams from a channel\n• Playlist — every video in a playlist\n• Search — search results\n• Single videos — full details for specific videos, with comments",
            "default": "channel"
          },
          "channel": {
            "title": "Channel  ·  REQUIRED for Channel mode",
            "type": "string",
            "description": "REQUIRED IF MODE = CHANNEL. Ignored in every other mode.\n\nAccepts a channel id (UC...), an @username, or a full channel URL.\nExamples: @LinusTechTips · UCXuqSBlHAE6Xw-yeJA0Tunw · https://www.youtube.com/@MrBeast"
          },
          "contentType": {
            "title": "Channel tab  ·  Channel mode only",
            "enum": [
              "videos",
              "shorts",
              "streams"
            ],
            "type": "string",
            "description": "Optional. Used only in Channel mode. Which tab of the channel to scrape. Defaults to Videos.",
            "default": "videos"
          },
          "sortBy": {
            "title": "Channel sort order  ·  Channel mode only",
            "enum": [
              "newest",
              "popular",
              "oldest"
            ],
            "type": "string",
            "description": "Optional. Used only in Channel mode. Popular and Oldest need a channel with enough videos for YouTube to show its filter chips; smaller channels fall back to Newest.",
            "default": "newest"
          },
          "playlistId": {
            "title": "Playlist ID  ·  REQUIRED for Playlist mode",
            "type": "string",
            "description": "REQUIRED IF MODE = PLAYLIST. Ignored in every other mode.\n\nThe id after 'list=' in a playlist URL.\nExample: PLZbbT5o_s2xrwRnXk_yCPtnqqo4_u2YGL"
          },
          "searchQuery": {
            "title": "Search query  ·  REQUIRED for Search mode",
            "type": "string",
            "description": "REQUIRED IF MODE = SEARCH. Ignored in every other mode.\n\nWhat to search YouTube for.\nExample: python tutorial"
          },
          "resultsType": {
            "title": "Search result type  ·  Search mode only",
            "enum": [
              "video",
              "channel",
              "playlist",
              "movie"
            ],
            "type": "string",
            "description": "Optional. Used only in Search mode. What kind of results to return. Defaults to Videos.",
            "default": "video"
          },
          "searchSortBy": {
            "title": "Search sort order  ·  Search mode only",
            "enum": [
              "relevance",
              "upload_date",
              "view_count",
              "rating"
            ],
            "type": "string",
            "description": "Optional. Used only in Search mode. Defaults to Relevance.",
            "default": "relevance"
          },
          "videoIds": {
            "title": "Video IDs or URLs  ·  REQUIRED for Single videos mode",
            "type": "array",
            "description": "REQUIRED IF MODE = SINGLE VIDEOS. Ignored in every other mode.\n\nOne entry per video. Accepts bare ids, watch URLs, youtu.be links or shorts URLs.\nExamples: dQw4w9WgXcQ · https://www.youtube.com/watch?v=dQw4w9WgXcQ · https://youtu.be/dQw4w9WgXcQ",
            "items": {
              "type": "string"
            }
          },
          "commentsPerVideo": {
            "title": "Comments per video  ·  Single videos mode only",
            "minimum": 0,
            "maximum": 200,
            "type": "integer",
            "description": "Optional. Used only in Single videos mode. How many top comments to include with each video. Set 0 to skip comments. Comments are included in the per-video price, so 20 costs the same as 0.",
            "default": 20
          },
          "maxItems": {
            "title": "Max items  ·  all modes",
            "minimum": 1,
            "type": "integer",
            "description": "Optional. Applies to every mode. Stop after this many results. Leave empty to scrape everything the target has.",
            "default": 50
          },
          "language": {
            "title": "Language  ·  all modes",
            "type": "string",
            "description": "Optional. Applies to every mode. Defaults to 'en'.\n\nYouTube returns this locale's version of the data: view counts, dates and subscriber counts are always localised, and titles and descriptions are localised where the creator published a translation.\n\nExamples: en · es · de · fr · pt-BR · ja",
            "default": "en"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}