Skip to content

Prerecorded

Transcribe a complete audio file.

POST https://api.reson8.dev/v1/speech-to-text/prerecorded

Request

Headers

Header Value
Authorization ApiKey <api_key> or Bearer <access_token>
Content-Type application/octet-stream

Query Parameters

Parameter Type Default Description
encoding string auto Audio encoding: auto or pcm_s16le
sample_rate number 16000 Sample rate in Hz (only used depending on encoding)
channels number 1 Number of audio channels (only used depending on encoding)
custom_model_id string Optional. ID of a custom model to bias transcription. Overrides the model configured on the API client
include_timestamps boolean false Include start_ms and duration_ms on transcripts and words
include_words boolean false Include word-level detail on transcripts
include_confidence boolean false Include confidence on words

Example

curl -X POST "https://api.reson8.dev/v1/speech-to-text/prerecorded" \
  -H "Authorization: ApiKey <your_api_key>" \
  -H "Content-Type: application/octet-stream" \
  --data-binary @recording.wav
import requests

with open("recording.wav", "rb") as f:
    response = requests.post(
        "https://api.reson8.dev/v1/speech-to-text/prerecorded",
        headers={
            "Authorization": "ApiKey <your_api_key>",
            "Content-Type": "application/octet-stream",
        },
        data=f,
    )

transcript = response.json()

Response

200 OK

Fields

Field Type Included Description
text string Always Full transcript of the audio file
start_ms number When include_timestamps=true Start time in milliseconds
duration_ms number When include_timestamps=true Duration in milliseconds
words array When include_words=true Word-level detail

Each word contains:

Field Type Included Description
text string Always The recognized word
start_ms number When include_timestamps=true Start time in milliseconds
duration_ms number When include_timestamps=true Duration in milliseconds
confidence number When include_confidence=true Confidence score (0 to 1)

Example

{
  "text": "the patient presented with chest pain and shortness of breath"
}
{
  "text": "the patient presented with chest pain and shortness of breath",
  "start_ms": 0,
  "duration_ms": 4800,
  "words": [
    { "text": "the", "start_ms": 0, "duration_ms": 200, "confidence": 0.99 },
    { "text": "patient", "start_ms": 210, "duration_ms": 450, "confidence": 0.98 },
    { "text": "presented", "start_ms": 680, "duration_ms": 500, "confidence": 0.97 },
    { "text": "with", "start_ms": 1200, "duration_ms": 200, "confidence": 0.99 },
    { "text": "chest", "start_ms": 1420, "duration_ms": 350, "confidence": 0.96 },
    { "text": "pain", "start_ms": 1800, "duration_ms": 600, "confidence": 0.97 },
    { "text": "and", "start_ms": 2500, "duration_ms": 200, "confidence": 0.99 },
    { "text": "shortness", "start_ms": 2720, "duration_ms": 500, "confidence": 0.95 },
    { "text": "of", "start_ms": 3240, "duration_ms": 150, "confidence": 0.99 },
    { "text": "breath", "start_ms": 3410, "duration_ms": 1390, "confidence": 0.96 }
  ]
}

Errors

Status Code Description
400 INVALID_REQUEST Missing or invalid parameters
401 UNAUTHORIZED Invalid or expired access token
413 PAYLOAD_TOO_LARGE Audio file exceeds maximum size
500 INTERNAL_ERROR Unexpected server error