API Documentation
Integrate AI music generation into your applications
Quick Start
Base URL
https://api.tuneforge.io/api/v1Authentication Header
Authorization: Bearer tf_your_api_keyAll API requests require authentication. Include your API key in the Authorization header.
Authentication
To use the TuneForge API, you need an API key. You can create and manage your API keys from your account settings.
Using your API key
Include your key in the Authorization header as a Bearer token:
curl https://api.tuneforge.io/api/v1/account/me \
-H "Authorization: Bearer tf_your_api_key"Keep your API keys secure. Do not expose them in client-side code, public repositories, or share them with others.
Endpoints
Music Generation
Account
Rate Limits
| Plan | Rate Limit |
|---|---|
| Free | 60 req/min |
| Pro | 300 req/min |
| Premier | 1,000 req/min |
Rate Limit Headers
Every API response includes headers to help you track your rate limit usage:
| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests allowed per minute |
X-RateLimit-Remaining | Requests remaining in the current window |
X-RateLimit-Reset | Unix timestamp when the rate limit resets |
Error Codes
| Code | Status | Description |
|---|---|---|
| 200 | OK | Request succeeded |
| 201 | Created | Resource created successfully |
| 400 | Bad Request | Invalid request parameters or body |
| 401 | Unauthorized | Missing or invalid API key |
| 402 | Payment Required | Insufficient credits for this operation |
| 404 | Not Found | Resource not found |
| 429 | Too Many Requests | Rate limit exceeded. Check X-RateLimit headers |
| 500 | Internal Server Error | Something went wrong on our end |
All error responses include a JSON body with a detail field describing the error:
{
"detail": "Insufficient credits. You need 5 credits but have 2 remaining."
}Code Examples
Full examples showing how to generate music, poll for status, and retrieve the audio URL.
# Generate music
curl -X POST https://api.tuneforge.io/api/v1/music/generate \
-H "Authorization: Bearer tf_your_api_key" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Chill lo-fi hip hop beat with vinyl crackle",
"genre": "lo-fi",
"mood": "calm",
"duration_seconds": 15
}'
# Check generation status
curl https://api.tuneforge.io/api/v1/music/status/req_abc123def456 \
-H "Authorization: Bearer tf_your_api_key"
# Download the audio
curl -O https://api.tuneforge.io/api/v1/music/audio/trk_001.wav \
-H "Authorization: Bearer tf_your_api_key"