{
  "openapi": "3.0.1",
  "info": {
    "title": "🎬 YouTube Search API",
    "version": "0.1",
    "x-build-id": "U1oAZQcgcHNINyoFH"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapier~youtube-search-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapier-youtube-search-api",
        "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/scrapier~youtube-search-api/runs": {
      "post": {
        "operationId": "runs-sync-scrapier-youtube-search-api",
        "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/scrapier~youtube-search-api/run-sync": {
      "post": {
        "operationId": "run-sync-scrapier-youtube-search-api",
        "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": [
          "searchQueries"
        ],
        "properties": {
          "searchQueries": {
            "title": "🔍 Search Queries (bulk)",
            "uniqueItems": true,
            "type": "array",
            "description": "One or more search keywords or full YouTube results URLs (e.g. https://www.youtube.com/results?search_query=surfing). Each runs as a separate search.",
            "items": {
              "type": "string"
            }
          },
          "maxResults": {
            "title": "🔢 Max Results (per query)",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Maximum number of videos to return per query (1–1000).",
            "default": 10
          },
          "useFilters": {
            "title": "🎛️ Enable Advanced Filters",
            "type": "boolean",
            "description": "Turn on the advanced filtering options below.",
            "default": false
          },
          "order": {
            "title": "↕️ Sort By",
            "enum": [
              "date",
              "rating",
              "relevance",
              "title",
              "videoCount",
              "viewCount"
            ],
            "type": "string",
            "description": "How to sort the results.",
            "default": "relevance"
          },
          "channelType": {
            "title": "📺 Channel Type",
            "enum": [
              "any",
              "show"
            ],
            "type": "string",
            "description": "Type of channel to search for.",
            "default": "any"
          },
          "eventType": {
            "title": "🔴 Event Type",
            "enum": [
              "completed",
              "live",
              "upcoming"
            ],
            "type": "string",
            "description": "Restrict to broadcast type."
          },
          "videoDuration": {
            "title": "⏱️ Video Duration",
            "enum": [
              "any",
              "long",
              "medium",
              "short"
            ],
            "type": "string",
            "description": "Filter by duration (short < 4 min, medium 4–20 min, long > 20 min).",
            "default": "any"
          },
          "videoDefinition": {
            "title": "📺 Video Definition",
            "enum": [
              "any",
              "high",
              "standard"
            ],
            "type": "string",
            "description": "Filter by resolution.",
            "default": "any"
          },
          "videoLicense": {
            "title": "📜 Video License",
            "enum": [
              "any",
              "creativeCommon",
              "youtube"
            ],
            "type": "string",
            "description": "Filter by license.",
            "default": "any"
          },
          "safeSearch": {
            "title": "🛡️ Safe Search",
            "enum": [
              "moderate",
              "none",
              "strict"
            ],
            "type": "string",
            "description": "Whether to include restricted content.",
            "default": "moderate"
          },
          "publishedAfter": {
            "title": "📅 Published After",
            "type": "string",
            "description": "Only videos published after this date (RFC 3339, e.g. 2022-01-01T00:00:00Z)."
          },
          "publishedBefore": {
            "title": "📅 Published Before",
            "type": "string",
            "description": "Only videos published before this date (RFC 3339, e.g. 2022-12-31T23:59:59Z)."
          },
          "regionCode": {
            "title": "🌍 Region Code",
            "type": "string",
            "description": "ISO 3166-1 alpha-2 country code, e.g. US."
          },
          "relevanceLanguage": {
            "title": "🗣️ Relevance Language",
            "type": "string",
            "description": "ISO 639-1 two-letter language code, e.g. en."
          },
          "maxRetries": {
            "title": "🔁 Max Retries",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Retries for any blocked/failed request (also the residential-proxy retry budget).",
            "default": 3
          },
          "maxScrollRetries": {
            "title": "🔁 Max Scroll Retries",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Retries for empty/failed pagination pages.",
            "default": 3
          },
          "proxyConfiguration": {
            "title": "🌐 Proxy Configuration",
            "type": "object",
            "description": "Runs direct (no proxy) first for speed. If YouTube blocks the request it automatically falls back to a datacenter proxy, then sticks to a residential proxy. Pick your preferred datacenter groups/country here.",
            "default": {
              "useApifyProxy": 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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}