Building a workflow around a YouTube video means handling more than a video URL: you need to request a format, keep track of the operation, and account for expiring audio links. This guide shows how to call the YouTube Download and Info API, read its response, and integrate the request into a Python application or an AI-agent workflow.
What you can build
The YouTube Download and Info API provides a Download endpoint for regular videos. You submit a YouTube URL and a format, and the example response includes a success flag, an identifier, an image URL, and a progress URL.
That response is useful for applications that need to initiate a video or audio download workflow while keeping a record of the request. Examples include internal media-processing dashboards, content-management tools, and audio workflows where users select a format for a video they are authorized to process.
The initial response shown below is not itself a media file. Design the application around the returned fields rather than assuming the first request immediately returns a downloadable asset.
Getting started on Zyla API Hub
Open the YouTube Download and Info API listing on Zyla API Hub, create a free account, and select Subscribe or Start Free Trial when available. The marketplace lists more than 10,000 public APIs and uses an API key for endpoint requests.
Access uses a subscription and quota model, not pay-per-call billing. The first API offers a 7-day trial or 50 requests; check the API page for current access options and pricing. Use your key in the Authorization: Bearer YOUR_API_KEY header.
Request a download
The available Download endpoint is a GET request:
https://zylalabs.com/api/11016/youtube-download-and-info-api/20761/download
It requires two query parameters:
url: the YouTube video URL.format: the requested format. The official request below uses720.
The API lists video formats as 360p, 480p, 720p, 1080p, 1440p, and 2160p. Audio formats are mp3, m4a, flac, opus, and wav. For the request below, use the exact format=720 value shown in the listing example.
The endpoint supports regular videos. Audio download links expire after two hours, so an application should not treat an audio link as a permanent stored asset.
Run the request
Replace YOUR_API_KEY with your Zyla API key. The YouTube URL is percent-encoded in the query string so that its own query parameter remains part of the url value.
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"
The listing shows this response for the example request:
{
"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"
}
Use success to inspect the outcome represented in the response and retain id to associate the result with your application’s request. The image field contains an image URL, while progress_url supplies a URL associated with progress. The example does not establish a response shape or polling procedure for that URL, so check the API listing before building subsequent handling around it.
Call the same endpoint from Python
This sample uses Python’s standard library and the same URL and parameters as the official request. It reads the returned fields without assuming that a final media link is present in the initial response.
import json
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
url = (
"https://zylalabs.com/api/11016/youtube-download-and-info-api/20761/download"
"?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DaGSKrC7dGcY&format=720"
)
request = Request(
url,
headers={"Authorization": "Bearer YOUR_API_KEY"},
method="GET",
)
try:
with urlopen(request) as response:
result = json.load(response)
except HTTPError as error:
print("HTTP request failed:", error.code)
except URLError as error:
print("Could not reach the API:", error.reason)
else:
if result.get("success"):
print("Request ID:", result.get("id"))
print("Image URL:", result.get("image"))
print("Progress URL:", result.get("progress_url"))
else:
print("The response did not indicate success:", result)
For an application integration, store the returned identifier alongside your own record of the submitted video and format. Keep the API key on the server or in another protected execution environment rather than placing it in browser-delivered code.
Practical use cases
Content-management review
A content team can submit a regular video URL from an internal dashboard and request a video format for a permitted processing workflow. The application can associate the returned id with its review record and display the returned image alongside it.
Keep the initial request state distinct from a completed download. The example response provides a progress URL, but it does not show a completed-file response or define how to interpret progress.
Audio preparation
An audio workflow can offer the listed mp3, m4a, flac, opus, and wav options for regular videos the user is authorized to process. Make the two-hour audio-link expiry visible in the workflow so users do not mistake a temporary link for a permanent archive.
If users need durable storage, handle that as a separate application concern after confirming how to obtain the resulting asset. Do not rely on a previously saved audio link remaining valid beyond its documented lifetime.
Format selection in a media tool
A developer building a media tool can present the listed video resolutions as choices before submitting a request. Record the selection with the video URL so that operators can distinguish requests made for different outputs.
The listing example uses 720 in the request even though the available video formats are described with a p suffix. Use the documented example as written for this integration, and check the listing for current details before implementing the other choices.
Operational details to plan for
Encode the video URL. A YouTube watch URL has its own query string. When it is passed as the value of url, encode it as shown in the official request; otherwise, parts of that URL can be interpreted as parameters on the Hub request instead.
Separate request creation from completion. The sample contains success, id, image, and progress_url. It does not show a final download URL or a progress response. Preserve the fields you receive and consult the listing for the next step rather than hard-coding an assumed status schema.
Account for temporary audio links. Audio links expire after two hours. A page that stores a link for later use should account for that expiry instead of promising that the same link will still work on a future visit.
Watch your subscription quota. Development requests use the access available under your subscription or trial. Check current access options and quota details on the listing, especially before adding retries or exposing the action to multiple users.
Use videos you are authorized to process. Build any required permissions or review steps into your application before submitting a user-provided URL.
Use the API from an AI agent
Zyla APIs can also be called through the MCP endpoint. It works with Claude Code, Cursor, Windsurf, and other MCP-compatible clients.
Configure your client with the endpoint below, replacing YOUR_API_KEY with your key:
https://mcp.zylalabs.com/mcp?apikey=YOUR_API_KEY
An agent workflow can use the same essential inputs: a regular YouTube video URL and the desired format. Treat the returned identifier and progress URL as the start of the workflow, and have the agent report the fields it receives rather than claiming a download is complete from the initial response alone.
FAQ
What parameters does the Download endpoint require?
It requires url, containing the YouTube video URL, and format. The official example requests format=720.
Does the first response contain the downloaded file?
The example response contains a success flag, an identifier, an image URL, and a progress URL. It does not show the media file or a final download URL.
How long do audio download links last?
Audio download links expire after two hours. Plan the user workflow around that limit.
Can I use the endpoint for a live stream?
The Download endpoint supports regular videos. Check the API listing for current details before designing a workflow for other video types.
Ready to try the request? Create a free Zyla account and Start 7-day trial on YouTube Download and Info API. Check the listing for current access options and pricing, then use your API key with the request above.