API v1 — Live

McRock API

Generate AI music programmatically. Integrate McRock's music generation engine directly into your app, game, or platform.

Base URLhttps://us-central1-mcrock-music.cloudfunctions.net
1

Authentication

All requests require an API key passed in the x-api-key header. Your API key is available in Settings → API Access (Enterprise plan only).

http
POST /enterpriseGenerateSong HTTP/1.1
Content-Type: application/json
x-api-key: mcr_live_your_key_here

Keep your key secret. Never expose it in frontend code or public repositories. Use environment variables.

2

Generate a Song

POST/enterpriseGenerateSong

Generates a complete song from your title and lyrics. Returns an audio URL when generation is complete (typically 30–90 seconds).

Request Body

ParameterTypeDescription
titlerequiredstringThe song title (max 80 chars)
lyricsstringFull lyrics. Use [Verse 1], [Chorus] labels. Required unless instrumental: true
genrestringOne or comma-separated genres. Options: Hip-Hop R&B Indie Rock Pop Punk Alt Rock Trap Drill Electronic Synthwave Pop Neo-Soul
vocal_genderstring"male" or "female"
voice_tonestring"raspy", "smooth", or "clean"
moodstring"fierce", "calm", "groovy", "happy", or "sad"
instrumentalbooleanSet true to generate music without vocals. Default: false
webhook_urlstringIf provided, McRock will POST the result to this URL when done (see Webhooks below)

Example Request

bash
curl -X POST \
  https://us-central1-mcrock-music.cloudfunctions.net/apiV1Generate \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_API_KEY" \
  -d '{
    "title": "Midnight Drive",
    "lyrics": "[Verse 1]\nFlying down the highway alone...",
    "genre": "rock",
    "voiceType": "male",
    "voiceTone": "clean",
    "mood": "energetic",
    "musicIntensity": "high",
    "bpm": 120,
    "description": "A late-night drive feeling, raw and free"
  }'

Response

json
{
  "jobId": "abc123def456",
  "status": "queued",
  "pollUrl": "https://us-central1-mcrock-music.cloudfunctions.net/apiV1Status?jobId=abc123def456",
  "quotaRemaining": 9999
}
3

Check API Status & Credits

GET/enterpriseApiStatus

Check your API key status and how many credits you have remaining.

bash
curl \
  "https://us-central1-mcrock-music.cloudfunctions.net/apiV1Status?jobId=abc123def456" \
  -H "x-api-key: YOUR_API_KEY"
json
// While generating (poll every 5-10s)
{
  "status": "generating",
  "message": "McRock: encoding"
}

// When complete
{
  "status": "complete",
  "audioUrl": "https://storage.googleapis.com/mcrock-music.firebasestorage.app/masters/<title>.mp3",
  "duration": 180
}
4

Webhooks

Song generation takes 30–90 seconds. If you pass a webhook_url, McRock will POST the completed result to your server instead of making your client wait.

json
// Optional: provide a webhook_url in the request body to be notified
// when generation completes. McRock will POST this payload to your URL.
{
  "event": "song.completed",
  "jobId": "abc123def456",
  "title": "Midnight Drive",
  "audioUrl": "https://storage.googleapis.com/.../masters/<title>.mp3"
}

Tip: Without a webhook, the API call blocks until the song is ready (synchronous). For production apps with many generations, use webhooks.

5

Error Codes

StatusErrorMeaning
401Invalid API keyThe x-api-key header is missing or incorrect
401API key is disabledYour key was deactivated (plan canceled or suspended)
401No credits remainingYou have used all 300 generation credits
400title is requiredRequest body is missing the title field
400lyrics is requiredlyrics missing when instrumental is not true
405Method not allowedUse POST, not GET
500Generation timed outMusic generation took too long — retry the request
6

Limits

300

Total Credits

Per Enterprise plan (monthly)

180s

Timeout

Max wait time per generation

80 chars

Title Length

Maximum title length

Ready to integrate?

Your API key is available in your Settings page on the Enterprise plan.