Skip to main content

Transcribe

The /transcribe endpoint allows you to convert medical audio recordings into structured clinical notes. It uses advanced speech recognition technology to transcribe the audio and then formats the transcription into a structured clinical note based on the specified template.

Endpoint

POST /transcribe

Authentication

This endpoint requires authentication using your API key. Include your API key in the x-api-key header with all requests. See Authentication for more details.

Request

The request must be sent as multipart/form-data with the following parameters:

ParameterTypeRequiredDescription
fileFileYesThe audio file to transcribe. Must be one of the supported formats and under 100MB.
note_typeStringNoThe clinical note type that determines the appropriate template and sections. See Note Types for available options.
templateStringNoThe specific template to use for the medical note. If provided, this overrides the default template for the selected note_type. See Note Templates for available options. Defaults to SOAP if not provided.
languageStringNoThe language of the audio. See Language Support for available options. Defaults to en (English).

Response

The response is a JSON object with the following structure:

{
"note": {
"title": "Medical Consultation Note",
"sections": [
{
"key": "SUBJECTIVE",
"title": "Subjective",
"content": "Patient reports chest pain for the past 3 days..."
},
{
"key": "OBJECTIVE",
"title": "Objective",
"content": "BP 140/90, HR 88, RR 18, Temp 98.6F..."
},
{
"key": "ASSESSMENT",
"title": "Assessment",
"content": "1. Acute coronary syndrome - likely..."
},
{
"key": "PLAN",
"title": "Plan",
"content": "1. Admit to cardiology service..."
}
]
}
}
FieldTypeDescription
noteObjectThe structured medical note generated from the transcription.
note.titleStringThe title of the medical note.
note.sectionsArrayAn array of sections in the note. The specific sections depend on the template used.
note.sections[].keyStringThe identifier for the section (e.g., "SUBJECTIVE", "OBJECTIVE").
note.sections[].titleStringThe display title for the section.
note.sections[].contentStringThe content of the section.

Key Concepts

Note Types

The note_type parameter allows you to specify the type of clinical note you want to generate. Each note type is associated with a default template that structures the output in a way that's appropriate for that type of clinical documentation.

Available note types:

Note TypeDescriptionDefault Template
PROGRESS_NOTEDocumentation of a patient's progress during treatmentSOAP
ADMISSION_NOTEDocumentation of a patient's initial hospital admissionAPSO
ED_NOTEDocumentation of an emergency department visitCHEDDAR
DISCHARGE_SUMMARYSummary of a patient's hospital stay upon dischargeMULTIPLE_SECTIONS
CONSULT_NOTEDocumentation of a specialist consultationAPSO
NURSING_NOTEDocumentation by nursing staffPIE
BEHAVIORAL_HEALTH_NOTEDocumentation of behavioral health servicesBIRP
DIETITIAN_NOTEDocumentation by a dietitianADIME

Note Templates

The template parameter allows you to specify the structure of the generated clinical note. If provided, it overrides the default template associated with the selected note_type.

Available templates:

TemplateDescriptionSections
SOAPSubjective, Objective, Assessment, PlanSUBJECTIVE, OBJECTIVE, ASSESSMENT, PLAN
APSOAssessment, Plan, Subjective, Objective (prioritizes assessment and plan)ASSESSMENT, PLAN, SUBJECTIVE, OBJECTIVE
MULTIPLE_SECTIONSComprehensive note with multiple detailed sectionsCHIEF_COMPLAINT, HISTORY_OF_PRESENT_ILLNESS, PAST_MEDICAL_HISTORY, PHYSICAL_EXAM, ASSESSMENT, PLAN
CHEDDARChief complaint, History, Examination, Differential, Decision, Action, ReviewCHIEF_COMPLAINT, HISTORY, EXAMINATION, DIFFERENTIAL, DECISION, ACTION, REVIEW
DAPData, Assessment, PlanDATA, ASSESSMENT, PLAN
PIEProblem, Intervention, EvaluationPROBLEM, INTERVENTION, EVALUATION
SBARSituation, Background, Assessment, RecommendationSITUATION, BACKGROUND, ASSESSMENT, RECOMMENDATION
BIRPBehavior, Intervention, Response, PlanBEHAVIOR, INTERVENTION, RESPONSE, PLAN
DARData, Action, ResponseDATA, ACTION, RESPONSE
ADIMEAssessment, Diagnosis, Intervention, Monitoring, EvaluationASSESSMENT, DIAGNOSIS, INTERVENTION, MONITORING, EVALUATION

