{"templateId":"api_docs","sharedDataIds":{"apiDocsStore":"api-docs-reference/ai_music_generator.yaml","sidebar":"sidebar-reference/sidebars.yaml"},"props":{"definitionId":"reference/ai_music_generator.yaml","settings":{"baseUrlPath":"/reference/ai_music_generator"},"disableAutoScroll":true,"seo":{"title":"AI Music Generator","description":"YouCam API documentation by Perfect Corp. Learn how to use Skin analysis API, Virtual try-on API, Image editing API, and Video generative AI APIs.","siteUrl":"https://docs.perfectcorp.com","keywords":"AI Skin Analysis, AI Clothes, AI Hairstyle, AI Outfits","image":"/assets/favicon.cd6fa4d833b2a573b3c6dae68386b293da205b203402cb0c97b80bd2acc07ea2.8351e24f.png"},"dynamicMarkdocComponents":[],"metadata":{"type":"openapi","title":"AI Music Generator","version":"","description":"# Overview\nTurn a theme, lyrics, and/or a music style into a complete song. Each AI Music Generator task composes one finished song (mp3) and returns it together with a cover image, the song title, the final lyrics, and a synchronized lyrics timeline.\n\n* Vocal songs and instrumentals: generate a song with vocals, or instrumental music with no vocals and no lyrics (`instrumental: true`).\n* Start from what you have: a theme (`idea`), your own lyrics (`lyrics`), or both. An instrumental song requires an `idea`.\n* Lyrics language: ask for it in the `idea` text (e.g. \"with Japanese lyrics\"). Supported lyrics languages are English, Japanese, Korean, Portuguese, Spanish, German, French, Italian, Traditional Chinese, Simplified Chinese, Hindi, and Turkish.\n\nSample usage:\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2026-10-15/webp_b29b16b3-6f1f-4f94-b0f3-ef7955d1b3e0.webp)\n\n![](https://plugins-media.makeupar.com/smb/blog/post/2026-09-24/webp_90715cdb-e955-4501-9290-0869981b3f43.webp)\n\n---\n\n## Integration Guide\n\n* AI Music Generator Usage Guide\n\nThis guide explains how to run an AI Music Generator task and read its result.\n\nThere is no image or audio input, so you don't need the File API: there is no \"Create a new file\" step before running a task. Just input your `idea` or `lyrics`, choose `music_style`, and create incredible songs.\n\n***\n\n   * Step 1. Create a Task\n\nUse the **AI Task API** (`/s2s/v2.0/task/ai-song`) with a theme, lyrics, and/or a music style:\n\n```bash\ncurl --request POST \\\n  --url https://yce-api-01.makeupar.com/s2s/v2.0/task/ai-song \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'content-type: application/json' \\\n  --data '{\"idea\":\"A song about a small cafe that stays open late for people who cannot sleep\",\"music_style\":{\"genre\":\"Acoustic Pop\",\"mood\":\"Calm, hopeful\",\"vocal\":\"female\",\"description\":\"soft piano, brushed drums\"},\"instrumental\":false}'\n```\n\nThe response returns the `task_id` of this task:\n\n```json\n{\n  \"status\": 200,\n  \"data\": {\n    \"task_id\": \"grH0CvsgXuAIHLUzD0V1Ol34hoet3R1tvdbtiVHrDb6_UqCLKIejAIajwxrhOAfe\"\n  }\n}\n```\n\n***\n\n   * Step 2. Poll for Task Result\n\nUse the `task_id` from the run response to check the status until `task_status` is `success` or `error`:\n\n```bash\ncurl --request GET \\\n  --url https://yce-api-01.makeupar.com/s2s/v2.0/task/ai-song/YOUR_TASK_ID \\\n  --header 'Authorization: Bearer YOUR_API_KEY' \\\n  --header 'content-type: application/json'\n```\n\n***\n\n   * Step 3. Retrieve Result\n\nA successful response includes the song, its cover image, title, final lyrics, and synchronized lyrics timestamps:\n\n```json\n{\n  \"status\": 200,\n  \"data\": {\n    \"error\": null,\n    \"results\": {\n      \"url\": \"https://example.com/sample-song-url\",\n      \"cover_urls\": [\n        \"https://example.com/sample-cover-url\"\n      ],\n      \"title\": \"Leave the Light On\",\n      \"lyrics\": \"[verse]\\nTwo a.m., the neon hums\\nSteam on the glass, the night still runs\",\n      \"duration\": 154.3,\n      \"timestamps\": \"{\\\"lyrics_lrc_timestamps\\\": \\\"[00:23.98]Two a.m., the neon hums\\\"}\"\n    },\n    \"task_status\": \"success\"\n  }\n}\n```\n\n---\n\n## Inputs & Outputs\n\n* Request Body\n\n| Field | Type | Description |\n|---|---|---|\n| idea | string (max 500 characters) | Theme of the song. Required when `instrumental` is `true`. For a song with vocals, provide `idea`, `lyrics`, or both. |\n| lyrics | string (max 3000 characters) | Lyrics of the song. Section tags such as `[intro]`, `[verse]`, `[chorus]`, and `[outro]` are supported. |\n| music_style | object | Music style of the song: `genre` (max 100), `mood` (max 100), `vocal` (`female` or `male`, ignored for instrumentals), and `description` (max 300) for other details such as instruments or rhythm. All fields are optional. |\n| instrumental | boolean | `true` to generate instrumental music with no vocals and no lyrics. Default `false`. |\n\nA request must describe a song one of these ways: from an `idea` (`idea` is not empty), or from lyrics for a song with vocals (`lyrics` is not empty and `instrumental` is not `true`).\n\n* Results (`data.results`)\n\n| Field | Type | Description |\n|---|---|---|\n| url | string | URL to download the generated song (mp3). Valid for 2 hours |\n| cover_urls | array of string | URLs to download the cover images (jpg). Currently one image. Valid for 2 hours |\n| title | string | Generated title of the song |\n| lyrics | string | Final lyrics of the song. Empty for instrumental music |\n| duration | number | Length of the song in seconds |\n| timestamps | string | JSON-encoded string of an object whose `lyrics_lrc_timestamps` field holds the synchronized lyrics in LRC format, e.g. `[00:08.54]Lyrics text`. The LRC text is empty for instrumental music |\n\n---\n\n## File Specs & Errors\n\n* Supported Limits\n\n| Type | Limit |\n|---|---|\n| idea (theme) | Max 500 characters. Required when `instrumental` is `true` |\n| lyrics | Max 3000 characters. Section tags such as `[intro]`, `[verse]`, `[chorus]`, and `[outro]` are supported |\n| music_style `genre` / `mood` | Max 100 characters each |\n| music_style `description` | Max 300 characters |\n| Input file | None. There is no image or audio input, so no File API step is needed |\n| Output | Song: mp3. Cover image: jpg. Result URLs are valid for 2 hours |\n\n* Error Codes\n\n| Error Code | Description |\n|---|---|\n| invalid_parameter | Invalid parameter value, e.g. neither `idea` nor `lyrics` is provided, `idea` is missing for an instrumental task, or a field exceeds its maximum length |\n\n    > Task-level failures are reported in the status response: `data.error` is the error code and `data.error_message` is a detailed description of the error.\n\n---\n\n## Unit Consumption\n\nPriced by song type.\n\n| Song Type | Unit Consumed |\n|---|---|\n| Song with vocals (`instrumental: false`) | 10 units per song |\n| Instrumental music (`instrumental: true`) | 20 units per song |\n\n---"},"compilationErrors":[],"markdown":{"partials":{},"variables":{"rbac":{"teams":["anonymous"]},"user":{},"remoteAddr":{"hostname":"docs.perfectcorp.com","port":4000,"ipAddress":"216.73.216.89"},"lang":"en","env":{"PUBLIC_REDOCLY_BRANCH_NAME":"master"}}},"pagePropGetterError":{"message":"","name":""}},"slug":"/reference/ai_music_generator","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}