Retrieve music

September 25, 2024

Table of contents

  1. Request Headers
  2. Path parameter
  3. Responses
  4. Model
  5. Examples
  6. Try It

Use this endpoint to retrieve status and results of

https://api.useapi.net/v1/minimax/music/musicId

Request Headers
Authorization: Bearer {API token}
Content-Type: application/json
Path parameter
  • musicId is required. Specify the musicId you want to retrieve.
Responses
  • 200 OK

    {
      "title": "<title>",
      "lyrics": "<lyrics>",
      "style": "Popular",
      "coverURL": "https://minimax-public-cdn.com/music/final_v3/987654321.png",
      "audioURL": "https://cdn.hailuoai.com/prod/2024-10-05-08/music/987654321.mp3",
      "status": 2,
      "statusLabel": "completed",
      "statusFinal": true,
      "createTime": 123456789,
      "duration": 38,
      "musicId": "user:user_id-minimax:account_id-music:music_id"
    }
    
  • 400 Bad Request

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

    {
      "error": "Unauthorized",
      "code": 401
    }
    
  • 404 Not Found

    {
        "error": "Not found.",
        "code": 404
    }
    
Model

Known status values:

  • 0 pending
  • 1 processing
  • 2 completed
  • 4 moderated
{   // TypeScript, all fields are optional
    title: string
    lyrics: string
    style: string
    coverURL: string
    audioURL: string
    status: number
    statusLabel: string
    statusFinal: boolean
    createTime: number
    duration: number
    musicId: string
}
Examples
  • curl "https://api.useapi.net/v1/minimax/music/musicId" \
       -H "Accept: application/json" \
       -H "Authorization: Bearer …" 
    
  • const token = "API token";
    const musicId = "musicId to retrieve"; 
    const apiUrl = `https://api.useapi.net/v1/minimax/music/${musicId}`; 
    const response = await fetch(apiUrl, {
      headers: {
        "Authorization": `Bearer ${token}`,
      },
    });
    const result = await response.json();
    console.log("response", {response, result});
    
  • import requests
    token = "API token"
    musicId = "musicId to retrieve"
    apiUrl = f"https://api.useapi.net/v1/minimax/music/{musicId}"
    headers = {
        "Content-Type": "application/json", 
        "Authorization" : f"Bearer {token}"
    }
    response = requests.get(apiUrl, headers=headers)
    print(response, response.json())
    
Try It