API커버 이미지 (4/9)

POST /v2/cover/generate

Generate AI cover images for your music tracks. Consumes 1 credit per request.

POSThttps://udioapi.pro/api/v2/cover/generate

How it works:

  • Step 1: Call /v2/cover/generate with your music task ID to start cover generation
  • Step 2: Use the returned taskId to poll /v2/cover/status for results
  • Step 3: When status is SUCCESS, get the generated cover images from images array

Credit Cost: 1 credit per cover generation request.


Important Notes:

  • Cover image file URLs will be retained for 14 days
  • Each music task can only generate a Cover once; duplicate requests will return a 400 error
  • It's recommended to call this interface after music generation is complete
  • Usually generates 2 different style images for selection

요청 헤더

Authorization필수

Bearer token for authentication (your API key)

Content-Type필수

application/json

요청 본문

Request body for generating music cover

공통 매개변수
매개변수유형필수설명예시
taskIdstringThe task ID of the original music generation. This is the workId returned from the /v2/generate endpoint.gen123213213213123bksv

응답

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "cover123123213213b880d2"
  }
}
{
  "code": 400,
  "msg": "Cover already exists for this task"
}
{
  "code": 401,
  "message": "No API key provided in Authorization header"
}
{
  "code": 402,
  "message": "Insufficient balance, please recharge"
}
{
  "code": 404,
  "message": "Original music task not found, please check your task id"
}

코드 예시

curl -X POST "https://udioapi.pro/api/v2/cover/generate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "taskId": "gen123213213213123bksv"
  }'
// Step 1: Generate cover
const generateResponse = await fetch('https://udioapi.pro/api/v2/cover/generate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    taskId: 'gen123213213213123bksv' // Your music task ID
  })
});

const generateData = await generateResponse.json();
console.log('Cover task created:', generateData.data.taskId);

// Step 2: Poll for status
const checkStatus = async (coverTaskId) => {
  const statusResponse = await fetch(
    `https://udioapi.pro/api/v2/cover/status?task_id=${coverTaskId}`,
    {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );
  return await statusResponse.json();
};

// Poll until complete
let status = await checkStatus(generateData.data.taskId);
while (status.data?.status === 'IN_PROGRESS') {
  await new Promise(resolve => setTimeout(resolve, 5000)); // Wait 5 seconds
  status = await checkStatus(generateData.data.taskId);
}

console.log('Cover images:', status.data.images);

GET /v2/cover/status

Check the status of a cover generation task and retrieve generated cover images.

GEThttps://udioapi.pro/api/v2/cover/status

요청 매개변수

task_idstring필수

The cover task ID returned from /v2/cover/generate

요청 헤더

Authorization필수

Bearer token for authentication (your API key)

응답

{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "cover123123213213b880d2",
    "status": "SUCCESS",
    "images": [
      "https://tempcover.storage.com/s/123.png",
      "https://tempcover.storage.com/s/456.png"
    ],
    "created_at": "2026-01-01 00:00:30"
  }
}
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "cover123123213213b880d2",
    "status": "IN_PROGRESS",
    "images": null,
    "created_at": "2026-01-01 00:00:00"
  }
}
{
  "code": 200,
  "msg": "success",
  "data": {
    "taskId": "cover123123213213b880d2",
    "status": "FAILED",
    "error": "Cover generation failed",
    "images": null,
    "created_at": "2026-01-01 00:00:00"
  }
}
{
  "code": 404,
  "msg": "Cover task not found",
  "data": null
}

코드 예시

curl -X GET "https://udioapi.pro/api/v2/cover/status?task_id=cover123123213213b880d2" \
  -H "Authorization: Bearer YOUR_API_KEY"