YouTube to WAV API
Convert a public YouTube video to WAV with one POST. The response returns a permanent audio download URL and normalized track metadata.
- One POST, One WAV File
- Permanent Download URLs
- PCM Decode, No Second Lossy Pass
- Eight Formats On One Endpoint
- Idempotency Key Support
- Server-Side Key Required
Request examples
curl -X POST "https://api.agentbody.io/v1/youtube/audio/download" \
-H "Authorization: Bearer <YOUR_AGENTBODY_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"bitrate":"source","format":"mp3","url":"YOUR_URL"}'Response examples
Documented responses from the OpenAPI specification.
Retained audio file URL and normalized public track metadata.
{
"audio_url": "https://example.com/audio-dQw4w9WgXcQ.mp3",
"bitrate": "192k",
"channel": "Example Channel",
"duration_seconds": 212,
"file_size_bytes": 3407872,
"format": "mp3",
"thumbnail_url": "https://example.com/thumbnail-dQw4w9WgXcQ",
"title": "Example Track",
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
"video_id": "dQw4w9WgXcQ"
}Features
The youtube.audio_download operation with format=wav converts one public YouTube video into a saved WAV file. Your server holds the API key; the endpoint returns a permanent download URL in a single call.
One POST, One WAV File
Send POST /v1/youtube/audio/download with the video URL and format: "wav". A successful 200 returns video_id, title, channel, duration, audio_url, format, and file_size_bytes — everything an audio pipeline needs.
Permanent Download URLs
The audio_url points to a fully saved file, not an expiring CDN redirect. Download from any server, any IP, at any time — safe for queue workers, media servers, and long-lived references.
PCM Decode, No Second Lossy Pass
WAV output is decoded once into uncompressed PCM and never compressed again. The source stream still limits quality, but nothing is lost on the way out — what editing and sampling workflows need.
Eight Formats On One Endpoint
The format parameter accepts wav, mp3, m4a, aac, flac, opus, vorbis, and alac. One integration covers every audio output your product needs — just change the format value per call.
Idempotency Key Support
Pass an Idempotency-Key header so retries never trigger a second conversion or charge. The gateway deduplicates by key — safe for flaky networks.
Server-Side Key Required
The endpoint requires an AgentBody API key held on your server. Route calls through your backend; never ship the key to a client bundle.
How to use
Integrate YouTube to WAV conversion in three API steps.
Get Your API Key
Create a free AgentBody account and generate an API key from the dashboard.
POST With format=wav
Send POST /v1/youtube/audio/download with the public video URL and "format": "wav". Include an Idempotency-Key header for safe retries.
Receive The Download Link
A 200 returns the permanent WAV URL plus title, channel, duration, and file size. Download directly or hand the URL to your storage pipeline.
Frequently asked questions
How does the YouTube to WAV API work?
Send POST /v1/youtube/audio/download with a public video URL and "format": "wav". The API converts the audio, saves the WAV file, and returns a permanent download URL with normalized metadata.
What is in the response?
video_id, url, title, channel, duration_seconds, audio_url (the permanent WAV download link), thumbnail_url, format ("wav"), bitrate, and file_size_bytes.
Is WAV output lossless?
WAV output is uncompressed PCM with no second lossy pass. The quality ceiling is still the source stream YouTube serves — the API never claims to restore detail that was never there.
What other formats does the endpoint support?
mp3, m4a, wav, aac, flac, opus, vorbis, and alac — all on the same endpoint via the format parameter. One integration covers every output you need.
How am I billed?
Each successful conversion draws a fixed amount from your AgentBody balance at the gateway-governed price. Failures are not billed; the Idempotency-Key header prevents duplicate charges on retries.
Are there length limits?
Videos longer than roughly 25 minutes are declined by an upstream cost guard that keeps each conversion at a predictable fixed price. Split long content or use the API in separate calls per segment.