Skip to content

YouTube to MP3 API

Need to convert YouTube videos to MP3 inside your own app, bot, or backend? A YouTube to MP3 API does it programmatically — no browser and no manual downloads. This guide shows how to get a direct MP3 URL from a YouTube link in a single request with the Tunelio API.

What a YouTube to MP3 API does

Instead of scraping pages or running a local converter, you send a YouTube URL to an endpoint and receive a ready-to-use MP3 download URL hosted on a fast CDN. That keeps your servers light and your response times fast — ideal for Telegram bots, web apps, and automation workflows.

Get an MP3 URL with one request

Call GET /create with quality=mp3. The response url field is a direct, signed CDN link to the MP3 — there is no separate conversion step to wait on.

curl "https://tunelio.dev/create?url=https://youtu.be/dQw4w9WgXcQ&quality=mp3" \
  -H "Authorization: Bearer tnl_your_api_key"
{
  "url": "https://tunelio.dev/tunnel?id=…&sig=…",
  "filename": "Example Video.mp3",
  "quality": "mp3",
  "mode": "audio",
  "file_size_str": "3.29 MB",
  "status": "tunnel"
}

Python

import os, requests

resp = requests.get(
    "https://tunelio.dev/create",
    params={"url": "https://youtu.be/dQw4w9WgXcQ", "quality": "mp3"},
    headers={"Authorization": f"Bearer {os.environ['TUNELIO_KEY']}"},
)
print(resp.json()["url"])  # direct MP3 download URL

Node.js

const res = await fetch(
  "https://tunelio.dev/create?" + new URLSearchParams({
    url: "https://youtu.be/dQw4w9WgXcQ",
    quality: "mp3",
  }),
  { headers: { Authorization: "Bearer " + process.env.TUNELIO_KEY } }
);
const data = await res.json();
console.log(data.url); // direct MP3 download URL

Check the audio size first (optional)

If you want to show the file size before downloading, call GET /info first. Its audioFormat object reports the MP3 container and exact byte size for the video, so you can display "3.29 MB" in your UI before the user taps download.

Why developers choose Tunelio for YouTube to MP3

  • One request, no polling — you get the MP3 URL back directly.
  • Reliable CDN delivery with stable links built for production.
  • Generous free tier — 100 credits on signup, then plans from $9/mo.

Tips for production

Cache the url from each /create response and reuse it until its expiry instead of calling the endpoint on every download — that saves credits when many users request the same track. And because the MP3 link is a plain HTTPS GET, you can hand it straight to a Telegram bot via its sendAudio method or stream it to storage without buffering the whole file in memory.

Next steps

Read the full API documentation for authentication, rate limits, and every parameter, or grab 100 free credits and try the YouTube to MP3 endpoint now.

Frequently asked questions

Is there a free YouTube to MP3 API?

Yes — Tunelio gives 100 free credits on signup so you can test the MP3 endpoint before choosing a plan.

How do I get MP3 instead of video?

Call GET /create with quality=mp3. The response mode will be "audio" and the url field links directly to the MP3 file.

Can I see the MP3 file size before downloading?

Yes. GET /info returns an audioFormat object with the MP3 size in bytes and a human-readable string, so you can show it in your UI first.

Related guides