{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Search Scraper",
    "description": "YouTube Search Scraper — Extract YouTube search results including video titles, URLs, descriptions, channel names, views, upload dates, durations, and engagement metrics. Useful for keyword research, content discovery, competitor analysis, SEO, and video trend monitoring.",
    "version": "0.4",
    "x-build-id": "DXdamu1Xx86AMi8AU"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/socialdataapi~youtube-search-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-socialdataapi-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/socialdataapi~youtube-search-scraper/runs": {
      "post": {
        "operationId": "runs-sync-socialdataapi-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/socialdataapi~youtube-search-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-socialdataapi-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": {
          "queries": {
            "title": "🔎 Search queries",
            "type": "array",
            "description": "One search keyword per line, e.g. 'python programming' or 'best cooking channels'. Each line is searched independently and every result is a video.",
            "items": {
              "type": "string"
            },
            "default": [
              "python programming"
            ]
          },
          "maxResults": {
            "title": "🔢 Max results per query",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum number of videos to return per search query. Each video is extracted in full (views, likes, comment count, tags, full description, channel data), so higher values and more queries take longer and use more proxy bandwidth. Free plan: up to 20 videos per run (all queries together) and 200 per month; paid plans have no limit.",
            "default": 10
          },
          "useFilters": {
            "title": "✅ Enable advanced filters",
            "type": "boolean",
            "description": "Turn on the filters below (sort order, event type, published after/before, duration, definition, license, channel type). When off, results use YouTube's default relevance order with none of those filters applied.",
            "default": false
          },
          "order": {
            "title": "🔃 Sort order",
            "enum": [
              "relevance",
              "date",
              "rating",
              "title",
              "videoCount",
              "viewCount"
            ],
            "type": "string",
            "description": "Result ordering, applied only when advanced filters are enabled. 'Upload date', 'Likes', 'Title' and 'View count' are re-sorted here from the real values returned, so those four are verifiable and deterministic. 'Relevance' keeps YouTube's own ordering. 'Video count' has no meaning for video results and falls back to relevance with a log note.",
            "default": "relevance"
          },
          "eventType": {
            "title": "🎯 Event type",
            "enum": [
              "",
              "live",
              "upcoming",
              "completed"
            ],
            "type": "string",
            "description": "Restrict results to live broadcasts, applied only when advanced filters are enabled. 'Live now' is a real YouTube search filter. 'Upcoming' and 'Completed live stream' are checked after the fact against each video's own details, so fewer than the requested number of results is possible with either.",
            "default": ""
          },
          "publishedAfter": {
            "title": "📅 Published after",
            "type": "string",
            "description": "Only keep videos published on or after this moment. RFC 3339 timestamp, e.g. '2022-01-01T00:00:00Z'. Checked after the fact against each video's own publish date, so fewer than the requested number of results is possible. Applies only when advanced filters are enabled.",
            "default": ""
          },
          "publishedBefore": {
            "title": "📅 Published before",
            "type": "string",
            "description": "Only keep videos published on or before this moment. RFC 3339 timestamp, e.g. '2022-12-31T23:59:59Z'. Checked after the fact against each video's own publish date, so fewer than the requested number of results is possible. Applies only when advanced filters are enabled.",
            "default": ""
          },
          "videoDuration": {
            "title": "🎯 Video duration",
            "enum": [
              "any",
              "short",
              "medium",
              "long"
            ],
            "type": "string",
            "description": "Only include videos in this length band. Applied as YouTube's own search filter; only applies when advanced filters are enabled.",
            "default": "any"
          },
          "videoDefinition": {
            "title": "🎯 Video definition",
            "enum": [
              "any",
              "high",
              "standard"
            ],
            "type": "string",
            "description": "Only include videos of this quality. 'High definition' is a real YouTube search filter; 'Standard definition' has no equivalent filter and is ignored with a log note. Applies only when advanced filters are enabled.",
            "default": "any"
          },
          "videoLicense": {
            "title": "🎯 Video license",
            "enum": [
              "any",
              "creativeCommon",
              "youtube"
            ],
            "type": "string",
            "description": "Only include videos under this license. 'Creative Commons' is a real YouTube search filter; 'Standard YouTube license' has no equivalent filter and is ignored with a log note. Applies only when advanced filters are enabled.",
            "default": "any"
          },
          "channelType": {
            "title": "🔧 Channel type",
            "enum": [
              "any",
              "show"
            ],
            "type": "string",
            "description": "Restrict results by channel type. 'Show' has no equivalent YouTube search filter for keyword search and is ignored with a log note. Applies only when advanced filters are enabled.",
            "default": "any"
          },
          "regionCode": {
            "title": "📍 Region code",
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code that biases search results toward that region, e.g. 'US'. Leave blank to let YouTube decide.",
            "default": ""
          },
          "relevanceLanguage": {
            "title": "🌍 Relevance language",
            "type": "string",
            "description": "ISO 639-1 language code that biases search results toward that language, e.g. 'en'. Leave blank to let YouTube decide.",
            "default": ""
          },
          "safeSearch": {
            "title": "🎯 Safe search",
            "enum": [
              "moderate",
              "none",
              "strict"
            ],
            "type": "string",
            "description": "Content filtering level applied to search results.",
            "default": "moderate"
          },
          "maxRetries": {
            "title": "🔁 Max retries",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many times to retry a single request after a block or server error before giving up on that step.",
            "default": 3
          },
          "maxScrollRetries": {
            "title": "🔁 Max pagination retries",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many times to retry an empty or failed search results page before stopping pagination for that query.",
            "default": 3
          },
          "proxyConfiguration": {
            "title": "🌐 Proxy",
            "type": "object",
            "description": "Your proxy choice is used first. Note: full per-video extraction is bot-walled on datacenter IPs (measured: 0 rows, 'Sign in to confirm you're not a bot'), so if the proxy you select gets blocked, the run escalates to Apify RESIDENTIAL, which is the only exit confirmed to return rows. The log states which proxy each request used."
          },
          "debug": {
            "title": "✅ Verbose logging",
            "type": "boolean",
            "description": "Log additional detail: every retry, plus a line for every video and channel the run fetches, including failures. Useful for troubleshooting.",
            "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}