REST · JSON · GET only · free key
YouTube Downloader API for WhatsApp Bots
Send a YouTube link or just a song name and get back an MP3 or MP4 file link as JSON. It is made for .song, .play and .video commands in WhatsApp bots, so you do not have to host yt-dlp or ffmpeg yourself.
Try it in the playground Read the docs
Endpoints
GET /api/download/ytaudio· YouTube MP3: Search or URL to audio. Params:apikey, format, urlGET /api/ytmp3· YouTube MP3: Search or URL to audio. Params:apikey, queryGET /api/download/ytmp4· YouTube MP4: Video by query or URL. Params:apikey, format, urlGET /api/ytmp4· YouTube MP4: Video by query or URL. Params:apikey, queryGET /api/download/ytsearch· YouTube search
Example request
curl "https://knightbotapi.stream/api/download/ytaudio?apikey=knight&format=128kbps&url=https://youtu.be/DTbfw8_SMmI?si=YPUgUhtZSSYvdZ27"
Use it in a WhatsApp bot (Node.js + Baileys)
const axios = require('axios');
const { data } = await axios.get('https://knightbotapi.stream/api/download/ytaudio', {
params: {
"apikey": "knight",
"format": "128kbps",
"url": "https://youtu.be/DTbfw8_SMmI?si=YPUgUhtZSSYvdZ27"
},
});
if (data.success) {
// Baileys: send the file straight to the chat
await sock.sendMessage(jid, { audio: { url: data.result.download }, mimetype: 'audio/mpeg' });
}Response
Check for HTTP 200 and success: true, then read result.download.
{
"status": 200,
"success": true,
"creator": "KnightBot",
"result": {
"title": "…",
"thumbnail": "https://…",
"download": "https://knightbotapi.stream/files/<id>.mp3"
}
}Limits
- Free tier: videos up to 10 minutes and 100MB.
- Audio: 128kbps or 320kbps. Video: 360p, 480p or 720p on the free tier; 1080p needs a premium key.
- Pass url= for a link or query= to search and take the top result.
- Hosted files under /files/ expire after 5 minutes, so send them to the chat right away.
Authentication
Pass your key as ?apikey= or the X-API-Key header. The public demo key knight works for testing; per-key minute, hour and day limits apply, and a blocked request returns 429. See the docs for status codes.