{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Video Downloader - Videos, Audio and Metadata",
    "description": "Download permitted YouTube videos or audio to Apify key-value storage from one or more URLs. Duration and file-size caps keep runs bounded, and each row returns metadata plus storage keys.",
    "version": "0.5",
    "x-build-id": "cMA1n3uaGDpabNmS6"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/khadinakbar~youtube-video-downloader/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-khadinakbar-youtube-video-downloader",
        "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/khadinakbar~youtube-video-downloader/runs": {
      "post": {
        "operationId": "runs-sync-khadinakbar-youtube-video-downloader",
        "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/khadinakbar~youtube-video-downloader/run-sync": {
      "post": {
        "operationId": "run-sync-khadinakbar-youtube-video-downloader",
        "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": [
          "videoUrls"
        ],
        "properties": {
          "videoUrls": {
            "title": "YouTube video URLs",
            "type": "array",
            "description": "YouTube video URLs to save, for example https://www.youtube.com/watch?v=dQw4w9WgXcQ. Accepts youtube.com/watch, youtu.be, Shorts and embed links. A playlist link (youtube.com/playlist?list=...) is also accepted and saves the first videos of that playlist, up to the playlist limit below. Channel pages and search words are not supported.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL",
                  "description": "YouTube video URL"
                }
              }
            }
          },
          "downloadMode": {
            "title": "Download mode",
            "enum": [
              "video",
              "audio",
              "metadataOnly"
            ],
            "type": "string",
            "description": "What to save for each link. 'video' saves a playable video file, 'audio' saves audio only, and 'metadataOnly' reads title, channel, counts and available quality without saving a media file (cheapest). Default is video.",
            "default": "video"
          },
          "videoQuality": {
            "title": "Maximum video quality",
            "enum": [
              "360p",
              "480p",
              "720p",
              "1080p",
              "1440p",
              "2160p",
              "best"
            ],
            "type": "string",
            "description": "Maximum video height when downloadMode is video: 360p, 480p, 720p, 1080p, 1440p (2K), 2160p (4K) or best. Defaults to 720p to keep files manageable. Downloads the highest quality YouTube offers up to that limit; it never upscales. 4K files are large, so raise maxFileSizeMb for long videos.",
            "default": "720p"
          },
          "preferredContainer": {
            "title": "Preferred video container",
            "enum": [
              "mp4",
              "webm",
              "any"
            ],
            "type": "string",
            "description": "Preferred container for video downloads. mp4 is the most compatible option, webm keeps YouTube's native formats, and any lets yt-dlp choose. Defaults to mp4. NOT guaranteed if the source does not provide compatible streams.",
            "default": "mp4"
          },
          "audioFormat": {
            "title": "Audio format",
            "enum": [
              "m4a",
              "mp3",
              "best"
            ],
            "type": "string",
            "description": "Audio type when download mode is audio. m4a is fast and widely supported, mp3 is converted for maximum compatibility, best keeps the original audio untouched. Default m4a. Ignored for video and metadata-only.",
            "default": "m4a"
          },
          "maxDurationMinutes": {
            "title": "Max duration in minutes",
            "minimum": 1,
            "maximum": 720,
            "type": "integer",
            "description": "Skip videos longer than this many minutes before any download starts. Skipped videos are not charged. Default 60, allowed 1 to 720.",
            "default": 60
          },
          "maxFileSizeMb": {
            "title": "Max file size in MB",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Skip a video when its file would be larger than this many MB. Skipped videos are not charged. Default 250, allowed 1 to 1000. Lower it when you only need small files.",
            "default": 250
          },
          "includeSubtitles": {
            "title": "Save subtitles (free)",
            "type": "boolean",
            "description": "Also save subtitle files (SRT) for each video when YouTube has them, including automatic captions. Free, no extra charge. Download links appear in the result row under subtitleFiles.",
            "default": false
          },
          "subtitleLanguages": {
            "title": "Subtitle languages",
            "maxItems": 5,
            "type": "array",
            "description": "Language codes for subtitles, for example en, es, fr, de. Used only when 'Save subtitles' is on. Up to 5.",
            "default": [
              "en"
            ],
            "items": {
              "type": "string"
            }
          },
          "maxPlaylistVideos": {
            "title": "Playlist video limit",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "How many videos to take from each playlist link. Default 10, allowed 1 to 50. Each saved video is charged separately.",
            "default": 10
          },
          "maxConcurrency": {
            "title": "Videos at the same time",
            "minimum": 1,
            "maximum": 5,
            "type": "integer",
            "description": "How many videos are processed in parallel. Default 3 is about three times faster than one at a time. Lower it if you use your own cookies.",
            "default": 3
          },
          "includeMetadataJson": {
            "title": "Save raw metadata JSON",
            "type": "boolean",
            "description": "Also save the full detail file (JSON) for each saved video, with a download link in the result. The result row always has the main details already. Default on.",
            "default": true
          },
          "cookiesTxt": {
            "title": "YouTube cookies.txt (optional)",
            "type": "string",
            "description": "Optional Netscape cookies.txt content for videos that require your logged-in YouTube session. Paste only cookies you are allowed to use. Leave empty for public videos. NOT a username or password field."
          },
          "proxyOnlyWhenBlocked": {
            "title": "Use proxy only when YouTube blocks",
            "type": "boolean",
            "description": "Try a direct connection first and use a proxy only when YouTube blocks the request. Faster and cheaper. Turn off to send every request through the proxy below.",
            "default": true
          },
          "tryDatacenterProxy": {
            "title": "Try the cheaper proxy first",
            "type": "boolean",
            "description": "When a direct connection is blocked, try one low-cost proxy request before the residential proxy. Only used when 'Use proxy only when YouTube blocks' is on.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy used only when the direct connection is blocked (or for every request if 'Use proxy only when YouTube blocks' is off). Default is residential, the most reliable. Change only if you know another network works.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          },
          "maxProxyFileSizeMb": {
            "title": "Max file size through a proxy (MB)",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Proxy traffic is billed as platform usage (residential is about $8 per GB), so files fetched through a proxy are capped lower than direct downloads. Default 150 MB. Raise it only if you accept the extra usage cost. Does not apply to direct downloads.",
            "default": 150
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}