{"version":1,"resources":["https://stabletube.dev/api/download","https://stabletube.dev/api/downloads/:jobId"],"description":"Pay-per-request YouTube video downloads. POST a YouTube URL to start a server-side download; poll with SIWX and receive a temporary StableTube-owned S3 download URL.","instructions":"# StableTube API\n\nBase URL: `https://stabletube.dev`\n\nYouTube downloads as an x402 API. StableTube downloads the video\nserver-side, uploads the final mp4 to S3, and returns a temporary StableTube\ndownload URL. Clients never fetch YouTube or `*.googlevideo.com` URLs and the\nAPI never streams video bytes through Vercel.\n\n## Workflow\n\n```\n1. Optional:  GET /api/info?url=...    # free metadata + available qualities\n2. POST      /api/download              # paid; creates a download job\n3. GET       /api/downloads/{jobId}     # SIWX; poll until complete\n4. Download  downloadUrl to an .mp4 file  # direct S3/CDN download\n```\n\n## Endpoints\n\n- `GET  /api/info?url=...` — free. Title, duration, channel, thumbnails, `availableQualities`.\n- `POST /api/download` — paid. Body: `url`, required `quality` (`360p` | `720p` | `1080p`), required `tier` (`tube-100mb` | `tube-500mb` | `tube-1gb`), `format` (`mp4`), optional `clientRequestId`. Returns `status: \"processing\"` with `jobId`, or `status: \"complete\"` with `downloadUrl`.\n- `GET /api/downloads/{jobId}` — SIWX. Poll or refresh a complete job's temporary `downloadUrl`. The SIWX wallet must match the wallet that paid for the job.\n\n## Quality\n\n`quality` is required and exact. If the requested quality is unavailable, the\ncall aborts with 404 inside the `.paid()` pricing function — you are not\ncharged.\n\n## Tier\n\n`tier` is required and sets both price and max final mp4 size:\n`tube-100mb` ($0.05), `tube-500mb` ($0.10), or `tube-1gb` ($0.20).\nIf the output exceeds the selected tier, the job fails with\n`OUTPUT_TOO_LARGE`.\n\n## Delivery\n\n`downloadUrl` is the final video artifact as a temporary StableTube S3 URL.\nIf the user asked to download or keep the video, immediately fetch\n`downloadUrl` as binary data and save it to a local `.mp4` file. Do not stop\nafter showing the URL. Example:\n\n```bash\ncurl -L \"$downloadUrl\" -o video.mp4\n```\n\nIf `downloadUrl` expires while the object still exists, call\n`GET /api/downloads/{jobId}` again with SIWX for a fresh URL. Do not expect\nupstream YouTube URLs or video bytes from the API response.\n\n## Pricing\n\nFloor $0.05. tiered by maximum output size: tube-100mb $0.05 / tube-500mb $0.10 / tube-1gb $0.20.\n\nSee `/openapi.json` for full request/response schemas.\n"}