SOAPNoteAPI
TutorialAPIPythonNode.js

How to Generate SOAP Notes Programmatically in 2026

A complete developer guide to generating structured clinical documentation via API — with working code in Python, Node.js, and cURL.

March 21, 2026·12 min read

TL;DR

The fastest way to generate SOAP notes programmatically is to use a clinical documentation API. SOAPNoteAPI lets you POST a transcript or upload audio and receive a structured SOAP note (Subjective, Objective, Assessment, Plan) as JSON — in under 8 seconds for text, under 60 seconds for audio. It supports 24 medical specialties, is HIPAA-compliant with a signed BAA, and costs $0.50/note (with $10 free credit to start).

What is a SOAP note?

A SOAP note is a structured clinical documentation format used by healthcare providers to record patient encounters. SOAP stands for:

  • Subjective — What the patient reports: symptoms, history, chief complaint.
  • Objective — What the provider observes: vitals, exam findings, test results.
  • Assessment — The provider's clinical assessment, differential diagnoses, and ICD-10 codes.
  • Plan — Treatment plan: medications, referrals, follow-up instructions.

Generating SOAP notes programmatically means using software to produce this structured output from unstructured clinical input — typically a transcript of the patient encounter or an audio recording.

Three approaches to generating SOAP notes programmatically

If you're building a healthcare application that needs SOAP note generation, you have three main options:

ApproachTime to shipCost per noteHIPAABest for
Purpose-built API (SOAPNoteAPI)Hours$0.20–$0.50BAA includedMost teams — ship fast, no ML expertise needed
Build with OpenAI/Claude3–6 months$0.03–$0.15 + eng timeYou manage BAA + complianceTeams with clinical NLP expertise who need deep customization
AWS HealthScribeWeeks~$1.50/encounterHIPAA eligibleTeams already in AWS wanting transcription (not structured SOAP output)

This guide focuses on the first approach — using a purpose-built clinical documentation API — because it is the fastest path from zero to production-quality SOAP notes.

How do I generate a SOAP note from text?

The simplest way to generate a SOAP note is to POST a clinical transcript to the POST /v1/note endpoint. You provide the transcript text and a medical specialty, and the API returns a structured JSON object with S, O, A, and P sections.

Step 1: Get an API key

Sign up for free — you get a $10 credit instantly (approximately 20 notes). No credit card required.

Step 2: Make a request

cURL

cURL — generate a SOAP note
curl -X POST https://api.soapnoteapi.com/v1/note \
  -H "Authorization: Bearer $SOAPNOTE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "transcript": "Patient is a 42-year-old male presenting with persistent lower back pain for 3 weeks. Pain rated 6/10, worse with sitting. Ibuprofen provides moderate relief. Exam shows lumbar paraspinal tenderness L3-L5, ROM restricted at 40 degrees flexion. SLR negative bilaterally.",
    "specialty": "nurse_practitioner",
    "template": "standard"
  }'

Python

Python — generate a SOAP note
import os
import requests

response = requests.post(
    "https://api.soapnoteapi.com/v1/note",
    headers={"Authorization": f"Bearer {os.environ['SOAPNOTE_API_KEY']}"},
    json={
        "transcript": "Patient is a 42-year-old male presenting with persistent lower back pain...",
        "specialty": "nurse_practitioner",
        "template": "standard",
    },
)

note = response.json()
print(note["subjective"])
print(note["objective"])
print(note["assessment"])
print(note["plan"])

Node.js

