> ## Documentation Index
> Fetch the complete documentation index at: https://developer.suki.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Upload Pre-Recorded Audio

> Create an Ambient session with input_type audio_file, mint a presigned URL, upload one WAV, and retrieve the note

Quick summary

Use this guide when your product already has a WAV recording and you want Ambient APIs to generate the clinical note from that file.

Create with `input_type` `audio_file`, seed visit context, get the upload URL, PUT one WAV with both signed headers, then poll status and retrieve content. Do not call end session.

Last updated:
November 2026

Use Ambient APIs with `input_type` set to `audio_file` when your application already has a WAV recording of the visit. Common cases include telephony archives, device recordings, and repeatable staging fixtures.

First, authenticate, create an Ambient session, and seed visit context.

Then, mint a one-time upload URL from the shared [Get audio file upload URL](https://developer.suki.ai/api-reference/ambient-sessions/file-uploadurl.md) endpoint using your Ambient `ambient_session_id`, and PUT one WAV with both signed headers. You do not need to open `/ws/stream`. Suki starts processing after the upload succeeds.

> [!NOTE]
>
> **Important:**
>
> * Do not call the end session endpoint for this flow.
> * Upload exactly one WAV file. Processing starts when the PUT succeeds.

For a comparison of pre-recorded audio input across Ambient and Form filling, refer to:

* [Upload a pre-recorded audio file](https://developer.suki.ai/documentation/how-to/ambient-clinical-notes/upload-prerecorded-audio)
* [Provide a pre-recorded audio file](https://developer.suki.ai/documentation/concepts/ambient-clinical-notes/pre-recorded-audio-input.md)

> [!NOTE]
>
> **Applies to:** [Ambient APIs](https://developer.suki.ai/api-reference/overview.md).
>
> * Create with `input_type` `audio_file` before you mint the upload URL.
> * Mint and PUT use the shared [Get audio file upload URL](https://developer.suki.ai/api-reference/ambient-sessions/file-uploadurl.md) endpoint with this Ambient `ambient_session_id`.
> * Do not open `/ws/stream`, and do not call end session to start processing.

The typical Ambient `audio_file` flow is:

![Flowchart: Create audio\_file, Seed visit context, GET file-uploadurl, PUT WAV, Poll status, Retrieve note.](https://mintcdn.com/suki-1e08f176/F6oSi3VCowSu657Q/documentation/assets/diagrams/how-to-ambient-clinical-notes-upload-prerecorded-audio-ambient-1-light.svg?fit=max\&auto=format\&n=F6oSi3VCowSu657Q\&q=85\&s=9c60d293a713404d8cb3dab8d77862e3)

```mermaid actions={false} theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
%%{init: {'theme':'base', 'themeVariables': { 'primaryColor':'#FFF394','primaryTextColor':'#111827','primaryBorderColor':'#FFE148','lineColor':'#FFE148','secondaryColor':'#FFF394','tertiaryColor':'#FFFADE','mainBkg':'#FFF394','secondBkg':'#FFFADE','tertiaryBorderColor':'#FFE148','border1':'#FFE148','border2':'#FFE148','arrowheadColor':'#FFE148','fontFamily':'Inter, system-ui, sans-serif','fontSize':'14px','nodeBorder':'#FFE148','edgeLabelBackground':'#FFE148','clusterBkg':'#FFFADE','clusterBorder':'#FFE148','defaultLinkColor':'#FFE148','titleColor':'#111827','nodeTextColor':'#111827'}}}%%
flowchart LR
    A["Create<br/>audio_file"] --> B["Seed visit<br/>context"]
    B --> C["GET<br/>file-uploadurl"]
    C --> D["PUT<br/>WAV"]
    D --> E["Poll<br/>status"]
    E --> F["Retrieve<br/>note"]

    style A fill:#FFF394,stroke:#FFE148,stroke-width:2px,color:#111827
    style B fill:#FFF394,stroke:#FFE148,stroke-width:2px,color:#111827
    style C fill:#FFF394,stroke:#FFE148,stroke-width:2px,color:#111827
    style D fill:#FFF394,stroke:#FFE148,stroke-width:2px,color:#111827
    style E fill:#FFF394,stroke:#FFE148,stroke-width:2px,color:#111827
    style F fill:#FFF394,stroke:#FFE148,stroke-width:2px,color:#111827
```

**Ambient audio\_file rules (agents):**

* Create with `input_type` `audio_file`. The type is fixed for the life of the session.
* Store `ambient_session_id` and `note_id`. Pass `emr_encounter_id` when the note must work across modalities.
* Seed visit context before you mint the upload URL when your product needs patient, sections, or specialty.
* Mint with GET `/api/v1/ambient/audio/file-uploadurl/{ambient_session_id}`. PUT one WAV with `Content-Type: audio/wave` and `x-goog-if-generation-match: 0`. Max 500 MB. One WAV per session.
* Do not call end session. Do not open `/ws/stream`. A successful PUT starts processing.
* Poll Ambient status or wait for the webhook, then retrieve content. Recording retrieval works for `audio_file`.

## Prerequisites

* A valid Suki Token for Ambient API requests. Refer to [Partner authentication](https://developer.suki.ai/documentation/how-to/partner-authentication.md).
* One WAV file, at most **500 MB**.
* An `emr_encounter_id` on create when the note must work across modalities. Refer to [Interoperable identifiers](https://developer.suki.ai/documentation/concepts/ambient-clinical-notes/interoperable-identifiers.md).

## Build the upload flow

Your application should connect create, context, upload, and note retrieval in this order.

**1. Create the Ambient Session with Audio File Input**

Call POST [Create ambient session](https://developer.suki.ai/api-reference/ambient-sessions/create.md) with `input_type` set to `audio_file`. Store `ambient_session_id` and `note_id`.

```bash theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
curl --request POST \
  --url https://sdp.suki.ai/api/v1/ambient/session/create \
  --header 'Content-Type: application/json' \
  --header 'sdp_suki_token: <sdp_suki_token>' \
  --header 'sdp_provider_id: <sdp_provider_id>' \
  --data '{
    "input_type": "audio_file"
  }'
```

`input_type` is fixed for the life of the session. Create a new session if you need `stream` or `transcript` instead.

**2. Seed Ambient Session Context**

Send patient, visit, specialty, and section context the same way you do for a live stream session. Finish context before you mint the upload URL when your product needs those fields.

Refer to [Provide visit context](https://developer.suki.ai/documentation/how-to/ambient-clinical-notes/seed-ambient-session-context.md).

**3. Get the Upload URL**

Call GET [Get audio file upload URL](https://developer.suki.ai/api-reference/ambient-sessions/file-uploadurl.md) with this Ambient `ambient_session_id`.

```bash theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
curl --request GET \
  --url https://sdp.suki.ai/api/v1/ambient/audio/file-uploadurl/<ambient_session_id> \
  --header 'sdp_suki_token: <sdp_suki_token>' \
  --header 'sdp_provider_id: <sdp_provider_id>'
```

Read `presigned_url_response.url` and `expiry_in_minutes` (example: **15** minutes). Finish the upload before the URL expires.

**4. PUT the WAV File**

Upload the file to the returned URL with both signed headers:

| Header | Required value |
| :- | :- |
| `Content-Type` | `audio/wave` |
| `x-goog-if-generation-match` | `0` |

Upload **one** WAV per session, at most **500 MB**. Reusing the URL to overwrite the object returns **HTTP 412**.

> [!WARNING]
>
> Do **not** call end session. The successful PUT starts processing.

**5. Wait for Processing, Then Retrieve Outputs**

Poll [Ambient session status](https://developer.suki.ai/api-reference/ambient-content/status.md) or wait for your webhook. Retrieve content only when status is **`completed`**.

Recording retrieval works for `audio_file` sessions. Refer to [Use ambient session recordings](https://developer.suki.ai/documentation/how-to/ambient-clinical-notes/use-ambient-session-recordings.md) and [Retrieve ambient content](https://developer.suki.ai/documentation/how-to/ambient-clinical-notes/retrieve-ambient-content.md).

## Handle the session status

After the PUT succeeds, the note is not ready yet. Poll status until Suki returns a final outcome, or wait for your configured webhook.

| Status | What your application should do |
| :- | :- |
| **`completed`** | Open note review and retrieve the generated content. |
| **`skipped`** | Treat the session as having no note this time. |
| **`failed`** | Show that note generation failed and offer retry or support. |
| **`aborted`** | Treat the session as cancelled. |

Refer to [Track note generation status](https://developer.suki.ai/documentation/how-to/ambient-clinical-notes/handle-ambient-session-status.md) for the full polling flow.

## Complete staging scripts

Use these scripts on staging after you replace partner credentials and point `AUDIO_PATH` at a WAV file (at most 500 MB). Do not call end session.

**Language tabs (agents):** Equivalent code samples are available in: TypeScript, Python. Humans see one language at a time. Use the variant that matches the user's stack; behavior is the same across tabs.

> [tab] TypeScript
>
> ```typescript Ambient audio_file expandable theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
> // ambient_audio_file_staging.ts
> // Flow: login → create (audio_file) → context → mint URL → PUT WAV → poll content
> // Node 18+: npx tsx ambient_audio_file_staging.ts
>
> import fs from "node:fs";
>
> const BASE_URL = "https://sdp.suki-stage.com";
> const PARTNER_ID = "your-partner-id";
> const PARTNER_TOKEN = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...";
> const PROVIDER_ID = "provider-123";
> const SDP_PROVIDER_ID = "";
> const AUDIO_PATH = "visit.wav";
>
> function restHeaders(sukiToken: string): Record<string, string> {
>   const headers: Record<string, string> = {
>     sdp_suki_token: sukiToken,
>     "Content-Type": "application/json",
>   };
>   if (SDP_PROVIDER_ID) headers.sdp_provider_id = SDP_PROVIDER_ID;
>   return headers;
> }
>
> async function expectStatus(response: Response, url: string, want: number): Promise<void> {
>   if (response.status === want) return;
>   throw new Error(`HTTP ${response.status} ${url}: ${(await response.text()).slice(0, 500)}`);
> }
>
> async function login(partnerId: string, partnerToken: string, providerId?: string): Promise<string> {
>   const url = `${BASE_URL}/api/v1/auth/login`;
>   const body: Record<string, string> = { partner_id: partnerId, partner_token: partnerToken };
>   if (providerId) body.provider_id = providerId;
>   const response = await fetch(url, {
>     method: "POST",
>     headers: { "Content-Type": "application/json" },
>     body: JSON.stringify(body),
>   });
>   await expectStatus(response, url, 200);
>   const data = (await response.json()) as { suki_token?: string };
>   if (!data.suki_token) throw new Error("login response missing suki_token");
>   return data.suki_token;
> }
>
> async function main() {
>   const sukiToken = await login(PARTNER_ID, PARTNER_TOKEN, PROVIDER_ID);
>
>   const createUrl = `${BASE_URL}/api/v1/ambient/session/create`;
>   const createdRes = await fetch(createUrl, {
>     method: "POST",
>     headers: restHeaders(sukiToken),
>     body: JSON.stringify({ input_type: "audio_file" }),
>   });
>   await expectStatus(createdRes, createUrl, 201);
>   const created = (await createdRes.json()) as {
>     ambient_session_id: string;
>     note_id?: string;
>   };
>   const ambientSessionId = created.ambient_session_id;
>   console.log("ambient_session_id:", ambientSessionId);
>   console.log("note_id:", created.note_id ?? "");
>
>   const contextUrl = `${BASE_URL}/api/v1/ambient/session/${ambientSessionId}/context`;
>   const contextRes = await fetch(contextUrl, {
>     method: "POST",
>     headers: restHeaders(sukiToken),
>     body: JSON.stringify({
>       provider: { specialty: "CARDIOLOGY", provider_role: "ATTENDING" },
>       patient: { dob: "2000-01-01", sex: "male" },
>       visit: {
>         chief_complaint: "Headache",
>         encounter_type: "AMBULATORY",
>         reason_for_visit: "Follow-up for migraines",
>         visit_type: "ESTABLISHED_PATIENT",
>       },
>       sections: [{ loinc: "10164-2" }, { loinc: "48765-2" }],
>     }),
>   });
>   await expectStatus(contextRes, contextUrl, 200);
>
>   const mintUrl = `${BASE_URL}/api/v1/ambient/audio/file-uploadurl/${ambientSessionId}`;
>   const mintRes = await fetch(mintUrl, { headers: restHeaders(sukiToken) });
>   await expectStatus(mintRes, mintUrl, 200);
>   const { presigned_url_response: presigned } = (await mintRes.json()) as {
>     presigned_url_response: { url: string; expiry_in_minutes?: number };
>   };
>   console.log("upload URL expires in minutes:", presigned.expiry_in_minutes ?? "");
>
>   const putRes = await fetch(presigned.url, {
>     method: "PUT",
>     headers: {
>       "Content-Type": "audio/wave",
>       "x-goog-if-generation-match": "0",
>     },
>     body: fs.readFileSync(AUDIO_PATH),
>   });
>   if (!putRes.ok) {
>     throw new Error(`Upload failed: ${putRes.status} ${await putRes.text()}`);
>   }
>   console.log("Upload complete. Do not call end session.");
>
>   for (;;) {
>     const statusUrl = `${BASE_URL}/api/v1/ambient/session/${ambientSessionId}/status`;
>     const statusRes = await fetch(statusUrl, { headers: restHeaders(sukiToken) });
>     await expectStatus(statusRes, statusUrl, 200);
>     const status = ((await statusRes.json()) as { status: string }).status;
>     console.log("status:", status);
>     if (status === "completed") {
>       const contentUrl = `${BASE_URL}/api/v1/ambient/session/${ambientSessionId}/content?cumulative=false`;
>       const contentRes = await fetch(contentUrl, { headers: restHeaders(sukiToken) });
>       await expectStatus(contentRes, contentUrl, 200);
>       console.log(JSON.stringify(await contentRes.json(), null, 2));
>       break;
>     }
>     if (status === "failed" || status === "skipped" || status === "aborted") {
>       throw new Error(`Terminal status: ${status}`);
>     }
>     await new Promise((r) => setTimeout(r, 2000));
>   }
> }
>
> main().catch((err) => {
>   console.error(err);
>   process.exit(1);
> });
> ```

> [tab] Python
>
> ```python Ambient audio_file expandable theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
> # ambient_audio_file_staging.py
> # Flow: login → create (audio_file) → context → mint URL → PUT WAV → poll content
> # pip install requests
>
> import json
> import time
> from typing import Any, Optional
>
> import requests
>
> BASE_URL = "https://sdp.suki-stage.com"
> PARTNER_ID = "your-partner-id"
> PARTNER_TOKEN = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9..."
> PROVIDER_ID = "provider-123"
> SDP_PROVIDER_ID = ""
> AUDIO_PATH = "visit.wav"
>
>
> def rest_headers(suki_token: str) -> dict[str, str]:
>     headers = {"sdp_suki_token": suki_token, "Content-Type": "application/json"}
>     if SDP_PROVIDER_ID:
>         headers["sdp_provider_id"] = SDP_PROVIDER_ID
>     return headers
>
>
> def expect_status(response: requests.Response, url: str, want: int) -> None:
>     if response.status_code == want:
>         return
>     raise RuntimeError(f"HTTP {response.status_code} {url}: {(response.text or '')[:500]}")
>
>
> def login(partner_id: str, partner_token: str, provider_id: Optional[str] = None) -> str:
>     url = f"{BASE_URL}/api/v1/auth/login"
>     payload: dict[str, Any] = {"partner_id": partner_id, "partner_token": partner_token}
>     if provider_id:
>         payload["provider_id"] = provider_id
>     r = requests.post(url, json=payload, timeout=60)
>     expect_status(r, url, 200)
>     token = r.json().get("suki_token")
>     if not token:
>         raise RuntimeError("login response missing suki_token")
>     return token
>
>
> if __name__ == "__main__":
>     suki_token = login(PARTNER_ID, PARTNER_TOKEN, PROVIDER_ID)
>
>     create_url = f"{BASE_URL}/api/v1/ambient/session/create"
>     created_res = requests.post(
>         create_url,
>         headers=rest_headers(suki_token),
>         json={"input_type": "audio_file"},
>         timeout=60,
>     )
>     expect_status(created_res, create_url, 201)
>     created = created_res.json()
>     ambient_session_id = created["ambient_session_id"]
>     print("ambient_session_id:", ambient_session_id)
>     print("note_id:", created.get("note_id") or "")
>
>     context_url = f"{BASE_URL}/api/v1/ambient/session/{ambient_session_id}/context"
>     context_res = requests.post(
>         context_url,
>         headers=rest_headers(suki_token),
>         json={
>             "provider": {"specialty": "CARDIOLOGY", "provider_role": "ATTENDING"},
>             "patient": {"dob": "2000-01-01", "sex": "male"},
>             "visit": {
>                 "chief_complaint": "Headache",
>                 "encounter_type": "AMBULATORY",
>                 "reason_for_visit": "Follow-up for migraines",
>                 "visit_type": "ESTABLISHED_PATIENT",
>             },
>             "sections": [{"loinc": "10164-2"}, {"loinc": "48765-2"}],
>         },
>         timeout=60,
>     )
>     expect_status(context_res, context_url, 200)
>
>     mint_url = f"{BASE_URL}/api/v1/ambient/audio/file-uploadurl/{ambient_session_id}"
>     mint_res = requests.get(mint_url, headers=rest_headers(suki_token), timeout=60)
>     expect_status(mint_res, mint_url, 200)
>     presigned = mint_res.json()["presigned_url_response"]
>     print("upload URL expires in minutes:", presigned.get("expiry_in_minutes"))
>
>     with open(AUDIO_PATH, "rb") as audio_file:
>         put_res = requests.put(
>             presigned["url"],
>             data=audio_file,
>             headers={
>                 "Content-Type": "audio/wave",
>                 "x-goog-if-generation-match": "0",
>             },
>             timeout=300,
>         )
>     if put_res.status_code >= 400:
>         raise RuntimeError(f"Upload failed: {put_res.status_code} {put_res.text[:500]}")
>     print("Upload complete. Do not call end session.")
>
>     while True:
>         status_url = f"{BASE_URL}/api/v1/ambient/session/{ambient_session_id}/status"
>         status_res = requests.get(status_url, headers=rest_headers(suki_token), timeout=60)
>         expect_status(status_res, status_url, 200)
>         status = status_res.json()["status"]
>         print("status:", status)
>         if status == "completed":
>             content_url = f"{BASE_URL}/api/v1/ambient/session/{ambient_session_id}/content"
>             content_res = requests.get(
>                 content_url,
>                 headers=rest_headers(suki_token),
>                 params={"cumulative": "false"},
>                 timeout=60,
>             )
>             expect_status(content_res, content_url, 200)
>             print(json.dumps(content_res.json(), indent=2))
>             break
>         if status in ("failed", "skipped", "aborted"):
>             raise RuntimeError(f"Terminal status: {status}")
>         time.sleep(2)
> ```

## Troubleshooting

Upload usually fails when the session was not created as `audio_file`, when you mix Ambient and Form filling session IDs, or when you treat a second mint or overwrite PUT as a retry.

> [accordion] ING\_SDK\_005 When Minting the Upload URL
>
> The session was not created with `input_type` `audio_file`. Create a new Ambient session with that value, then mint again.

> [accordion] ING\_SDK\_006 or HTTP 412 on a Second Upload
>
> Input was already submitted for this session, or you tried to overwrite the uploaded object. Upload **one** WAV per session. Create a new session for another file.

> [accordion] 403 Audio File Modality Is Not Enabled
>
> Audio file upload is disabled for the environment. Contact [support](mailto:support@suki.ai) if you need the path enabled.

> [accordion] Wrong ambient\_session\_id
>
> Pass the Ambient `ambient_session_id` from Ambient create. Do not pass a Form filling session id into Ambient upload or retrieve calls.

> [accordion] Calling End Session After Upload
>
> Do not call end session for `audio_file`. Processing starts when the PUT succeeds. End belongs to the live `stream` path.

These cases come from the upload contract and errors on this page.

| Problem | What to do |
| :- | :- |
| `ING_SDK_005` | Create with `input_type` `audio_file` before minting. |
| `ING_SDK_006` or HTTP 412 overwrite | One WAV per session. Create a new session for another file. |
| `audio_file modality is not enabled` (403) | Path disabled for the environment. Contact support. |
| Form filling id on Ambient calls | Use the Ambient `ambient_session_id` only. |
| End session after PUT | Do not call end. Processing starts on successful upload. |

## Available cookbooks

Ambient
API

### [Upload Ambient Pre-Recorded Audio](https://developer.suki.ai/documentation/cookbooks/upload-prerecorded-ambient-audio.md)

Create with audio\_file, mint the URL, PUT one WAV, and skip end session.

10 min

Ambient
API

### [Wait for Ambient before Fetch](https://developer.suki.ai/documentation/cookbooks/wait-for-status-before-retrieve.md)

Poll status until completed, then retrieve.

5 min

## Next steps

&#x20;**[Get audio file upload URL](https://developer.suki.ai/api-reference/ambient-sessions/file-uploadurl.md)** - Request, upload contract, and error ids.

&#x20;**[Submit a finished transcript](https://developer.suki.ai/documentation/how-to/ambient-clinical-notes/submit-finished-transcript-ambient.md)** - Use when you already have text instead of audio.

&#x20;**[Track note generation status](https://developer.suki.ai/documentation/how-to/ambient-clinical-notes/handle-ambient-session-status.md)** - Poll until processing finishes.

&#x20;**[Retrieve ambient content](https://developer.suki.ai/documentation/how-to/ambient-clinical-notes/retrieve-ambient-content.md)** - Read the generated note after processing.

&#x20;**[Session input types](https://developer.suki.ai/documentation/concepts/ambient-clinical-notes/session-input-types.md)** - Compare live stream, audio file, and transcript.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.