> ## 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 a Form filling session with input_type audio_file, mint a shared upload URL, upload one WAV, and retrieve structured data

Quick summary

Use this guide when your product already has a WAV recording and you want Form filling APIs to fill forms from that file.

Create with `input_type` `audio_file`, seed at least one template or schema, get the shared upload URL, PUT one WAV with both signed headers, then poll status and retrieve structured data. Do not call end session.

Last updated:
November 2026

Use Form filling APIs with `input_type` set to `audio_file` when your application already has a WAV recording of the patient-provider or patient-nurse conversation.

First, authenticate, create a Form filling session, and provide at least one template or partner schema.

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 Form filling `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:** [Form filling APIs](https://developer.suki.ai/form-filling-api-reference/overview.md).
>
> * Create with `input_type` `audio_file` before you mint the upload URL.
> * Seed at least one form in `form_filling.values` before processing starts.
> * 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 Form filling `ambient_session_id`.
> * Do not open `/ws/stream`, and do not call end session to start processing.

> [!NOTE]
>
> Both Form filling and [Ambient clinical note sessions](https://developer.suki.ai/api-reference/ambient-sessions/create.md) use the parameter name **`ambient_session_id`**. Those identifiers refer to **different** sessions. Use only the ID returned from Form filling [Create Form filling session](https://developer.suki.ai/form-filling-api-reference/form-filling-sessions/create.md) for Form filling REST calls and for the shared upload endpoint.

The typical Form filling `audio_file` flow is:

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

```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 form<br/>context"]
    B --> C["GET<br/>file-uploadurl"]
    C --> D["PUT<br/>WAV"]
    D --> E["Poll<br/>status"]
    E --> F["Retrieve<br/>structured data"]

    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
```

**Form filling audio\_file rules (agents):**

* Create on `/api/v1/form-filling/session/create` with `input_type` `audio_file`. Store the returned `ambient_session_id` (Form filling session id).
* Seed `form_filling.values` with at least one `form_template_id` or partner `schema` before processing starts. Each object uses exactly one of those fields.
* Mint with GET `/api/v1/ambient/audio/file-uploadurl/{ambient_session_id}` using the Form filling session id. PUT one WAV with `Content-Type: audio/wave` and `x-goog-if-generation-match: 0`. Max 500 MB.
* Do not call end session. Do not open `/ws/stream`. Do not reuse an Ambient clinical-note session id.
* Poll Form filling status, then retrieve structured data.

## Prerequisites

* A valid Suki Token. Refer to [Partner authentication](https://developer.suki.ai/documentation/how-to/partner-authentication.md) and [Form filling authentication](https://developer.suki.ai/form-filling-api-reference/authentication.md).
* One WAV file, at most **500 MB**.
* At least one Form filling template ID or partner schema to seed before processing starts.

## Build the upload flow

Your application should connect create, form context, upload, and structured-data retrieval in this order.

**1. Create the Form Filling Session with Audio File Input**

Call POST [Create Form filling session](https://developer.suki.ai/form-filling-api-reference/form-filling-sessions/create.md) with `input_type` set to `audio_file`. Store the returned `ambient_session_id`.

```bash theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
curl --request POST \
  --url https://sdp.suki-stage.com/api/v1/form-filling/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 Form Filling Session Context**

Seed at least one template or partner schema before processing starts. Each object in `form_filling.values` must use exactly one of `form_template_id` or `schema`.

```bash theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
curl --request POST \
  --url https://sdp.suki-stage.com/api/v1/form-filling/session/<ambient_session_id>/context \
  --header 'Content-Type: application/json' \
  --header 'sdp_suki_token: <sdp_suki_token>' \
  --header 'sdp_provider_id: <sdp_provider_id>' \
  --data '{
    "form_filling": {
      "values": [
        {
          "form_template_id": "019d4cdc-9319-7d81-ae2e-fd6de7f1b4f0"
        }
      ]
    }
  }'
```

