{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Audio Downloader",
    "description": "Extract audio from YouTube videos, Shorts and Music as M4A/AAC or WebM/Opus - no login, no cookies, no API key. Batch up to 10 links per run, per-video timeframe cuts, parallel downloads, never-fail dataset output. JSON API for developers and AI agents. $0.015 per video.",
    "version": "1.0",
    "x-build-id": "Zb504xPqosuwzDhDm"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/utils~youtube-link/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-utils-youtube-link",
        "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/utils~youtube-link/runs": {
      "post": {
        "operationId": "runs-sync-utils-youtube-link",
        "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/utils~youtube-link/run-sync": {
      "post": {
        "operationId": "run-sync-utils-youtube-link",
        "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": {
          "videos": {
            "title": "YouTube videos",
            "maxItems": 10,
            "type": "array",
            "description": "Add one item per video (max 10). Only URL is required — leave timeframe/audioQuality empty to use the global settings below. When filled, overrides the video set. S3 toggle ON = deliver this video to the S3 bucket below (off = store in this run's key-value store).",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "title": "YouTube URL",
                  "description": "Full watch URL or 11-char video id.",
                  "type": "string",
                  "editor": "textfield"
                },
                "timeframe": {
                  "title": "Timeframe",
                  "description": "MM:SS-MM:SS or HH:MM:SS-HH:MM:SS. Empty = full.",
                  "type": "string",
                  "editor": "textfield"
                },
                "audioQuality": {
                  "title": "Audio Quality",
                  "description": "Empty uses the global Audio Quality setting.",
                  "type": "string",
                  "editor": "select",
                  "enum": [
                    "",
                    "best",
                    "high",
                    "medium",
                    "low",
                    "aac",
                    "opus"
                  ],
                  "prefill": ""
                },
                "s3": {
                  "title": "S3 delivery",
                  "description": "Optional. ON = also upload this video to the S3 bucket in the S3 delivery section below. OFF (default) = key-value store only (the main store). Missing/invalid S3 config never fails the run — it falls back to the key-value store.",
                  "type": "boolean",
                  "editor": "checkbox",
                  "default": false
                }
              },
              "required": [
                "url"
              ]
            }
          },
          "timeframe": {
            "title": "Timeframe (optional)",
            "type": "string",
            "description": "Global default. Cut only a portion: MM:SS-MM:SS or HH:MM:SS-HH:MM:SS (e.g. 1:30-3:00). Empty = full."
          },
          "audioQuality": {
            "title": "Audio Quality",
            "enum": [
              "best",
              "high",
              "medium",
              "low",
              "aac",
              "opus"
            ],
            "type": "string",
            "description": "Global default. Audio bitrate preference. high/medium/low cap at ~192/128/64 kbps; aac/opus restrict the container codec.",
            "default": "best"
          },
          "s3": {
            "title": "S3 delivery (optional)",
            "type": "object",
            "description": "OPTIONAL — the key-value store stays the main store. Deliver selected videos straight to your own S3-compatible bucket as well (AWS S3, Cloudflare R2, MinIO, Backblaze B2, ...). Per-video toggle: ON = S3, OFF (default) = key-value store only. Leave this section empty to disable. The bucket must already exist — the actor never creates buckets. A missing/invalid config or a failed upload automatically falls back to the key-value store — it never fails the run.",
            "properties": {
              "endpoint": {
                "title": "Endpoint",
                "description": "e.g. https://s3.us-east-1.amazonaws.com | https://<account>.r2.cloudflarestorage.com | http://<host>:9000 (MinIO)",
                "type": "string",
                "editor": "textfield",
                "prefill": ""
              },
              "bucket": {
                "title": "Bucket",
                "description": "Existing bucket name.",
                "type": "string",
                "editor": "textfield",
                "prefill": ""
              },
              "region": {
                "title": "Region",
                "description": "AWS region (e.g. us-east-1). Most S3-compatible servers accept any value; Cloudflare R2 requires 'auto'.",
                "type": "string",
                "editor": "textfield",
                "prefill": "us-east-1"
              },
              "accessKey": {
                "title": "Access key",
                "description": "Access key id with PutObject permission on the bucket.",
                "type": "string",
                "editor": "textfield",
                "prefill": ""
              },
              "secretKey": {
                "title": "Secret key",
                "description": "Secret access key (stored as run input; anyone with run access can read it).",
                "type": "string",
                "editor": "textfield",
                "prefill": ""
              },
              "publicBaseUrl": {
                "title": "Public base URL (optional)",
                "description": "e.g. https://cdn.example.com — used as the downloadUrl prefix (ends in /<videoId>.<ext>). Empty = path-style object URL from the endpoint (needs a public bucket).",
                "type": "string",
                "editor": "textfield",
                "prefill": ""
              }
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}