Node.js — generate a SOAP note
const response = await fetch("https://api.soapnoteapi.com/v1/note", {
  method: "POST",
  headers: {
    "Authorization": `Bearer ${process.env.SOAPNOTE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    transcript: "Patient is a 42-year-old male presenting with persistent lower back pain...",
    specialty: "nurse_practitioner",
    template: "standard",
  }),
});

const note = await response.json();
console.log(note.subjective);
console.log(note.objective);
console.log(note.assessment);
console.log(note.plan);

Step 3: Parse the response

The API returns a JSON object with each SOAP section as a separate field:

Response JSON
{
  "noteId": "note_01jfg8h...",
  "subjective": "42-year-old male with 3-week history of lower back pain, rated 6/10...",
  "objective": "Lumbar ROM restricted at 40° flexion. Paraspinal tenderness L3-L5...",
  "assessment": "Mechanical lower back pain, likely muscular. Rule out disc herniation...",
  "plan": "1. NSAIDs PRN. 2. Physical therapy referral. 3. Follow-up in 4 weeks...",
  "expires_at": "2027-01-15T00:00:00Z"
}

Response time is under 8 seconds for text input. Each field is a string you can store in your database, display in your UI, or push to an EHR system.

How do I generate a SOAP note from audio?

SOAPNoteAPI accepts audio file uploads directly — the API handles transcription and SOAP generation in a single request. Supported formats: MP3, M4A, WAV, OGG, WebM, and FLAC.

Python — audio upload
import os
import requests

with open("recording.mp3", "rb") as audio_file:
    response = requests.post(
        "https://api.soapnoteapi.com/v1/note/audio",
        headers={"Authorization": f"Bearer {os.environ['SOAPNOTE_API_KEY']}"},
        files={"audio": ("recording.mp3", audio_file, "audio/mpeg")},
        data={"specialty": "physician", "template": "standard"},
    )

note = response.json()
# Returns the same SOAP JSON structure as text-to-SOAP

Audio processing completes in under 60 seconds. For longer recordings, use webhooks for async delivery.

How do I stream SOAP notes in real time?

Use the streaming endpoint POST /v1/stream/note instead of /v1/note. The API returns Server-Sent Events (SSE) — each SOAP section streams as it generates. This lets you display results to providers progressively instead of waiting for the full response.

Streaming endpoint
// Same request body, different endpoint
POST https://api.soapnoteapi.com/v1/stream/note
Accept: text/event-stream

{
  "transcript": "...",
  "specialty": "nurse_practitioner"
}

See the streaming guide for complete SSE parsing examples in Python, Node.js, and the browser.

Which medical specialties are supported?

SOAPNoteAPI supports 24 medical specialties, each with specialty-specific output structure and terminology. Pass the specialty parameter in your request:

Nurse PractitionerPhysicianPsychiatristPsychotherapistPhysical TherapyOccupational TherapyChiropractorDentistAcupunctureSocial WorkerRegistered NurseSpeech Language PathologyVeterinaryMassage TherapyPharmacyPodiatristDietitian / NutritionistAthletic TrainerEmergency Medical ServicesParamedicGenetic CounselingGeneric

How do I add ICD-10 and CPT billing codes?

Add "include_billing_codes": true to your request. The response includes suggested ICD-10 and CPT codes derived from the clinical content — ready for review before submission.

See the billing codes guide for a complete walkthrough.

Is it HIPAA compliant to generate SOAP notes via API?

Yes — if the API provider meets HIPAA requirements. Here is what to look for:

  • Business Associate Agreement (BAA) — The API provider must sign a BAA with you. SOAPNoteAPI includes a signed BAA at no extra cost.
  • Encryption in transit — All data must be transmitted over TLS 1.2+. SOAPNoteAPI enforces this on all endpoints.
  • Encryption at rest — PHI must be encrypted at rest. SOAPNoteAPI uses AES-256.
  • Data retention — PHI should not be stored indefinitely. SOAPNoteAPI notes auto-expire after a configurable retention period.
  • No PHI in logs — Application logs must not contain patient data. SOAPNoteAPI does not log PHI.
  • No model training — Your data should not be used to train AI models. SOAPNoteAPI does not use customer data for training.

See the Security & Compliance page for full details.

Should I build my own SOAP note generator with OpenAI?

Many developers consider building SOAP note generation with raw OpenAI or Anthropic APIs. Here is the hidden complexity:

ConsiderationBuild with OpenAISOAPNoteAPI
Prompt engineeringBuild and maintain prompts for each of 24+ specialtiesHandled — pass a specialty parameter
Output validationBuild parsers to extract S/O/A/P from free-text LLM outputHandled — structured JSON with named fields
HIPAA complianceObtain BAA from OpenAI, build audit logging, ensure no PHI in logsHandled — BAA included, no PHI in logs
Audio transcriptionIntegrate a separate transcription service, chain with note generationHandled — single endpoint for audio-to-SOAP
Billing codesBuild ICD-10/CPT suggestion logic on top of LLM outputHandled — add a parameter
Time to production3–6 monthsHours

When to build in-house: You have a dedicated clinical NLP team, need deeply customized note formats, or are building a differentiated documentation product.

When to use SOAPNoteAPI: You want to ship fast, your core product is not documentation, you need verified specialty-specific output, or you want HIPAA compliance handled for you.

Frequently asked questions

What is the fastest way to generate SOAP notes programmatically?

Use a clinical documentation API like SOAPNoteAPI. Send a POST request with a transcript and specialty, and receive a structured SOAP note as JSON in under 8 seconds.

Can I generate SOAP notes from audio recordings?

Yes. SOAPNoteAPI accepts audio uploads (MP3, M4A, WAV, OGG, WebM, FLAC) via multipart/form-data. The API handles transcription and SOAP generation in a single request, returning results in under 60 seconds.

Is it HIPAA compliant to use an API for SOAP notes?

Yes, if the API provider offers a Business Associate Agreement (BAA), encrypts data in transit and at rest, and does not retain PHI beyond the configured period. SOAPNoteAPI includes a signed BAA at no extra cost.

How much does it cost to generate SOAP notes via API?

SOAPNoteAPI charges $0.50 per note on pay-as-you-go, with graduated pricing down to $0.20/note at 100,000+ volume. New accounts get $10 free credit (approximately 20 notes) with no credit card required.

Should I build my own SOAP note generator with OpenAI or use a dedicated API?

Building with raw OpenAI/GPT requires prompt engineering for each specialty, output validation, HIPAA compliance setup, and ongoing maintenance — typically 3-6 months. A purpose-built API like SOAPNoteAPI handles all of this. Build in-house only if you need deep customization or have a clinical NLP team.

Generate your first SOAP note in 60 seconds

$10 free credit on signup. No credit card required. Works with any HTTP client.