API Documentation

Integrate AI music generation into your applications

Quick Start

Base URL
https://api.tuneforge.io/api/v1
Authentication Header
Authorization: Bearer tf_your_api_key

All 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

PlanRate Limit
Free60 req/min
Pro300 req/min
Premier1,000 req/min

Rate Limit Headers

Every API response includes headers to help you track your rate limit usage:

HeaderDescription
X-RateLimit-LimitMaximum requests allowed per minute
X-RateLimit-RemainingRequests remaining in the current window
X-RateLimit-ResetUnix timestamp when the rate limit resets

Error Codes

CodeStatusDescription
200OKRequest succeeded
201CreatedResource created successfully
400Bad RequestInvalid request parameters or body
401UnauthorizedMissing or invalid API key
402Payment RequiredInsufficient credits for this operation
404Not FoundResource not found
429Too Many RequestsRate limit exceeded. Check X-RateLimit headers
500Internal Server ErrorSomething 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"

Ready to build?

Create your API key and start generating music in minutes.