Refer to [Form filling basic usage](https://developer.suki.ai/documentation/how-to/form-filling/form-filling-basic-usage.md) and [Seed Form filling with a Suki template](https://developer.suki.ai/documentation/cookbooks/seed-form-filling-template-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 the **Form filling** session id from create.

```bash theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
curl --request GET \
  --url https://sdp.suki-stage.com/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 finish the upload before the URL expires.

**4. PUT the WAV File**

Upload the file 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**.

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

**5. Wait for Processing, Then Retrieve Structured Data**

Poll [Form filling session status](https://developer.suki.ai/form-filling-api-reference/form-filling-sessions/status.md) or wait for your webhook. Then retrieve [structured data](https://developer.suki.ai/form-filling-api-reference/form-filling-sessions/structured-data.md) when status is **`completed`**.

## Handle the session status

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

| Status | What your application should do |
| :- | :- |
| **`completed`** | Retrieve structured data and review `generated_values`. |
| **`skipped`** | Treat the session as having no form output this time. |
| **`failed`** | Show that processing failed and offer retry or support. |
| **`aborted`** | Treat the session as cancelled. |

## Complete staging scripts

Use these scripts on staging after you replace partner credentials, set a real `FORM_TEMPLATE_ID`, and point `AUDIO_PATH` at a WAV file. Do not call end session. Do not reuse an Ambient clinical-note session id.

**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 Form filling audio_file expandable theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
> // form_filling_audio_file_staging.ts
> // Flow: login → FF create (audio_file) → context → mint URL → PUT WAV → poll structured-data
> // Node 18+: npx tsx form_filling_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 FORM_TEMPLATE_ID = "019d4cdc-9319-7d81-ae2e-fd6de7f1b4f0"; // Real Suki template UUID
> 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/form-filling/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 };
>   const ambientSessionId = created.ambient_session_id;
>   console.log("form filling ambient_session_id:", ambientSessionId);
>
>   const contextUrl = `${BASE_URL}/api/v1/form-filling/session/${ambientSessionId}/context`;
>   const contextRes = await fetch(contextUrl, {
>     method: "POST",
>     headers: restHeaders(sukiToken),
>     body: JSON.stringify({
>       form_filling: {
>         values: [{ form_template_id: FORM_TEMPLATE_ID }],
>       },
>     }),
>   });
>   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 };
>   };
>
>   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/form-filling/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 dataUrl = `${BASE_URL}/api/v1/form-filling/session/${ambientSessionId}/structured-data`;
>       const dataRes = await fetch(dataUrl, { headers: restHeaders(sukiToken) });
>       await expectStatus(dataRes, dataUrl, 200);
>       console.log(JSON.stringify(await dataRes.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 Form filling audio_file expandable theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
> # form_filling_audio_file_staging.py
> # Flow: login → FF create (audio_file) → context → mint URL → PUT WAV → poll structured-data
> # 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 = ""
> FORM_TEMPLATE_ID = "019d4cdc-9319-7d81-ae2e-fd6de7f1b4f0"  # Real Suki template UUID
> 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/form-filling/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)
>     ambient_session_id = created_res.json()["ambient_session_id"]
>     print("form filling ambient_session_id:", ambient_session_id)
>
>     context_url = f"{BASE_URL}/api/v1/form-filling/session/{ambient_session_id}/context"
>     context_res = requests.post(
>         context_url,
>         headers=rest_headers(suki_token),
>         json={
>             "form_filling": {
>                 "values": [{"form_template_id": FORM_TEMPLATE_ID}],
>             }
>         },
>         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)
>     upload_url = mint_res.json()["presigned_url_response"]["url"]
>
>     with open(AUDIO_PATH, "rb") as audio_file:
>         put_res = requests.put(
>             upload_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/form-filling/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":
>             data_url = f"{BASE_URL}/api/v1/form-filling/session/{ambient_session_id}/structured-data"
>             data_res = requests.get(data_url, headers=rest_headers(suki_token), timeout=60)
>             expect_status(data_res, data_url, 200)
>             print(json.dumps(data_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 form context is missing, or when you mix Ambient and Form filling session IDs.

> [accordion] ING\_SDK\_005 When Minting the Upload URL
>
> The session was not created with `input_type` `audio_file`. Create a new Form filling 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] No Structured Form Output
>
> Seed at least one `form_template_id` or partner `schema` in `form_filling.values` before the upload succeeds. Empty context does not produce filled forms.

> [accordion] Wrong ambient\_session\_id
>
> Pass the Form filling `ambient_session_id` from Form filling create. Do not pass an Ambient clinical-note session id into Form filling 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 Form filling context rules 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. |
| Empty structured data | Seed `form_filling.values` before upload. |
| Ambient id on Form filling calls | Use the Form filling `ambient_session_id` only. |
| End session after PUT | Do not call end. Processing starts on successful upload. |

## Available cookbooks

Form Filling
API

### [Upload Form Filling Pre-Recorded Audio](https://developer.suki.ai/documentation/cookbooks/upload-prerecorded-form-filling-audio.md)

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

10 min

Form Filling
API

### [Seed Form Filling with a Suki Template](https://developer.suki.ai/documentation/cookbooks/seed-form-filling-template-context.md)

Bind a Medical form template before processing starts.

5 min

## Next steps

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

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

&#x20;**[Form filling basic usage](https://developer.suki.ai/documentation/how-to/form-filling/form-filling-basic-usage.md)** - Create, context, stream, and retrieve for the live path.

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


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