Programmatic access to download YouTube videos.
All requests require a valid API token in the Authorization header.
This is the main endpoint to download videos or audio from YouTube.
URL: /api/download
Method: POST
Headers:
Authorization: Bearer <your_api_token>
Content-Type: application/json
Body (JSON):
{
"url": "https://www.youtube.com/watch?v=cNMXSKfWfLQ",
"format": "mp4" // Optional. "mp4" (default), "mp3", "flac"
}
{
"status": "ok",
"url": "/downloads/api_1675234.mp4"
}
The returned URL is temporary and the file is deleted after ~2 minutes.
curl -X POST https://download4yt.live/api/download \
-H "Authorization: Bearer YOUR_TOKEN_HERE" \
-H "Content-Type: application/json" \
-d '{"url":"https://www.youtube.com/watch?v=cNMXSKfWfLQ","format":"flac"}'
format supports: mp4 (video+audio), mp3, flac (audio only).Need help integrating? Check the FFmpeg docs for advanced format options.