Try this endpoint →
Service endpoints Service URL: https://api.fourhz.ai
Method / Protocol Path Content-Type / Frames Auth POST /v1/asr/pre-recorded/uploadapplication/octet-stream Authorization: <API Key>POST /v1/asr/pre-recorded/transcriptapplication/json Authorization: <API Key>GET /v1/asr/pre-recorded/transcriptquery Authorization: <API Key>GET /v1/asr/pre-recorded/transcript/{id}— Authorization: <API Key>DELETE /v1/asr/pre-recorded/transcript/{id}— Authorization: <API Key>
Authentication Use the raw API key without Bearer. Put it in the HTTP Authorization header; keep long-lived keys on the server.
Authorization: $FOURHZ_API_KEY
Two variants Diarization only speaker_labels=true returns anonymous roles without enrollment.
Diarization + speaker identification Keep speaker_labels=true and supply fourhz_identify_candidates. Create candidates using enrollment. An unknown result or best_candidate is not a confirmed identity.
Speaker enrollment Parameter Type Required Description filebinary No Audio file; use the returned upload_url as audio_url; choose it or audio_url. audio_urlstring No URL of an uploaded file; choose it or file. speech_modelstring No Enables speaker diarization. Default fourhz-focus speaker_labelsboolean No Returns anonymous speaker labels. Default true reject_background_speechboolean No Background-speech rejection. Optional; defaults to true (enabled). Set to false to disable. Top-level field in the JSON body when creating a transcript.
Field Type Meaning and availability idstring Transcript ID for polling and deletion; not a task_id alias. statusstring queued, processing, completed, or error. textstring? Full transcript after completion. audio_durationnumber? Audio duration in seconds when returned by PRE. errorstring? Failure reason; stop polling on error. speaker_label / utterances[].speakerstring Anonymous role A/B/… or UNKNOWN, not a real-person identity. utterances[].start / endinteger PRE/SYNC utterance start/end in milliseconds. utterances[].textstring Text of this speaker’s utterance. utterances[].fourhz_enrollment_idstring? Complete enrollment ID after a successful candidate match. utterances[].fourhz_similaritynumber? Match similarity, not transcript confidence; never invent a missing score. language_codestring? Detected language code. wordsarray? Word-level timestamps when returned. confidencenumber? Overall confidence when returned. utterancesarray? Utterance list; diarization includes speaker.
cURL Python JavaScript
curl -X POST 'https://api.fourhz.ai/v1/asr/pre-recorded/transcript' \
-H "Authorization: $FOURHZ_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"audio_url": "REPLACE_WITH_UPLOAD_URL",
"speech_model": "fourhz-focus"
}'# pip install requests
import os
import requests
from contextlib import ExitStack
url = "https://api.fourhz.ai/v1/asr/pre-recorded/transcript"
headers = {"Authorization": os.environ["FOURHZ_API_KEY"]}
with ExitStack() as stack:
payload = {"audio_url":"REPLACE_WITH_UPLOAD_URL","speech_model":"fourhz-focus"}
response = requests.request("POST", url, headers=headers, timeout=300, json=payload)
response.raise_for_status()
print(response.json() if response.content else {"status": response.status_code})// Node.js 22+
import {readFile} from 'node:fs/promises';
const url = "https://api.fourhz.ai/v1/asr/pre-recorded/transcript";
const headers = {"Authorization": process.env.FOURHZ_API_KEY};
headers["Content-Type"] = "application/json";
const body = JSON.stringify({
"audio_url": "REPLACE_WITH_UPLOAD_URL",
"speech_model": "fourhz-focus"
});
const response = await fetch(url, {method: "POST", headers, body, signal: AbortSignal.timeout(300000)});
if (!response.ok) throw new Error(await response.text());
console.log(response.status === 204 ? {status: 204} : await response.json());Create transcript Upload the audio first, then create the transcript with upload_url. Upload and creation are two requests in the same PRE flow.
Request parameters Parameter Type Required Description filebinary No Audio file; use the returned upload_url as audio_url; choose it or audio_url. audio_urlstring No URL of an uploaded file; choose it or file. speech_modelstring No Enables speaker diarization. Default fourhz-focus speaker_labelsboolean No Returns anonymous speaker labels. Default true
Response fields Field Type Meaning and availability upload_urlstring URL used to create the transcript after upload. idstring Created transcript ID. statusstring queued, processing, completed, or error.
Request examples cURL Python JavaScript
curl -X POST 'https://api.fourhz.ai/v1/asr/pre-recorded/upload' \
-H "Authorization: $FOURHZ_API_KEY" \
-H "Content-Type: application/octet-stream" \
--data-binary @audio.wav# pip install requests
import os
import requests
from contextlib import ExitStack
url = "https://api.fourhz.ai/v1/asr/pre-recorded/upload"
headers = {"Authorization": os.environ["FOURHZ_API_KEY"]}
with ExitStack() as stack:
audio = stack.enter_context(open("audio.wav", "rb"))
headers["Content-Type"] = "application/octet-stream"
response = requests.request("POST", url, headers=headers, timeout=300, data=audio)
response.raise_for_status()
print(response.json() if response.content else {"status": response.status_code})// Node.js 22+
import {readFile} from 'node:fs/promises';
const url = "https://api.fourhz.ai/v1/asr/pre-recorded/upload";
const headers = {"Authorization": process.env.FOURHZ_API_KEY};
headers["Content-Type"] = "application/octet-stream";
const body = await readFile("audio.wav");
const response = await fetch(url, {method: "POST", headers, body, signal: AbortSignal.timeout(300000)});
if (!response.ok) throw new Error(await response.text());
console.log(response.status === 204 ? {status: 204} : await response.json());cURL Python JavaScript
curl -X POST 'https://api.fourhz.ai/v1/asr/pre-recorded/transcript' \
-H "Authorization: $FOURHZ_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"audio_url": "https://api.fourhz.ai/v1/asr/pre-recorded/upload/fup_example",
"speech_model": "fourhz-focus",
"speaker_labels": true
}'# pip install requests
import os
import requests
from contextlib import ExitStack
url = "https://api.fourhz.ai/v1/asr/pre-recorded/transcript"
headers = {"Authorization": os.environ["FOURHZ_API_KEY"]}
with ExitStack() as stack:
payload = {"audio_url":"https://api.fourhz.ai/v1/asr/pre-recorded/upload/fup_example","speech_model":"fourhz-focus","speaker_labels":True}
response = requests.request("POST", url, headers=headers, timeout=300, json=payload)
response.raise_for_status()
print(response.json() if response.content else {"status": response.status_code})// Node.js 22+
import {readFile} from 'node:fs/promises';
const url = "https://api.fourhz.ai/v1/asr/pre-recorded/transcript";
const headers = {"Authorization": process.env.FOURHZ_API_KEY};
headers["Content-Type"] = "application/json";
const body = JSON.stringify({
"audio_url": "https://api.fourhz.ai/v1/asr/pre-recorded/upload/fup_example",
"speech_model": "fourhz-focus",
"speaker_labels": true
});
const response = await fetch(url, {method: "POST", headers, body, signal: AbortSignal.timeout(300000)});
if (!response.ok) throw new Error(await response.text());
console.log(response.status === 204 ? {status: 204} : await response.json());Response examples {"upload_url":"https://api.fourhz.ai/v1/asr/pre-recorded/upload/fup_example"}{"id":"tr_01J...","status":"queued"}List transcripts Request parameters Parameter Type Required Description limitinteger No Page size, default 20; the server caps the maximum. statusstring No Filter by queued, processing, completed, or error. after_idstring No Continue pagination after this ID.
Response fields Field Type Meaning and availability page_detailsobject Pagination metadata: limit, result_count, current_url, prev_url, next_url. transcriptsarray Transcript records on this page. transcripts[].idstring Transcript ID. transcripts[].statusstring Current processing status.
Request example cURL Python JavaScript
curl -X GET 'https://api.fourhz.ai/v1/asr/pre-recorded/transcript?limit=20&status=completed&after_id=tr_01J...' \
-H "Authorization: $FOURHZ_API_KEY"# pip install requests
import os
import requests
from contextlib import ExitStack
url = "https://api.fourhz.ai/v1/asr/pre-recorded/transcript?limit=20&status=completed&after_id=tr_01J..."
headers = {"Authorization": os.environ["FOURHZ_API_KEY"]}
with ExitStack() as stack:
response = requests.request("GET", url, headers=headers, timeout=300)
response.raise_for_status()
print(response.json() if response.content else {"status": response.status_code})// Node.js 22+
import {readFile} from 'node:fs/promises';
const url = "https://api.fourhz.ai/v1/asr/pre-recorded/transcript?limit=20&status=completed&after_id=tr_01J...";
const headers = {"Authorization": process.env.FOURHZ_API_KEY};
const response = await fetch(url, {method: "GET", headers, signal: AbortSignal.timeout(300000)});
if (!response.ok) throw new Error(await response.text());
console.log(response.status === 204 ? {status: 204} : await response.json());Response example {"page_details":{"limit":20,"result_count":1,"current_url":"/v1/asr/pre-recorded/transcript?limit=20","prev_url":null,"next_url":null},"transcripts":[{"id":"tr_01J...","status":"completed","text":"Hello world."}]}Get transcript info Request parameters Parameter Type Required Description idstring Yes Transcript ID in the path.
Response fields Field Type Meaning and availability idstring Transcript ID for polling and deletion; not a task_id alias. statusstring queued, processing, completed, or error. textstring? Full transcript after completion. audio_durationnumber? Audio duration in seconds when returned by PRE. errorstring? Failure reason; stop polling on error. speaker_label / utterances[].speakerstring Anonymous role A/B/… or UNKNOWN, not a real-person identity. utterances[].start / endinteger PRE/SYNC utterance start/end in milliseconds. utterances[].textstring Text of this speaker’s utterance. utterances[].fourhz_enrollment_idstring? Complete enrollment ID after a successful candidate match. utterances[].fourhz_similaritynumber? Match similarity, not transcript confidence; never invent a missing score. language_codestring? Detected language code. wordsarray? Word-level timestamps when returned. confidencenumber? Overall confidence when returned. utterancesarray? Utterance list; diarization includes speaker.
Request example cURL Python JavaScript
curl -X GET 'https://api.fourhz.ai/v1/asr/pre-recorded/transcript/TRANSCRIPT_ID' \
-H "Authorization: $FOURHZ_API_KEY"# pip install requests
import os
import requests
from contextlib import ExitStack
url = "https://api.fourhz.ai/v1/asr/pre-recorded/transcript/TRANSCRIPT_ID"
headers = {"Authorization": os.environ["FOURHZ_API_KEY"]}
with ExitStack() as stack:
response = requests.request("GET", url, headers=headers, timeout=300)
response.raise_for_status()
print(response.json() if response.content else {"status": response.status_code})// Node.js 22+
import {readFile} from 'node:fs/promises';
const url = "https://api.fourhz.ai/v1/asr/pre-recorded/transcript/TRANSCRIPT_ID";
const headers = {"Authorization": process.env.FOURHZ_API_KEY};
const response = await fetch(url, {method: "GET", headers, signal: AbortSignal.timeout(300000)});
if (!response.ok) throw new Error(await response.text());
console.log(response.status === 204 ? {status: 204} : await response.json());Response example {"id":"tr_01J...","status":"completed","text":"Hello world.","audio_duration":4.2,"language_code":"en","words":[]}Delete transcript Request parameters Parameter Type Required Description idstring Yes Transcript ID in the path.
Response fields Field Type Meaning and availability statusinteger Successful deletion returns HTTP 204 with no body.
Request example cURL Python JavaScript
curl -X DELETE 'https://api.fourhz.ai/v1/asr/pre-recorded/transcript/TRANSCRIPT_ID' \
-H "Authorization: $FOURHZ_API_KEY"# pip install requests
import os
import requests
from contextlib import ExitStack
url = "https://api.fourhz.ai/v1/asr/pre-recorded/transcript/TRANSCRIPT_ID"
headers = {"Authorization": os.environ["FOURHZ_API_KEY"]}
with ExitStack() as stack:
response = requests.request("DELETE", url, headers=headers, timeout=300)
response.raise_for_status()
print(response.json() if response.content else {"status": response.status_code})// Node.js 22+
import {readFile} from 'node:fs/promises';
const url = "https://api.fourhz.ai/v1/asr/pre-recorded/transcript/TRANSCRIPT_ID";
const headers = {"Authorization": process.env.FOURHZ_API_KEY};
const response = await fetch(url, {method: "DELETE", headers, signal: AbortSignal.timeout(300000)});
if (!response.ok) throw new Error(await response.text());
console.log(response.status === 204 ? {status: 204} : await response.json());Response example Error codes Every HTTP error body contains error_code (machine-readable) and message (human-readable). Legacy fields such as detail, code/msg or an upstream error object are kept and status codes are unchanged. Clients should read error_code and message first.
HTTP Code Meaning
400 invalid_request / invalid_configmalformed field, unknown field, or conflicting combination (the message names the field)
400 unsupported_featurerequested a capability the chosen model does not serve: speaker parameters or fourhz_hotword_pool_id under Spectrum, timestamps=true on any model, ...
401 / 402 — authentication failed / insufficient balance
404 — transcript or upload not found or not owned by your account (another account's upload ID returns the same 404 as a missing one)
413 / 422 — upload over 512 MiB / remote audio download or decode failure
429 — rate limited; response carries Retry-After