Try this endpoint →

Service endpoints

Service URL: https://api.fourhz.ai

Method / ProtocolPathContent-Type / FramesAuth
POST/v1/asr/pre-recorded/uploadapplication/octet-streamAuthorization: <API Key>
POST/v1/asr/pre-recorded/transcriptapplication/jsonAuthorization: <API Key>
GET/v1/asr/pre-recorded/transcriptqueryAuthorization: <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

Request parameters

FieldTypeDescription
audio_urlstringRequired. Upload binary audio to POST /v1/asr/pre-recorded/upload first and use its upload_url.
speech_modelstringDefaults to fourhz-spectrum.
language_codestringOptional zh or en; omit for auto-detection.
keyterms_promptstring[]Up to 1,000 direct keyterms, 50 characters each. word_boost is an alias; send only one.
cleanup_levelstringoff (default), light or standard. Standard removes clear filler words and adjacent repetitions.
translate_modebooleanDefaults to false. When combined with cleanup, translates the cleaned source.
target_languagestringRequired when translate_mode=true; e.g. en or zh.
cleanup_text_emotionbooleanDefaults to false, independently of cleanup and translation. Returns emotion results and status.
hotword_pool_idstringReference a complete enabled pool of up to 1,000 words; the 100-term direct realtime/sync limit does not apply. Create and manage pools →
reject_background_speechbooleanBackground-speech rejection. Optional; defaults to true (enabled). Set to false to disable. Top-level field in the JSON body when creating a transcript.

Independent enhancement results

Cleanup, translation and emotion may be enabled independently or together. Realtime fields arrive in FourHzPostprocessing events; Turn retains the raw transcript. Sync/pre-recorded text prefers translation, then cleanup or keyterm correction, while preserving the independent result fields.

FieldTypeDescription
cleaned_textstringCleaned or keyterm-corrected source-language text.
translated_textstringTarget-language translation, using the cleaned source when combined.
cleanup_status / translation_statusstringcompleted indicates success; degraded_raw_only/degraded_partial indicates fallback or incomplete processing.
emotion_statusstringcompleted or degraded. Failure is not silently reported as success.
emotionsobject[]Sync/pre-recorded emotion results with mode, label and text; realtime uses emotion.bucket events.

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

ParameterTypeRequiredDescription
filebinaryNoAudio file; use the returned upload_url as audio_url; choose it or audio_url.
audio_urlstringNoURL of an uploaded file; choose it or file.
speech_modelstringNoSpeech model name. Default fourhz-spectrum

Response fields

FieldTypeMeaning and availability
upload_urlstringURL used to create the transcript after upload.
idstringCreated transcript ID.
statusstringqueued, processing, completed, or error.

Request examples

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
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-spectrum"
}'

Response examples

{"upload_url":"https://api.fourhz.ai/v1/asr/pre-recorded/upload/fup_example"}
{"id":"tr_01J...","status":"queued"}

List transcripts

Request parameters

ParameterTypeRequiredDescription
limitintegerNoPage size, default 20; the server caps the maximum.
statusstringNoFilter by queued, processing, completed, or error.
after_idstringNoContinue pagination after this ID.

Response fields

FieldTypeMeaning and availability
page_detailsobjectPagination metadata: limit, result_count, current_url, prev_url, next_url.
transcriptsarrayTranscript records on this page.
transcripts[].idstringTranscript ID.
transcripts[].statusstringCurrent processing status.

Request example

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"

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

ParameterTypeRequiredDescription
idstringYesTranscript ID in the path.

Response fields

FieldTypeMeaning and availability
idstringTranscript ID for polling and deletion; not a task_id alias.
statusstringqueued, 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.
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 -X GET 'https://api.fourhz.ai/v1/asr/pre-recorded/transcript/TRANSCRIPT_ID' \
  -H "Authorization: $FOURHZ_API_KEY"

Response example

{"id":"tr_01J...","status":"completed","text":"Hello world.","audio_duration":4.2,"language_code":"en","words":[]}

Delete transcript

Request parameters

ParameterTypeRequiredDescription
idstringYesTranscript ID in the path.

Response fields

FieldTypeMeaning and availability
statusintegerSuccessful deletion returns HTTP 204 with no body.

Request example

curl -X DELETE 'https://api.fourhz.ai/v1/asr/pre-recorded/transcript/TRANSCRIPT_ID' \
  -H "Authorization: $FOURHZ_API_KEY"

Response example

HTTP/1.1 204 No Content

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.

HTTPCodeMeaning
400invalid_request / invalid_configmalformed field, unknown field, or conflicting combination (the message names the field)
400unsupported_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