Overview
Our YouTube MP3 converter API provides developers with programmatic access to our high-quality audio conversion service. Whether you're building a mobile app, web application, or desktop software, our API allows you to integrate YouTube to MP3 conversion seamlessly into your projects.
Key Features
- High-quality YouTube to MP3 conversion
- RESTful API design
- JSON request and response format
- Rate limiting and fair usage policies
- Comprehensive error handling
- Secure HTTPS endpoints
Getting Started
API Access
Currently, our YouTube MP3 converter API is available for evaluation and limited use. For production access or higher rate limits, please contact our business development team.
Base URL
https://ytmp3down.com/apiAuthentication
API authentication is currently being developed. The current version allows limited unauthenticated requests for evaluation purposes. Production API access will require API key authentication.
API Endpoints
Convert YouTube Video to MP3
Convert a YouTube video to MP3 format using our YouTube MP3 converter API.
Endpoint
POST /api/convertRequest Headers
Content-Type: application/json User-Agent: YourApp/1.0
Request Body
{
"url": "https://www.youtube.com/watch?v=VIDEO_ID"
}Request Parameters
- url (required): Valid YouTube video URL
Response
{
"success": true,
"title": "Video Title",
"downloadUrl": "https://download-link.com/file.mp3",
"cover": "https://thumbnail-url.jpg",
"duration": 240,
"format": "MP3",
"filesize": 3856974
}Download Audio File
Download the converted MP3 file.
Endpoint
GET /api/downloadQuery Parameters
- url (required): Download URL from convert response
Response
Binary MP3 file data with appropriate headers for download.
Stream Audio File
Stream the converted MP3 file directly.
Endpoint
GET /api/streamQuery Parameters
- url (required): Audio file URL
- filename (optional): Custom filename for download
Response
Streaming MP3 file with appropriate headers for audio playback.
Error Handling
HTTP Status Codes
Our YouTube MP3 converter API uses standard HTTP status codes:
- 200 OK: Request successful
- 400 Bad Request: Invalid request parameters
- 404 Not Found: Resource not found
- 429 Too Many Requests: Rate limit exceeded
- 500 Internal Server Error: Server error
Error Response Format
{
"error": "Error message describing what went wrong"
}Common Error Messages
- YouTube URL is required: Missing or empty URL parameter
- Invalid YouTube URL: URL is not a valid YouTube video link
- No audio found for this video: Video cannot be processed
- Failed to convert video: Conversion process failed
- Download URL is required: Missing download URL parameter
Rate Limiting
To ensure fair usage and maintain service quality, our YouTube MP3 converter API implements rate limiting:
- Free tier: 10 requests per minute
- Burst limit: 50 requests per hour
- Daily limit: 500 requests per day
Rate limit information is included in response headers:
X-RateLimit-Limit: 10 X-RateLimit-Remaining: 9 X-RateLimit-Reset: 1640995200
Usage Examples
JavaScript/Node.js Example
// Convert YouTube video to MP3
const response = await fetch('https://ytmp3down.com/api/convert', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'
})
});
const result = await response.json();
console.log(result);
// Download the MP3 file
if (result.success) {
const downloadResponse = await fetch('/api/download', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: result.downloadUrl
})
});
const blob = await downloadResponse.blob();
// Handle the MP3 file blob
}Python Example
import requests
# Convert YouTube video to MP3
url = "https://ytmp3down.com/api/convert"
data = {
"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
response = requests.post(url, json=data)
result = response.json()
print(result)
# Download the MP3 file
if result.get('success'):
download_url = result['downloadUrl']
download_response = requests.get(f"https://ytmp3down.com/api/stream?url={download_url}")
with open('audio.mp3', 'wb') as f:
f.write(download_response.content)cURL Example
# Convert YouTube video to MP3
curl -X POST https://ytmp3down.com/api/convert \
-H "Content-Type: application/json" \
-d '{"url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"}'
# Download the MP3 file
curl -X GET "https://ytmp3down.com/api/stream?url=DOWNLOAD_URL" \
-o audio.mp3Best Practices
URL Validation
Always validate YouTube URLs before sending requests:
- Ensure URLs contain 'youtube.com/watch' or 'youtu.be/'
- Remove playlist parameters for single video conversion
- Handle shortened URLs and mobile URLs properly
Error Handling
Implement proper error handling in your applications:
- Check response status codes
- Parse error messages for user-friendly feedback
- Implement retry logic for temporary failures
- Respect rate limits and implement backoff strategies
Performance Optimization
Optimize your API usage for better performance:
- Cache conversion results when possible
- Use appropriate timeouts for requests
- Implement progress indicators for users
- Consider batch processing for multiple videos
Support and Contact
For technical support, feature requests, or partnership inquiries:
- Email: support@ytmp3down.com
- Documentation: https://ytmp3down.com/api-docs
- Status page: https://status.ytmp3down.com
We welcome feedback and suggestions to improve our YouTube MP3 converter API. Please don't hesitate to reach out with any questions or concerns.