Audio Processing

The /transcribe endpoint supports the following audio formats:

  • audio/mpeg (MP3)
  • audio/mp4 (M4A)
  • audio/wav (WAV)
  • audio/x-wav (WAV)
  • audio/vnd.wave (WAV)
  • audio/wave (WAV)
  • audio/x-pn-wav (WAV)
  • audio/webm (WEBM)
  • audio/ogg (OGG)
  • audio/flac (FLAC)
  • audio/x-flac (FLAC)
  • audio/aac (AAC)
  • audio/x-aac (AAC)

The maximum file size is 100MB. Larger files will be rejected with a 413 error.

The service performs diarization, which means it identifies different speakers in the audio and labels them in the transcript (e.g., "Speaker 1", "Speaker 2"). This helps maintain the conversational context in the generated note.

Language Support

The /transcribe endpoint supports the following languages:

Language CodeLanguage Name
enEnglish (default)
esSpanish
ptPortuguese

The language parameter affects both the speech recognition model used for transcription and the language of the generated clinical note. For optimal results, ensure the specified language matches the language spoken in the audio.

Medical Content Validation

The API checks if the transcribed content contains relevant medical discussion. If the content is not medical in nature (e.g., a casual conversation unrelated to healthcare), the API will return a 400 error with a message indicating that the audio does not contain relevant medical content.

This validation helps ensure that the service is used for its intended purpose and prevents processing of non-medical audio.

Integration Examples

cURL

curl -X POST https://api.knidian.ai/transcribe \
-H "x-api-key: YOUR_API_KEY" \
-F "file=@patient_consultation.mp3" \
-F "note_type=PROGRESS_NOTE" \
-F "language=en"

Python

import requests

url = "https://api.knidian.ai/transcribe"
headers = {
"x-api-key": "YOUR_API_KEY"
}

files = {
"file": ("patient_consultation.mp3", open("patient_consultation.mp3", "rb"), "audio/mpeg")
}

data = {
"note_type": "PROGRESS_NOTE",
"language": "en"
}

response = requests.post(url, headers=headers, files=files, data=data)
print(response.json())

Node.js

const axios = require('axios');
const FormData = require('form-data');
const fs = require('fs');
const path = require('path');

async function transcribeAudio() {
const form = new FormData();
form.append('file', fs.createReadStream(path.resolve('./patient_consultation.mp3')));
form.append('note_type', 'PROGRESS_NOTE');
form.append('language', 'en');

try {
const response = await axios.post('https://api.knidian.ai/transcribe', form, {
headers: {
...form.getHeaders(),
'x-api-key': 'YOUR_API_KEY'
}
});
console.log(response.data);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);
}
}

transcribeAudio();

Error Handling

Status CodeDescription
400Bad Request - Invalid parameters or the audio does not contain relevant medical content
401Unauthorized - Invalid or missing API key
402Payment Required - Subscription limit reached or payment required
413Payload Too Large - Audio file exceeds the 100MB limit
415Unsupported Media Type - Unsupported audio format
500Internal Server Error - An unexpected error occurred on the server
503Service Unavailable - The service is temporarily unavailable

Usage Tracking

The API tracks the following metrics for each transcription request:

  • Request duration
  • Audio duration (in seconds)
  • Knidian's AI Engine processing time
  • Success/failure status

These metrics are used for billing purposes and to improve the service. They are associated with your API key and organization.