> ## Documentation Index
> Fetch the complete documentation index at: https://help.soundverse.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# AI Music Generator - v1

<Warning>
  <strong>Deprecated:</strong> As of 30/12/2025 this has been deprecated and will be removed soon. Please migrate to a newer version.
</Warning>

## Generate Music from Text

This API allows you to generate **AI-powered music** based on a text description.\
Choose between:

* 🎧 **HD Quality** → `sansaar_1` (Higher fidelity)
* ⚡ **Fast Mode** → `sansaar_1_lite` (Quicker processing)

***

#### **Core Parameters**

> 🛈 The parameters below define the request body for this API.

| Parameter      | Type      | Required?   | Description                                          |
| -------------- | --------- | ----------- | ---------------------------------------------------- |
| **`prompt`**   | `string`  | ✅ Required  |    Text description of the music.                    |
| **`duration`** | `integer` | ⚠️ Optional |    Track length (`15s`, `30s`, `60s`, `180s`).       |
| **`model`**    | `string`  | ⚠️ Optional |   `"sansaar_1"` (HQ) or `"sansaar_1_lite"` (Faster). |
| **`loop`**     | `boolean` | ⚠️ Optional |    Whether the music should loop.                    |

***

#### **Request Body**

<div className="bg-gray-100 dark:bg-gray-800 p-3 rounded-md">
  ```json theme={null}
  {
    "prompt": "A futuristic electronic track with deep bass and synths.",
    "duration": 15,
    "model": "sansaar_1_lite",
    "loop": false
  }
  ```
</div>

#### Code Samples

<Tabs>
  <Tab title="python">
    ```python theme={null}
      import requests

      url = "https://api.soundverse.ai/v1/generate/text-to-music"
      headers = {
          "Authorization": "Bearer your_api_key_here",
          "Content-Type": "application/json"
      }
      payload = {
      "prompt": "Compose a futuristic electronic track with cutting-edge synth sounds and pulsing beats.",
      "duration": 15,
      "model": "sansaar_1_lite",
      "loop": false
      }

      response = requests.post(url, json=payload, headers=headers)
      print(response.json())
    ```
  </Tab>

  <Tab title="curl">
    ```sh theme={null}
      curl -X POST "https://api.soundverse.ai/v1/generate/text-to-music" \
      -H "Authorization: Bearer your_api_key_here" \
      -H "Content-Type: application/json" \
      -d '{
      "prompt": "Compose a futuristic electronic track with cutting-edge synth sounds and pulsing beats.",
      "duration": 15,
      "model": "sansaar_1_lite",
      "loop": false
      }'
    ```
  </Tab>
</Tabs>

#### Response

<Tabs>
  <Tab title="200 OK">
    ```sh theme={null}
        {
        "prompt":"str",
        "albumArt":"str",
        "aiReply":"str",
        "audioData":[
          {
            "audioUrl":"str",
            "songName":"str",
            "licenses":"str"
          }
        ]
        }
    ```
  </Tab>

  <Tab title="400 Bad Request">
    ```sh theme={null}
      {
        "Detail": “str”
      }
    ```
  </Tab>
</Tabs>

***

#### Sample Output

```python theme={null}
{
  "prompt":"A hopeful melody with rising strings and ambient piano, like the end of a movie when the hero finds peace.",
  "albumArt":"https://storage.googleapis.com/soundverse-album-art/67b9ca2f20e711017fc1b6c5/67b9ca2f20e711017fc1b6c5/20250413130229_00000_album_cover_art_for_A_hopeful_melody_with_rising_strings_and_ambient_piano_like_the_end_of_a_movie_when_the_hero_finds_peace.png",
  "aiReply":"Your audio jewel is polished and gleaming, a testament to your artistic prowess. Unleash its melodies and watch the world listen in awe.",
  "audioData":[
    {
      "audioUrl":"https://storage.googleapis.com/x-one/67b9ca2f20e711017fc1b6c5/67b9ca2f20e711017fc1b6c5/xone20250413130323ltyxhk5r.wav",
      "songName":"A hopeful melody with ris...",
      "licenses":"Sync"
    }
  ]
}
```

#### Possible Errors :

* If NSFW words are detected

```
{
  "success": False,
  "message": "NSFW words detected. Please try again with a different prompt.",
}
```

* If Artist name is detected

```
{
  "success": False,
  "message": "Artist name detected. Please try again with a different prompt.",
}
```
