You need to let users download a YouTube video or extract audio in a specific format and you need it working this week. By the end of this guide, you’ll have a copy-pasteable request that returns a ready-to-use download job for a specific YouTube URL, plus pragmatic notes to wire it into your media workflow.
What this API does and when to use it
The YouTube Download and Info API on Zyla API Hub gives you a simple HTTP endpoint to request a downloadable version of a YouTube video or audio in a target format. You pass the YouTube URL and the format you want; the API returns a job identifier, a thumbnail image URL, and a progress URL you can use to monitor the job.
Typical use cases:
- Let users download a video in 720p or 1080p for offline use.
- Extract audio tracks (e.g., mp3, m4a, flac, opus, wav) for podcast backfills or voiceover sampling.
- Batch tools that standardize creators’ uploads into a fixed set of deliverables.
Zyla API Hub hosts more than 10,000 public APIs across Media and other categories under one account, one API key, and a subscription + quota model. This API is part of the Media category and focuses on video/audio retrieval.
Getting started on Zyla API Hub
To call this API, open the marketplace listing and subscribe. You’ll get one API key used across Zyla APIs, and you authenticate with an Authorization header. The first API you choose can typically be tried with a 7-day trial or 50 requests—check the listing for what’s available right now.
- Go to the listing: Start 7-day trial on YouTube Download and Info API
- Click Subscribe (or Start Free Trial when available) and copy your API key.
- Use the header Authorization: Bearer YOUR_API_KEY in your requests.
You can explore other Media APIs and categories on Zyla API Hub with the same account and key.
Endpoint: Download
This endpoint requests a downloadable version of the given YouTube URL in a specified format, and returns a job descriptor to track progress.
- Method: GET
- URL: https://zylalabs.com/api/11016/youtube-download-and-info-api/20761/download
- Required query parameters:
- url (string): The YouTube URL. Example: https://www.youtube.com/watch?v=aGSKrC7dGcY (URL-encode in the request).
- format (string): The desired output format.
Supported formats:
- Video: 360p, 480p, 720p, 1080p, 1440p, 2160p
- Audio: mp3, m4a, flac, opus, wav
Notes:
- Audio download links expire after 2 hours.
- This endpoint supports downloading regular videos only.
Official cURL example
curl -s -X GET "https://zylalabs.com/api/11016/youtube-download-and-info-api/20761/download?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DaGSKrC7dGcY&format=720" \
-H "Authorization: Bearer YOUR_API_KEY"
Official example response
{
"success": true,
"id": "2ec15939807689549d3f3115f168be6b9c868105",
"image": "https://i.ytimg.com/vi/aGSKrC7dGcY/hqdefault.jpg",
"progress_url": "https://youtube-api-progress-copy-development.up.railway.app/api/progress?id=2ec15939807689549d3f3115f168be6b9c868105"
}
Field meanings you’ll actually use:
- success: Whether the job was enqueued successfully.
- id: The job identifier; store it to correlate logs and UI state.
- image: A thumbnail you can show in your UI while the job runs.
- progress_url: A URL you can query to check job progress. Use it to drive polling in your frontend or worker. If you expose audio downloads, remember the note about audio links expiring after 2 hours once generated.
Python example using requests
This sample calls the same endpoint with the same parameters as the official cURL, parses the JSON, and prints the job metadata. Keep the Authorization header and the URL exactly as shown when testing that video ID; swap the format to one of the supported values as needed.
import requests
from urllib.parse import quote_plus
API_KEY = "YOUR_API_KEY"
youtube_url = "https://www.youtube.com/watch?v=aGSKrC7dGcY"
format_value = "720" # or "1080p", "mp3", "m4a", "flac", "opus", "wav", etc.
encoded_url = quote_plus(youtube_url)
endpoint = (
"https://zylalabs.com/api/11016/youtube-download-and-info-api/20761/download"
f"?url={encoded_url}&format={format_value}"
)
headers = {
"Authorization": f"Bearer {API_KEY}",
}
resp = requests.get(endpoint, headers=headers, timeout=30)
resp.raise_for_status()
data = resp.json()
# Use fields exactly as returned by the API
print("Success:", data.get("success"))
print("Job ID:", data.get("id"))
print("Thumbnail:", data.get("image"))
print("Progress URL:", data.get("progress_url"))
# Example: if you want to poll the progress_url, keep a short backoff and stop
# when your UI or worker sees the job is complete. The format of progress
# responses is not documented here; design your polling conservatively.
Implementation details that save time
- URL encoding: Always URL-encode the YouTube link for the url parameter. Many failures come from raw ampersands in watch URLs.
- Format strings: For videos, use the listed resolutions (e.g., 720p or 1080p). For audios, use one of mp3, m4a, flac, opus, wav. If your UI has a dropdown, validate against that list before calling.
- Job tracking: Persist the returned id in your database and associate it with the current user/session so that you can restore progress indicators after a page refresh.
- Thumbnails: Use the image field to provide immediate feedback in your UI while the download job runs.
- Audio expiry: Audio download links expire after 2 hours once generated. If your workflow involves delayed retrieval (e.g., email later), either trigger regeneration on demand or instruct users to download promptly.
- Retries: If you implement polling on progress_url, keep your backoff modest to avoid hammering. Cache the latest state in your store to avoid UI flicker.
- Live streams: The endpoint supports regular videos. If users paste live streams, show a validation error before calling the API.
- Subscription + quota: Calls consume your plan’s quota under your subscription; this API is not pay-per-call. Check the listing for current access options. The first API you pick typically offers a 7-day trial or 50 requests.
Common real-world flows
1) “Download as” modal in a web app
- User pastes a YouTube URL and chooses a format (e.g., 1080p video or mp3 audio).
- Your frontend calls your backend, which invokes the Download endpoint with url and format.
- Display the thumbnail from image and show a spinner while you poll progress_url on the server.
- When complete, present the final download link to the user. For audio, show a note about the 2-hour expiry.
2) Batch media library normalization
- Maintain a queue of YouTube URLs and target formats (e.g., all 720p video for previews).
- Call the Download endpoint for each job; store id and progress_url.
- Have a worker poll progress_url to advance job states and post results to cloud storage as they become available.
3) Audio-only ingest pipeline
- Frontend validates that the user selected one of mp3, m4a, flac, opus, wav.
- Start the job via the Download endpoint.
- On completion, immediately trigger downstream transcription or tagging, mindful of the 2-hour expiry window for audio links.
Using this API from an AI agent via MCP
If you prefer to orchestrate calls from an AI agent or an MCP-compatible IDE, you can connect to Zyla’s MCP gateway. MCP-capable clients like Claude Code, Cursor, and Windsurf can call marketplace APIs using your Zyla API key. Review the MCP connection details here: MCP.
- Point your MCP client to the MCP endpoint and provide your Zyla API key.
- In your tool or agent prompt, instruct it to make a GET request to the Download endpoint URL with the url and format parameters, and include the Authorization: Bearer YOUR_API_KEY header.
- Parse success, id, image, and progress_url from the response to drive subsequent actions (e.g., polling or UI updates).
Testing checklist
- Validate YouTube URLs and formats client-side before calling the endpoint.
- Make a test call with 720p video to confirm success, id, image, and progress_url fields are returned as expected.
- Implement basic error handling around HTTP status codes and timeouts.
- Decide where to store job id and how often to poll progress_url.
- If exposing audio outputs, implement a UX hint or reminder around the 2-hour expiry of the resulting audio link.
FAQ
Which formats are supported?
Video: 360p, 480p, 720p, 1080p, 1440p, 2160p. Audio: mp3, m4a, flac, opus, wav.
How do I authenticate?
Include the header Authorization: Bearer YOUR_API_KEY on every request.
Do audio download links expire?
Yes. Audio download links expire after 2 hours once generated. Design your UX accordingly.
Does this support live streams?
This endpoint supports downloading regular videos only.
How is billing handled?
Zyla APIs use a subscription + quota model, not pay-per-call. For current access options (e.g., a 7-day trial or 50 requests for your first API), check the marketplace listing.
Ship it
Subscribe and run the cURL above, then wire the id, image, and progress_url into your job tracker. You can be production-ready today. Start here: Start 7-day trial on YouTube Download and Info API.