---
title: "Text To Music"
method: POST
path: "/v1/generate-music"
---

# Text To Music

`POST /v1/generate-music`

## Request

- Base URL: `https://api.musicfy.lol` (the document declares no server; this is the origin it was published from)
- URL: `https://api.musicfy.lol/v1/generate-music`
- Auth: none declared

Generate music from text

Args:
    prompt (str): the prompt
    duration (int, optional): the duration of the music. Defaults to 15.

Returns:
    MusicGeneration: generated music row

## Request body

- APIMusicgenPayload: Payload for all incoming musicgen requests Attributes: prompt: text description of music to generate duration: lenght of audio in seconds
  - `prompt` string, required
  - `duration` integer

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/musicfy/apis/musicfy-api.md) - [All operations](https://skmtc.dev/musicfy/apis/musicfy-api/llms.txt) - [OpenAPI document](https://skmtc.dev/musicfy/apis/musicfy-api/revisions/ca15b8d8aaeb?raw)
