Try this endpoint →

Service endpoints

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

Method / ProtocolPathContent-Type / FramesAuth
POST/v1/asr/syncmultipart/form-dataAuthorization: <API Key>

Prepare the target voice

Enroll the target voice and use the complete enrollment_id as fourhz_enrollment_id. Do not send speaker_labels or fourhz_identify_candidates; this mode only transcribes the target speaker.

Speaker enrollment

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

FieldTypeRequiredDescription
modelstringYesfourhz-focusSelect the speech recognition model for this endpoint.
fourhz_enrollment_idstringYes—Complete enrollment_id of an enrolled voiceprint identifying the target speaker.
speaker_vadbooleanNofalseOptional; defaults to false (disabled). Set true to enable additional voiceprint activity detection; requires fourhz_enrollment_id.
reject_background_speechbooleanSet true to enable background speech rejection.
audiofileYesWAV or raw PCM16LE; 80 ms–30 s, up to 40 MB.
channelsintegerPCM onlyMust be 1.
language_codesstringNozh or en; omit for auto-detection.
keyterms_promptstringNoUp to 100 comma-separated terms.
fourhz_cleanup_levelstringNooff (default), light, or standard.
fourhz_translate_modebooleanNoEnables translation and requires a target language when true.
fourhz_target_languagestringConditionalTranslation target, for example en.
fourhz_text_emotionbooleanNoUses speech emotion during text post-processing.
fourhz_hotword_pool_idstringNoAn existing hotword pool ID.

Response fields

FieldTypeMeaning and availability
textstringFull transcript; target mode contains the target speaker’s output.
audio_duration_msnumberSYNC processed audio duration in milliseconds.
session_idstringSYNC task/correlation ID.
request_time_msnumberSYNC server processing time in milliseconds.
error_codestringStable error code on failure.
messagestringHuman-readable error message.
fourhz_target_speaker.enrollment_idstringTarget enrollment ID used.
fourhz_target_speaker.appliedbooleanTarget conditioning evidence reported by the model chain.
fourhz_target_speaker.speaker_vad_appliedboolean?Whether speaker gating actually took effect. When speaker_vad=true was requested but gating did not apply (for example the voiceprint lacks a verification reference, so all segments are transcribed fail-open), it is false and fourhz_target_speaker.fallback_reason gives the reason (such as speaker_reference_unavailable).
fourhz_target_speaker.fallback_reasonstring?Present only when gating was requested but speaker_vad_applied=false; explains why.

Request examples

Code samples

curl -X POST 'https://api.fourhz.ai/v1/asr/sync' \
  -H "Authorization: $FOURHZ_API_KEY" \
  -F 'audio=@sample.wav' \
  -F 'model=fourhz-focus' \
  -F 'fourhz_enrollment_id=enr_example' \
  -F 'speaker_vad=false'

Sending and receiving

Response and results

{
  "text": "Hello world.",
  "audio_duration_ms": 4200,
  "session_id": "task-example",
  "request_time_ms": 1834.6,
  "fourhz_target_speaker": {
    "enrollment_id": "enr_example",
    "applied": true
  }
}

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 values are status codes. Except for detail responses such as 401/402, the body uses {"error_code":"…","message":"…"}. These codes apply to the synchronous API.

HTTPResponse codeMeaning
HTTP 400bad_audio / audio_too_short / invalid_candidatesAudio cannot be decoded, is too short, or the candidate voiceprint set is invalid.
HTTP 401detailMissing or invalid API key.
HTTP 402detailInsufficient balance.
HTTP 413audio_too_largeDecoded audio exceeds the duration limit.
HTTP 415unsupported_media_typeUnsupported container format, or the file content is not audio (for example a text file renamed to .mp3).
HTTP 422unsupported_capability / enrollment_*The selected model/capability is unavailable, or enrollment constraints are not met.
HTTP 429capacity_exceededCapacity is currently exhausted; follow Retry-After.
HTTP 500/504inference_error / inference_timeoutUpstream inference failed or exceeded the wait budget.
HTTP 503service_unavailableThe selected backend is unavailable.

Speaker VAD

speaker_vad · boolean

Optional; defaults to false (disabled). Set false to disable auxiliary speaker activity detection. Target-speaker recognition still uses fourhz_enrollment_id; acoustic VAD and duration-based segmentation remain enabled.

"speaker_vad": false