Speaker Diarization
Identify and segment speakers throughout a conversation
1. Submit job
Endpoint
POSThttps://speakerscope.ai/api/diarization
Fields
| Field | Type | Description |
|---|---|---|
audio_url | string | URL of the audio file |
num_speakers | int (optional) | Exact number of speakers |
min_speakers | int (optional) | Minimum number of speakers |
max_speakers | int (optional) | Maximum number of speakers |
Example
import requests
response = requests.post(
"https://speakerscope.ai/api/diarization",
auth=("<API_KEY>", "<API_SECRET>"),
json={
"audio_url": "<AUDIO_URL>",
# "num_speakers": <int>, # optional
# "min_speakers": <int>, # optional
# "max_speakers": <int>, # optional
},
)
print(response.json())Response
| Field | Type | Description |
|---|---|---|
job_id | str | Job identifier used to poll for the result |
{
"job_id": "cca90f61-c3f4-496b-a33c-6d77a4ce92bf"
}2. Get results
Endpoint
GEThttps://speakerscope.ai/api/diarization/{job_id}
Example
import requests
response = requests.get(
"https://speakerscope.ai/api/diarization/<JOB_ID>",
auth=("<API_KEY>", "<API_SECRET>"),
)
print(response.json())Response
| Field | Type | Description |
|---|---|---|
status | str | "pending", "completed", or "failed" |
progress | str (optional) | Progress description (when "pending") |
error | str (optional) | Error message (when "failed") |
segments | list[dict] | List of speaker segments in chronological order (when "completed") |
segments[].speaker | str | Speaker label (e.g. "SPEAKER_00", "SPEAKER_01") |
segments[].start | float | Segment start time in seconds |
segments[].end | float | Segment end time in seconds |
Pending
{
"status": "pending",
"progress": "Predicting..."
}Completed
{
"status": "completed",
"segments": [
{ "speaker": "SPEAKER_00", "start": 0.0, "end": 5.2 },
{ "speaker": "SPEAKER_01", "start": 5.4, "end": 12.8 },
{ "speaker": "SPEAKER_00", "start": 13.1, "end": 19.7 },
{ "speaker": "SPEAKER_01", "start": 20.0, "end": 28.3 },
...
]
}