YouTube Shorts to MP3 API
One authenticated POST turns any YouTube Shorts URL into a saved MP3 — audio file link plus normalized track metadata as clean JSON.
- One REST Endpoint
- Every Shorts URL Shape
- Format Control
- Normalized Track Metadata
- Idempotent Billable Writes
- Predictable Error Codes
Request examples
curl -X POST "https://api.agentbody.io/v1/youtube/music/download" \
-H "Authorization: Bearer <YOUR_AGENTBODY_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"audio_format":"mp3","region":"YOUR_REGION","url":"YOUR_URL"}'Response examples
Documented responses from the OpenAPI specification.
Retained audio file and normalized public track metadata.
{
"audio_format": "mp3",
"audio_url": "https://example.com/audio.mp3",
"bitrate": 192000,
"bytes": 4194304,
"channel_title": "Example Channel",
"content_type": "audio/mpeg",
"duration_seconds": 180,
"size_mb": 4,
"title": "Example Track",
"url": "https://www.youtube.com/watch?v=Gef1KePPRoI",
"video_id": "Gef1KePPRoI"
}Features
Use the Shorts to MP3 API for sound collection pipelines, podcast tooling, and content workflows — Shorts URL in, audio link out.
One REST Endpoint
Call POST /v1/youtube/music/download with a bearer API key and the Shorts URL. The API saves the audio and returns a retained file link — no stream ripping, no browser automation to maintain.
Every Shorts URL Shape
youtube.com/shorts/ links, youtu.be links, and app share links all resolve through the same request. Your integration accepts whatever users paste without a normalization step.
Format Control
Pass audio_format as mp3, m4a, or webm per request, with an optional region code when availability differs. The response reports the format, bitrate, and size actually delivered.
Normalized Track Metadata
Every response pairs the audio_url with video_id, title, channel, duration, bitrate, and file size — stable fields your pipeline stores without per-request parsing.
Idempotent Billable Writes
Audio saves are metered. Send an Idempotency-Key header on retries so an interrupted response does not double-bill the same Short — repeated identical requests with one key return the original result.
Predictable Error Codes
Documented status codes: 400 invalid request, 401 missing or bad key, 409 idempotency conflict, 502/503/504 temporary upstream issues — each maps to a distinct fix or retry action.
How to use
Follow these steps to call the Shorts to MP3 API: create a key, build the POST request, and process the returned audio link.
Create An API Key
Create an AgentBody account and generate an API key in the console. Keep the key server-side and send it as a bearer token — never in browser code or client bundles.
Build The Request
Send POST /v1/youtube/music/download with the required Shorts url and an optional audio_format (mp3, m4a, webm). The generated examples show the exact request in five languages.
Add An Idempotency Key
Attach an Idempotency-Key header to every conversion you might retry. Repeated identical requests with the same key return the original response without re-billing.
Keep The Key Server-Side
Call the endpoint from your backend, a serverless function, or a scheduled job. If end users trigger conversions, proxy through your own endpoint so the key and billing stay under your control.
Parse The JSON Response
Read the returned audio_url, title, channel, duration, bitrate, and size. Store the link with its metadata, or hand the URL straight to your storage layer.
Handle Errors Correctly
Fix 400 by correcting the request, 401 by configuring a valid key, and follow the documented Idempotency-Key behavior on 409. Retry 502/503/504 with backoff under the same key.
Frequently asked questions
What is the YouTube Shorts to MP3 API?
An authenticated POST endpoint, /v1/youtube/music/download, that saves a public Short's audio as MP3, M4A, or WebM and returns a retained audio file link with normalized metadata — title, channel, duration, bitrate, size — as structured JSON.
Does it accept Shorts URLs directly?
Yes — youtube.com/shorts/VIDEO_ID links resolve natively, alongside youtu.be links and app share links. One request shape covers every Shorts URL format.
How does pricing work?
Each audio save is a metered operation on your account's credits. Pricing is gateway-governed rather than fixed on this page — check the console, and use idempotency keys so retries never double-bill.
What formats can I extract?
mp3 (default), m4a, and webm via the audio_format field. The response confirms the delivered format, bitrate, and file size.
Can it extract audio from private Shorts?
No. The endpoint reads public Shorts only — private, members-only, and removed content will not resolve, and no YouTube credentials are requested.
How do I handle API errors?
Correct the request on 400, fix the bearer key on 401, and follow the documented Idempotency-Key behavior on 409. Treat 502, 503, and 504 as temporary upstream failures and retry with backoff under the same key.