{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Search Scraper: Videos & Top Comments",
    "description": "Scrape YouTube search results for any keyword, country and language: rank, title, channel, views, publish date, duration and Shorts flag. Upload-date filter, rank and views changes, only-new videos, plus the top comments of any video. Commenter names off by default. Pay per video.",
    "version": "1.0",
    "x-build-id": "IA6GhowLwucZDf5NL"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/vncntlabs~youtube-search-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-vncntlabs-youtube-search-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/vncntlabs~youtube-search-scraper/runs": {
      "post": {
        "operationId": "runs-sync-vncntlabs-youtube-search-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/vncntlabs~youtube-search-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-vncntlabs-youtube-search-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": {
          "keywords": {
            "title": "Search keywords",
            "type": "array",
            "description": "One per line, e.g. <code>canva tutorial</code>. Each keyword returns the videos in YouTube's search order (up to 50 keywords).",
            "items": {
              "type": "string"
            }
          },
          "maxVideosPerKeyword": {
            "title": "Max videos per keyword",
            "minimum": 1,
            "maximum": 700,
            "type": "integer",
            "description": "Up to 700. YouTube itself usually stops after a few hundred results per search (about 350-400 for a popular keyword), fewer for niche keywords.",
            "default": 50
          },
          "videos": {
            "title": "Video links or IDs (comments)",
            "type": "array",
            "description": "Optional: video links (<code>youtube.com/watch?v=...</code>, <code>youtu.be/...</code>, Shorts) or 11-character IDs. Each gets its top comments (up to 200 videos).",
            "items": {
              "type": "string"
            }
          },
          "country": {
            "title": "Country",
            "enum": [
              "Argentina",
              "Australia",
              "Austria",
              "Bangladesh",
              "Belgium",
              "Brazil",
              "Bulgaria",
              "Canada",
              "Chile",
              "Colombia",
              "Costa Rica",
              "Croatia",
              "Cyprus",
              "Czechia",
              "Denmark",
              "Dominican Republic",
              "Ecuador",
              "Egypt",
              "Estonia",
              "Finland",
              "France",
              "Germany",
              "Greece",
              "Hong Kong",
              "Hungary",
              "Iceland",
              "India",
              "Indonesia",
              "Ireland",
              "Israel",
              "Italy",
              "Japan",
              "Kenya",
              "Kuwait",
              "Latvia",
              "Lithuania",
              "Luxembourg",
              "Malaysia",
              "Malta",
              "Mexico",
              "Morocco",
              "Netherlands",
              "New Zealand",
              "Nigeria",
              "Norway",
              "Pakistan",
              "Peru",
              "Philippines",
              "Poland",
              "Portugal",
              "Puerto Rico",
              "Qatar",
              "Romania",
              "Saudi Arabia",
              "Serbia",
              "Singapore",
              "Slovakia",
              "Slovenia",
              "South Africa",
              "South Korea",
              "Spain",
              "Sweden",
              "Switzerland",
              "Taiwan",
              "Thailand",
              "Turkiye",
              "Ukraine",
              "United Arab Emirates",
              "United Kingdom",
              "United States",
              "Uruguay",
              "Vietnam"
            ],
            "type": "string",
            "description": "Which country's YouTube results to get.",
            "default": "United States"
          },
          "language": {
            "title": "Language (optional)",
            "type": "string",
            "description": "Language code like <code>en</code>, <code>de</code>, <code>pt-BR</code>. Empty = the country's main language."
          },
          "device": {
            "title": "Device",
            "enum": [
              "desktop",
              "mobile"
            ],
            "type": "string",
            "description": "Results as seen on desktop or mobile.",
            "default": "desktop"
          },
          "uploadedWithin": {
            "title": "Uploaded within",
            "enum": [
              "any",
              "hour",
              "today",
              "week",
              "month",
              "year"
            ],
            "type": "string",
            "description": "YouTube's upload-date filter. Videos YouTube mixes in from outside the window are dropped and not charged. (YouTube no longer supports sorting search results by date or views, so a filter is offered instead.)",
            "default": "any"
          },
          "excludeShorts": {
            "title": "Exclude Shorts",
            "type": "boolean",
            "description": "Leave out Shorts (they are not charged; the results page they came on still is).",
            "default": false
          },
          "includePlaylistsAndChannels": {
            "title": "Include playlists and channels",
            "type": "boolean",
            "description": "Also add the playlists and channels in the results as rows (free).",
            "default": false
          },
          "maxCommentsPerVideo": {
            "title": "Max comments per video",
            "minimum": 0,
            "maximum": 700,
            "type": "integer",
            "description": "Top comments per video, up to 700 (YouTube's top-comments order). Default 100 when you add videos, else 0."
          },
          "commentsForTopVideos": {
            "title": "Comments for the top N videos of each search",
            "minimum": 0,
            "maximum": 20,
            "type": "integer",
            "description": "Also get the top comments of the first N videos of every keyword search.",
            "default": 0
          },
          "includeCommenterNames": {
            "title": "Include commenter names",
            "type": "boolean",
            "description": "Off: comments come without names, channel links or avatars (they are personal data). Turn on only if you have a lawful reason to process them.",
            "default": false
          },
          "onlyNewVideos": {
            "title": "Only new videos (monitoring)",
            "type": "boolean",
            "description": "For scheduled runs: returns only videos not seen in earlier runs for the same keyword. The first run returns the current results as a baseline. Results pages are still charged.",
            "default": false
          },
          "monitorId": {
            "title": "Monitor name",
            "type": "string",
            "description": "Optional. With a monitor name, every video also gets its previous rank and views and the change since the last run. History is kept in your Apify account (key-value store 'youtube-search-monitor')."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}