YouTube to MP3
Convert a public YouTube video to a downloadable MP3 file.
/v1/youtube/to-mp3Send Authorization: Bearer YOUR_API_KEY. Get an API key →
Parameters
Send these fields in a flat JSON body. Add _run to choose execution options.
Provide at least one of: url; video_url.
urlstringOptionalRegular YouTube video URL, youtu.be URL, shorts URL, or video ID for the video to convert. Preferred name; video_url remains supported.
bitratestringOptionalTarget MP3 audio bitrate. Default: "192k". Allowed: "128k", "192k", "256k", "320k".
include_metadatabooleanOptionalWhether to preserve basic video metadata in the conversion workflow. Default: true.
Advanced & compatibility inputs 1
video_urlstringOptionalRegular YouTube video URL, youtu.be URL, shorts URL, or video ID for the video to convert. You can also use url.
Response
Every response describes a run. Read result once run_status is succeeded.
run_id- The run to track. Keep it when contacting support.
run_status- Queued, running, waiting for sign-in, succeeded, or failed. Check this even after an HTTP 200.
status_url- Poll this URL while the run is pending. Keep the same run instead of starting another request.
result- The endpoint’s returned data. The example is illustrative; actual fields may be empty or unavailable.
error- On failure, inspect its code, message, retryable and action fields.
View the complete output schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"description": "Poll the run until it succeeds for a signed MP3 download URL, expiry and conversion statistics.",
"anyOf": [
{
"type": "object",
"properties": {
"success": {
"type": "boolean",
"const": true
},
"export_id": {
"type": "string",
"description": "Export identifier. Poll the run until it succeeds before downloading."
},
"status": {
"type": "string",
"enum": [
"completed",
"pending"
]
},
"file_name": {
"type": "string"
},
"download_url": {
"type": "string",
"description": "Short-lived signed download URL. It can be a pending:// placeholder before the artifact is ready."
},
"download_url_expires_at": {
"type": [
"string",
"null"
]
},
"expires_at": {
"type": [
"string",
"null"
]
},
"video": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"url": {
"type": "string"
},
"title": {
"type": [
"string",
"null"
]
},
"thumbnail_url": {
"type": [
"string",
"null"
]
},
"duration_seconds": {
"type": [
"number",
"null"
]
}
},
"required": [
"id",
"url",
"title",
"duration_seconds"
],
"additionalProperties": false
},
"result_summary": {
"type": "object",
"properties": {
"format": {
"const": "mp3",
"type": "string"
},
"bitrate": {
"type": "string",
"enum": [
"128k",
"192k",
"256k",
"320k"
]
},
"sizeBytes": {
"type": "number"
},
"sourceBytes": {
"type": "number"
},
"durationSeconds": {
"type": [
"number",
"null"
]
},
"title": {
"type": [
"string",
"null"
]
},
"ytDlpVersion": {
"type": [
"string",
"null"
]
}
},
"required": [
"format",
"bitrate",
"sizeBytes",
"sourceBytes",
"durationSeconds",
"title",
"ytDlpVersion"
],
"additionalProperties": false
}
},
"required": [
"success",
"export_id",
"status",
"file_name",
"download_url",
"download_url_expires_at",
"expires_at",
"video",
"result_summary"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"export_id": {
"type": "string"
}
},
"required": [
"export_id"
],
"additionalProperties": false
}
]
}View a polled run response
{
"run_id": "00000000-0000-4000-8000-000000000001",
"task_key": "youtube-to-mp3",
"task_name": "YouTube to MP3",
"run_status": "succeeded",
"status_url": "/v1/runs/00000000-0000-4000-8000-000000000001",
"result": {
"success": true,
"export_id": "id-1",
"status": "completed",
"file_name": "Stylish Shoreditch Loft with Balcony",
"download_url": "https://example.com/item-1",
"download_url_expires_at": "https://example.com/item-1",
"expires_at": "sample",
"video": {
"id": "id-1",
"url": "https://example.com/item-1",
"title": "Stylish Shoreditch Loft with Balcony",
"thumbnail_url": "https://images.example.com/thumbnail_url-1.jpg",
"duration_seconds": 1.5
},
"result_summary": {
"format": "mp3",
"bitrate": "128k",
"sizeBytes": 1.5,
"sourceBytes": 1.5,
"durationSeconds": 1.5,
"title": "Stylish Shoreditch Loft with Balcony",
"ytDlpVersion": "sample"
}
},
"error": null
}Errors & retries
400Fix the fields listed inerrorsbefore retrying.428Connect the requested website account using the returned sign-in link.429Wait for the duration inRetry-After.5xxRetry transient failures with backoff. Keep the request ID.
A failed run has its own error inside the response. Retry it only when error.retryable is true.
More examples
Async request with polling
RUN=$(curl -s -X POST "https://api-ingress-worker-staging.browsable-staging.workers.dev/v1/youtube/to-mp3" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ"}')
RUN_ID=$(echo "$RUN" | jq -er '.run_id // empty') || { echo "$RUN" >&2; exit 1; }
POLL_DELAY=3
while true; do
RESULT=$(curl -s -H "Authorization: Bearer YOUR_API_KEY" "https://api-ingress-worker-staging.browsable-staging.workers.dev/v1/runs/$RUN_ID")
STATUS=$(echo "$RESULT" | jq -r '.run_status')
if [[ "$STATUS" =~ ^(succeeded|failed|errored|cancelled|canceled|expired)$ ]]; then
echo "$RESULT"
break
fi
sleep "$(awk "BEGIN { print $POLL_DELAY * (0.9 + ($RANDOM % 21) / 100) }")"
POLL_DELAY=$((POLL_DELAY < 30 ? POLL_DELAY * 2 : 30))
[ "$POLL_DELAY" -gt 30 ] && POLL_DELAY=30
doneWait-for-results request
curl -X POST "https://api-ingress-worker-staging.browsable-staging.workers.dev/v1/youtube/to-mp3" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","_run":{"async":false}}'Canonical & compatibility routes
You can also send the same JSON body to /v1/tasks/youtube-to-mp3/runs.