Music Flamingo API: Complete Integration Guide
# Music Flamingo API: Complete Integration Guide
Music Flamingo offers a powerful REST API that allows developers to integrate professional-grade music analysis into their applications. This comprehensive guide covers everything you need to know to get started.
## Getting Started
### Authentication
Music Flamingo uses API key authentication:
```bash
curl -H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
https://api.musicflamingo.com/v1/analyze
```
### Rate Limits
- Free tier: 100 requests/day
- Pro tier: 10,000 requests/day
- Enterprise: Custom limits
## Core Endpoints
### 1. Analyze Audio
Analyze a music file and receive comprehensive insights.
```
POST /v1/analyze
```
**Request:**
```json
{
"audio_url": "https://example.com/song.mp3",
"features": ["genre", "mood", "instruments", "key", "tempo"]
}
```
**Response:**
```json
{
"id": "analysis_abc123",
"status": "completed",
"result": {
"genre": {"primary": "Indie Rock", "confidence": 0.98},
"mood": {"primary": "melancholic", "valence": 3.2},
"instruments": ["electric guitar", "drums", "bass"],
"key": "E major",
"tempo": 120
}
}
```
### 2. Batch Analysis
Analyze multiple tracks in one request.
## Code Examples
### Python
```python
import requests
headers = {"Authorization": "Bearer YOUR_API_KEY"}
data = {"audio_url": "https://example.com/song.mp3"}
response = requests.post(
"https://api.musicflamingo.com/v1/analyze",
headers=headers,
json=data
)
```
### JavaScript
```javascript
const response = await fetch('https://api.musicflamingo.com/v1/analyze', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
audio_url: 'https://example.com/song.mp3'
})
});
```
## Best Practices
1. **Handle async responses**: Large files take time to process
2. **Cache results**: Store analysis to avoid re-analyzing
3. **Use webhooks**: Get notified when analysis completes
4. **Validate inputs**: Check file formats before uploading
## Conclusion
The Music Flamingo API makes it easy to add professional music analysis to any application. Start with the free tier and scale as needed.
