{
  "Create Task": "Create Task\nPOST\n/v1/audio/text-to-audio\ncURL\nCopy\nCollapse\ncurl --request POST \\\n--url https://api-singapore.klingai.com/v1/audio/text-to-audio \\\n--header 'Authorization: Bearer <token>' \\\n--header 'Content-Type: application/json' \\\n--data '{\n\"prompt\": \"Fireworks sound during Chinese New Year celebration\",\n\"duration\": 3,\n\"external_task_id\": \"\",\n\"callback_url\": \"\"\n}'\n200\nCopy\nCollapse\n{\n\"code\": 0, // Error codes; Specific definitions can be found in \"Error Code\"\n\"message\": \"string\", // Error information\n\"request_id\": \"string\", // Request ID, generated by the system, used to track requests and troubleshoot problems\n\"data\": {\n\"task_id\": \"string\", // Task ID, generated by the system\n\"task_info\": { // Task creation parameters\n\"external_task_id\": \"string\" // Customer-defined task ID\n},\n\"task_status\": \"string\", // Task status, Enum values: submitted, processing, succeed, failed\n\"created_at\": 1722769557708, // Task creation time, Unix timestamp, unit: ms\n\"updated_at\": 1722769557708 // Task update time, Unix timestamp, unit: ms\n}\n}\nRequest Header\nContent-Type\nstring\nRequired\nDefault to application/json\nData Exchange Format\nAuthorization\nstring\nRequired\nAuthentication information, refer to API authentication\nRequest Body\nprompt\nstring\nRequired\nText prompt\nCannot exceed 200 characters\nduration\nfloat\nRequired\nGenerated audio duration\nValue range: 3.0s - 10.0s, supports one decimal place precision\nexternal_task_id\nstring\nOptional\nCustomized Task ID\nUsers can provide a customized task ID, which will not overwrite the system-generated task ID but can be used for task queries.\nPlease note that the customized task ID must be unique within a single user account.\ncallback_url\nstring\nOptional\nThe callback notification address for the result of this task. If configured, the server will actively notify when the task status changes\nThe specific message schema of the notification can be found in Callback Protocol\nQuery Task (Single)\nGET\n/v1/audio/text-to-audio/{id}\ncURL\nCopy\nCollapse\ncurl --request GET \\\n--url https://api-singapore.klingai.com/v1/audio/text-to-audio/{task_id} \\\n--header 'Authorization: Bearer <token>' \\\n--header 'Content-Type: application/json'\n200\nCopy\nCollapse\n{\n\"code\": 0, // Error codes; Specific definitions can be found in \"Error Code\"\n\"message\": \"string\", // Error information\n\"request_id\": \"string\", // Request ID, generated by the system, used to track requests and troubleshoot problems\n\"data\": {\n\"task_id\": \"string\", // Task ID, generated by the system\n\"task_status\": \"string\", // Task status, Enum values: submitted, processing, succeed, failed\n\"task_status_msg\": \"string\", // Task status message, displaying the failure reason when the task fails (such as triggering the platform's content risk control, etc.)\n\"task_info\": { // Task creation parameters\n\"external_task_id\": \"string\" // Customer-defined task ID\n},\n\"task_result\": {",
  "Parameters": "\"task_info\": { // Task creation parameters\n\"external_task_id\": \"string\" // Customer-defined task ID\n},\n\"task_status\": \"string\", // Task status, Enum values: submitted, processing, succeed, failed\n\"created_at\": 1722769557708, // Task creation time, Unix timestamp, unit: ms\n\"updated_at\": 1722769557708 // Task update time, Unix timestamp, unit: ms\n}\n}\nRequest Header\nContent-Type\nstring\nRequired\nDefault to application/json\nData Exchange Format\nAuthorization\nstring\nRequired\nAuthentication information, refer to API authentication\nRequest Body\nprompt\nstring\nRequired\nText prompt\nCannot exceed 200 characters\nduration\nfloat\nRequired\nGenerated audio duration\nValue range: 3.0s - 10.0s, supports one decimal place precision\nexternal_task_id\nstring\nOptional\nCustomized Task ID\nUsers can provide a customized task ID, which will not overwrite the system-generated task ID but can be used for task queries.\nPlease note that the customized task ID must be unique within a single user account.\ncallback_url\nstring\nOptional\nThe callback notification address for the result of this task. If configured, the server will actively notify when the task status changes\nThe specific message schema of the notification can be found in Callback Protocol\nQuery Task (Single)\nGET\n/v1/audio/text-to-audio/{id}\ncURL\nCopy\nCollapse\ncurl --request GET \\\n--url https://api-singapore.klingai.com/v1/audio/text-to-audio/{task_id} \\\n--header 'Authorization: Bearer <token>' \\\n--header 'Content-Type: application/json'\n200\nCopy\nCollapse\n{\n\"code\": 0, // Error codes; Specific definitions can be found in \"Error Code\"\n\"message\": \"string\", // Error information\n\"request_id\": \"string\", // Request ID, generated by the system, used to track requests and troubleshoot problems\n\"data\": {\n\"task_id\": \"string\", // Task ID, generated by the system\n\"task_status\": \"string\", // Task status, Enum values: submitted, processing, succeed, failed\n\"task_status_msg\": \"string\", // Task status message, displaying the failure reason when the task fails (such as triggering the platform's content risk control, etc.)\n\"task_info\": { // Task creation parameters\n\"external_task_id\": \"string\" // Customer-defined task ID\n},\n\"task_result\": {\n\"audios\": [\n{\n\"id\": \"string\", // Audio ID; globally unique\n\"url_mp3\": \"string\", // URL for generated audio in MP3 format (Please note that for information security, generated audios will be cleared after 30 days. Please save them promptly.)\n\"url_wav\": \"string\", // URL for generated audio in WAV format (Please note that for information security, generated audios will be cleared after 30 days. Please save them promptly.)\n\"duration_mp3\": \"string\", // Total duration of the audio in MP3 format, unit: s\n\"duration_wav\": \"string\" // Total duration of the audio in WAV format, unit: s\n}\n]\n},\n\"final_unit_deduction\": \"string\", // The deduction units of task\n\"created_at\": 1722769557708, // Task creation time, Unix timestamp, unit: ms\n\"updated_at\": 1722769557708 // Task update time, Unix timestamp, unit: ms\n}\n}\nRequest Header\nContent-Type\nstring\nRequired\nDefault to application/json\nData Exchange Format\nAuthorization\nstring\nRequired\nAuthentication information, refer to API authentication",
  "Callback Protocol": "The specific message schema of the notification can be found in Callback Protocol\nQuery Task (Single)\nGET\n/v1/audio/text-to-audio/{id}\ncURL\nCopy\nCollapse\ncurl --request GET \\\n--url https://api-singapore.klingai.com/v1/audio/text-to-audio/{task_id} \\\n--header 'Authorization: Bearer <token>' \\\n--header 'Content-Type: application/json'\n200\nCopy\nCollapse\n{\n\"code\": 0, // Error codes; Specific definitions can be found in \"Error Code\"\n\"message\": \"string\", // Error information\n\"request_id\": \"string\", // Request ID, generated by the system, used to track requests and troubleshoot problems\n\"data\": {\n\"task_id\": \"string\", // Task ID, generated by the system\n\"task_status\": \"string\", // Task status, Enum values: submitted, processing, succeed, failed\n\"task_status_msg\": \"string\", // Task status message, displaying the failure reason when the task fails (such as triggering the platform's content risk control, etc.)\n\"task_info\": { // Task creation parameters\n\"external_task_id\": \"string\" // Customer-defined task ID\n},\n\"task_result\": {\n\"audios\": [\n{\n\"id\": \"string\", // Audio ID; globally unique\n\"url_mp3\": \"string\", // URL for generated audio in MP3 format (Please note that for information security, generated audios will be cleared after 30 days. Please save them promptly.)\n\"url_wav\": \"string\", // URL for generated audio in WAV format (Please note that for information security, generated audios will be cleared after 30 days. Please save them promptly.)\n\"duration_mp3\": \"string\", // Total duration of the audio in MP3 format, unit: s\n\"duration_wav\": \"string\" // Total duration of the audio in WAV format, unit: s\n}\n]\n},\n\"final_unit_deduction\": \"string\", // The deduction units of task\n\"created_at\": 1722769557708, // Task creation time, Unix timestamp, unit: ms\n\"updated_at\": 1722769557708 // Task update time, Unix timestamp, unit: ms\n}\n}\nRequest Header\nContent-Type\nstring\nRequired\nDefault to application/json\nData Exchange Format\nAuthorization\nstring\nRequired\nAuthentication information, refer to API authentication\nPath Parameters\ntask_id\nstring\nOptional\nThe task ID for audio generation\nRequest path parameter, fill the value directly in the request path\nYou can choose to query by external_task_id or task_id\nexternal_task_id\nstring\nOptional\nCustomized Task ID for audio generation\nThe external_task_id filled in when creating the task. You can choose to query by external_task_id or task_id\nQuery Task (List)\nGET\n/v1/audio/text-to-audio\ncURL\nCopy\nCollapse\ncurl --request GET \\\n--url 'https://api-singapore.klingai.com/v1/audio/text-to-audio?pageNum=1&pageSize=30' \\\n--header 'Authorization: Bearer <token>' \\\n--header 'Content-Type: application/json'\n200\nCopy\nCollapse\n{\n\"code\": 0, // Error codes; Specific definitions can be found in \"Error Code\"\n\"message\": \"string\", // Error information\n\"request_id\": \"string\", // Request ID, generated by the system, used to track requests and troubleshoot problems\n\"data\": [\n{\n\"task_id\": \"string\", // Task ID, generated by the system\n\"task_status\": \"string\", // Task status, Enum values: submitted, processing, succeed, failed\n\"task_status_msg\": \"string\", // Task status message, displaying the failure reason when the task fails (such as triggering the platform's content risk control, etc.)\n\"task_info\": { // Task creation parameters\n\"external_task_id\": \"string\" // Customer-defined task ID\n},\n\"task_result\": {\n\"audios\": ["
}