{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Data API v3 Client: Search & Comments",
    "description": "Bring your own Google API key. Query the official YouTube Data API v3: video search, channel uploads, video stats, comments, most popular by country, playlists and duration-filtered search. Not affiliated with or endorsed by YouTube or Google. Privacy policy in the README.",
    "version": "0.1",
    "x-build-id": "McfVv4WPmvtoxNQEx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datawharf-tools~youtube-data-api/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datawharf-tools-youtube-data-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/datawharf-tools~youtube-data-api/runs": {
      "post": {
        "operationId": "runs-sync-datawharf-tools-youtube-data-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/datawharf-tools~youtube-data-api/run-sync": {
      "post": {
        "operationId": "run-sync-datawharf-tools-youtube-data-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": [
          "mode"
        ],
        "properties": {
          "apiKey": {
            "title": "YouTube Data API key",
            "type": "string",
            "description": "Free, takes 2 minutes: Google Cloud Console > APIs & Services > Credentials > Create API key (enable YouTube Data API v3 first). Your OWN API key from Google Cloud Console (APIs & Services > Credentials), with 'YouTube Data API v3' enabled. Do not share it. Leave empty and the run returns a single setup-required row (no data, no result charges). Stored as a secret and never written to the dataset or logs."
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "searchVideos",
              "channel",
              "videoDetails",
              "comments",
              "trending",
              "playlist",
              "searchByDuration"
            ],
            "type": "string",
            "description": "What to fetch. searchVideos = keyword search (1 call from your 100/day search.list quota per 50 results, plus 1 unit per 50 for stats). channel = channel profile plus recent uploads (about 1 unit per 50). videoDetails = stats for specific videos (1 unit per 50). comments = top-level comments of one video (1 unit per 100). trending = YouTube's most popular chart for a country (1 unit per 50, about 200 max). playlist = every video of a playlist with stats (2 units per 50). searchByDuration = keyword search keeping only videos whose reported duration is within your chosen limit (1 search call + 1 unit per 50 candidates).",
            "default": "searchVideos"
          },
          "query": {
            "title": "Search query",
            "type": "string",
            "description": "searchVideos and searchByDuration modes: keywords to search for."
          },
          "order": {
            "title": "Sort order",
            "enum": [
              "relevance",
              "date",
              "viewCount",
              "rating",
              "title"
            ],
            "type": "string",
            "description": "searchVideos and searchByDuration modes: result ordering.",
            "default": "relevance"
          },
          "publishedAfter": {
            "title": "Published after",
            "type": "string",
            "description": "searchVideos and searchByDuration modes: only videos published on/after this date. ISO format, e.g. 2026-01-01 or 2026-01-01T00:00:00Z."
          },
          "publishedBefore": {
            "title": "Published before",
            "type": "string",
            "description": "searchVideos and searchByDuration modes: only videos published before this date (ISO format)."
          },
          "regionCode": {
            "title": "Region code",
            "type": "string",
            "description": "searchVideos and searchByDuration modes: ISO 3166-1 alpha-2 country code, e.g. US, BR, MX. In trending mode this selects the country chart (default US)."
          },
          "videoCategoryId": {
            "title": "Video category ID",
            "type": "string",
            "description": "trending mode: optional numeric YouTube category ID to narrow the chart, e.g. 10 (Music), 20 (Gaming), 24 (Entertainment). Some categories have no chart in some countries and return an error."
          },
          "maxDurationSeconds": {
            "title": "Maximum duration",
            "enum": [
              "60",
              "180"
            ],
            "type": "string",
            "description": "searchByDuration mode: keep videos whose duration, as reported by YouTube, is at most this many seconds. This is a filter you choose; no content type is inferred.",
            "default": "60"
          },
          "onlyWithinMaxDuration": {
            "title": "Only return videos within the limit",
            "type": "boolean",
            "description": "searchByDuration mode: drop search results longer than the limit (they are not charged). Turn off to keep all and get withinMaxDuration true/false on each. Max results counts search candidates, so you may get fewer items than Max results.",
            "default": true
          },
          "relevanceLanguage": {
            "title": "Relevance language",
            "type": "string",
            "description": "searchVideos and searchByDuration modes: ISO 639-1 language code, e.g. en, es, pt."
          },
          "channel": {
            "title": "Channel",
            "type": "string",
            "description": "channel mode: channel ID (UC...), @handle, or channel URL."
          },
          "includeUploads": {
            "title": "Include channel uploads",
            "type": "boolean",
            "description": "channel mode: also return the channel's latest uploads (up to Max results minus 1).",
            "default": true
          },
          "videoIds": {
            "title": "Video IDs or URLs",
            "type": "array",
            "description": "videoDetails mode: list of video IDs or YouTube URLs (11-character IDs). Deleted or private videos are skipped and listed in the QUOTA_REPORT record.",
            "items": {
              "type": "string"
            }
          },
          "videoId": {
            "title": "Video ID or URL",
            "type": "string",
            "description": "comments mode: the video to fetch comments for."
          },
          "playlist": {
            "title": "Playlist ID or URL",
            "type": "string",
            "description": "playlist mode: a playlist ID (PL..., UU... for a channel uploads list) or a URL containing list=. Private and deleted entries are skipped and listed in the QUOTA_REPORT record."
          },
          "includeReplies": {
            "title": "Include replies",
            "type": "boolean",
            "description": "comments mode: include replies shown inline with each thread (the API returns at most 5 replies per thread). Replies count toward Max results.",
            "default": false
          },
          "commentOrder": {
            "title": "Comment order",
            "enum": [
              "relevance",
              "time"
            ],
            "type": "string",
            "description": "comments mode: relevance (top comments) or time (newest).",
            "default": "relevance"
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum number of items to return (all modes). You are charged per item returned. Search modes use 1 search call per page of up to 50 candidates (your default is 100 search calls per day, so about 5,000 candidates per day), and YouTube returns at most about 500 results per query. Trending is limited to about 200 items per chart.",
            "default": 50
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}