Speaker Diarization
Identify different speakers in audio, return a speaker timeline structure, and optionally generate separate audio files for each detected speaker.
Create Task
Basic Information
| Item | Value |
|---|
| Request Method | POST |
| Request Path | /task/audio_speaker_split |
| Content-Type | application/json |
| Authentication | Raw API key in the Authorization header |
Request Body
| Parameter | Type | Required | Default | Description |
|---|
file_id | string | Yes | - | Uploaded audio or video file ID |
only_struct | boolean | No | true | true: return speaker structure only. false: also generate separated audio files |
keep_origin_length | boolean | No | false | Whether generated files should preserve the original duration with silence padding |
Request Example
curl -X POST https://api.ai-mcn.tv:10000/task/audio_speaker_split \
-H "Authorization: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"file_id": "537489015178246",
"only_struct": false,
"keep_origin_length": false
}'
Success Example
{
"code": 200,
"msg": "success",
"data": {
"task_id": "537489015178247",
"task_type": "audio_speaker_split",
"status": "queued"
}
}
Query Task Result
Basic Information
| Item | Value |
|---|
| Request Method | GET |
| Request Path | /task/audio_speaker_split/{task_id} |
| Authentication | Raw API key in the Authorization header |
Output Result (output_result)
| Parameter | Type | Description |
|---|
spoken_list | array | Speaker segment list |
spoken_list[].speaker | string | Speaker identifier, such as "SPEAKER_01" |
spoken_list[].start_time | number | Segment start time in seconds |
spoken_list[].end_time | number | Segment end time in seconds |
files | array | Separated audio files, returned only when only_struct: false |
files[].speaker | string | Speaker identifier |
files[].file_id | string | Generated speaker file ID |
files[].download_url | string | Download path for the generated file |
Success Example
{
"code": 200,
"msg": "success",
"data": {
"task_id": "537489015178247",
"status": "completed",
"progress": 100,
"output_result": {
"spoken_list": [
{ "speaker": "SPEAKER_01", "start_time": 0.0, "end_time": 5.2 },
{ "speaker": "SPEAKER_02", "start_time": 5.5, "end_time": 12.8 },
{ "speaker": "SPEAKER_01", "start_time": 13.0, "end_time": 18.6 }
],
"files": [
{
"speaker": "SPEAKER_01",
"file_id": "537489015178248",
"download_url": "/download/a1/speaker_01.wav"
},
{
"speaker": "SPEAKER_02",
"file_id": "537489015178249",
"download_url": "/download/a1/speaker_02.wav"
}
]
},
"create_time": "2026-04-05T08:00:00Z",
"update_time": "2026-04-05T08:00:20Z"
}
}
Error Codes
| Error Code | HTTP Status | Description | Resolution |
|---|
6013 | 400 | Missing file_id | Pass the file_id field |
6004 | 404 | File not found | Verify the file_id |
6502 | 401 | Authentication failed | Check the Authorization header |
6202 | 402 | Insufficient balance | Recharge in the Dashboard |