Retrieve the list of music styles

September 25, 2024 (October 11, 2024)

Table of contents

  1. Request Headers
  2. Query Parameters
  3. Responses
  4. Model
  5. Examples
  6. Try It

You can preview all styles at music/create

Use hailuoai.com/music account to generate music, see Setup MiniMax for details.

https://api.useapi.net/v1/minimax/music/styles/?…

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
Query Parameters
  • account is optional when only one account configured. However, if you have multiple accounts configured, this parameter becomes required.
Responses
  • 200 OK

    [
        {
            "name": "Classical",
            "styles": [
                {
                    "url": "https://cdn.hailuoai.com/samle_1.mp3",
                    "styleId": "<sample style id>",
                    "name": "<sample ong name>"
                }
            ]
        },
        {
            "name": "World",
            "styles": [
                {
                    "url": "https://cdn.hailuoai.com/samle_2.mp3",
                    "styleId": "<sample style id>",
                    "name": "<sample ong name>"
                },
                {
                    "url": "https://cdn.hailuoai.com/samle_3.mp3",
                    "styleId": "<sample style id>",
                    "name": "<sample ong name>"
                }
            ]
        }    
    ]
    
  • 400 Bad Request

    {
        "error": "<Error message>",
        "code": 400
    }
    
  • 401 Unauthorized

    {
      "error": "Unauthorized",
      "code": 401
    }
    
Model
{   // TypeScript, all fields are optional
    name: string
    styles: {
        url: string
        styleId: string
        name: string
    }[]
}[]
Examples
  • curl "https://api.useapi.net/v1/minimax/music/styles/?account=account" \
       -H "Accept: application/json" \
       -H "Authorization: Bearer …" 
    
  • const token = "API token";
    const account = "Previously configured account"; 
    const apiUrl = `https://api.useapi.net/v1/minimax/music/styles/?account=${account}`; 
    const response = await fetch(apiUrl, {
      headers: {
        "Authorization": `Bearer ${token}`,
      },
    });
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    token = "API token"
    account = "Previously configured account"
    apiUrl = f"https://api.useapi.net/v1/minimax/music/styles/?account={account}"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    response = requests.get(apiUrl, headers=headers)
    print(response, response.json())
    
Try It