Skip to main content

Generate music

Create AI-generated music tracks from text prompts. This endpoint accepts a prompt describing the desired music and returns the generation status.
This endpoint requires session-based authentication. You must be signed in with a valid user account. All requests must include the Content-Type: application/json header.
Music generation can take up to 5 minutes per request (maxDuration: 300). This endpoint is not yet fully implemented — requests currently return a pending status while the backend integration is being finalized.

Create music

POST /api/generate-music
Submit a music generation request.

Request body

FieldTypeRequiredDescription
typestringNoType of music to generate
promptstringNoText description of the desired music
durationnumberNoDesired duration in seconds
providerstringNoAI provider to use for generation

Example request

{
  "type": "background",
  "prompt": "Upbeat electronic track with synth pads and a steady beat",
  "duration": 60,
  "provider": "lyria"
}

Response

Returns the current status and the submitted configuration:
{
  "message": "Music generation API coming soon",
  "status": "pending",
  "config": {
    "type": "background",
    "prompt": "Upbeat electronic track with synth pads and a steady beat",
    "duration": 60,
    "provider": "lyria"
  }
}
The status field is pending while the backend integration is being completed. Once live, this endpoint will return a URL to the generated audio file.

Errors

CodeDescription
401Unauthorized — you must be signed in
500Music generation failed

Error response

{
  "error": "Failed to generate music"
}