> ## 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.

# Get Audio File Upload URL

> Generate a one-time presigned PUT URL to upload a pre-recorded WAV for an audio_file Ambient or Form filling session

Use this endpoint when you need to upload a pre-recorded WAV for an Ambient or Form filling session created with `input_type` set to `audio_file`.

Suki returns a one-time presigned URL (A time-limited HTTPS URL that authorizes a single upload to cloud storage without sharing long-lived credentials.) that you use to upload the recording with an HTTP PUT request. Include both signed headers specified below.

After Suki receives the file successfully, it starts processing automatically. You do not need to call end session for `audio_file` sessions.

## Choose the correct session ID

This endpoint supports both Ambient and Form filling:

* **Ambient:** Pass the `ambient_session_id` of the Ambient session.
* **Form filling:** Pass the `ambient_session_id` of the Form filling session.

Create the session with `input_type: "audio_file"` before requesting the upload URL. Calling this endpoint when the session `input_type` is not `audio_file` returns **`ING_SDK_005`**.

> [!WARNING]
>
> Do not use an ID created during an Ambient session for a Form filling session, or vice versa.

> [!NOTE]
>
> This endpoint is available only while the session is in the **created** state. After a successful upload, the session leaves this state. You cannot request another upload URL or overwrite the uploaded file for that session.

> [!TIP]
>
> * For the complete workflow, including when to provide session context and how to retrieve the generated content, refer to [Upload a pre-recorded audio file](https://developer.suki.ai/documentation/how-to/ambient-clinical-notes/upload-prerecorded-audio).
>
> * To understand how `audio_file` compares with `stream` and `transcript`, refer to [Session input types](https://developer.suki.ai/documentation/concepts/ambient-clinical-notes/session-input-types.md).

## Upload contract

Upload the WAV file to `presigned_url_response.url` using an HTTP PUT request before the URL expires. The response includes `presigned_url_response.expiry_in_minutes`, which specifies how long the URL remains valid. For example, the URL may expire after **15 minutes**.

Include both signed headers in the PUT request:

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

The following restrictions apply to the upload:

* **One file per session:** Upload exactly one WAV file. Other audio formats are not supported.
* **Maximum file size:** The WAV file must not exceed **500 MB**.
* **No overwrites:** The upload URL cannot be reused to overwrite the uploaded object. An overwrite attempt returns **HTTP 412**. Uploaded files are immutable.
* **No second upload:** Once the file has been submitted successfully, you cannot mint another upload URL for the same session.

After the PUT request succeeds, poll status for the same product you created, or wait for your configured webhook. Use [Get ambient session status](https://developer.suki.ai/api-reference/ambient-content/status.md) for Ambient, or [Form filling session status](https://developer.suki.ai/form-filling-api-reference/form-filling-sessions/status.md) for Form filling. Once processing completes, retrieve content the same way you do for a streamed session on that product.

### Upload response fields

Use the following fields from the response to complete and track the upload:

| Field | Description |
| :- | :- |
| `presigned_url_response.url` | The one-time URL to which you send the WAV file using an HTTP PUT request. |
| `presigned_url_response.expiry_in_minutes` | The time, in minutes, for which the presigned URL remains valid. For example, `15`. |
| `presigned_url_response.id` | Identifies the upload and is typically the session ID. |

## Errors for this endpoint

The following errors are specific to the audio file upload flow:

| Error id | HTTP status | Cause |
| :- | :- | :- |
| `ING_SDK_005` | 412 | The session `input_type` is not `audio_file`. |
| `ING_SDK_006` | 412 | Input has already been submitted for this session. |
| `audio_file modality is not enabled` | 403 | The `audio_file` input path is disabled for the environment. |

For shared authentication and session errors, refer to [Error messages](https://developer.suki.ai/api-reference/error-messages.md).

To use the correct `ambient_session_id` for Ambient and Form filling transcript input and audio file uploads, refer to [How should developers handle ambient\_session\_id for transcript input and audio file upload?](https://developer.suki.ai/api-reference/faqs/audio-capture-streaming.md#ambient-session-id-for-input-types).

## Code examples

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

> [tab] Python
>
> ```python expandable theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
> import requests
>
> # Session must be created with input_type "audio_file" and still be created.
> # Use the Ambient or Form filling ambient_session_id for that product. Do not call end.
> BASE_URL = "https://sdp.suki.ai"
> ambient_session_id = "123dfg-456dfg-789dfg-012dfg"
> wav_path = "visit.wav"  # one WAV, at most 500 MB
>
> headers = {
>     "sdp_suki_token": "<sdp_suki_token>",
>     "sdp_provider_id": "<sdp_provider_id>",  # Required for single_auth partners
> }
>
> mint = requests.get(
>     f"{BASE_URL}/api/v1/ambient/audio/file-uploadurl/{ambient_session_id}",
>     headers=headers,
>     timeout=60,
> )
> mint.raise_for_status()
> presigned = mint.json()["presigned_url_response"]
> upload_url = presigned["url"]
> # Upload before presigned["expiry_in_minutes"] elapses (example: 15).
>
> with open(wav_path, "rb") as audio_file:
>     put = requests.put(
>         upload_url,
>         data=audio_file,
>         headers={
>             "Content-Type": "audio/wave",
>             "x-goog-if-generation-match": "0",
>         },
>         timeout=300,
>     )
> put.raise_for_status()
> print(
>     "Upload complete. Poll Ambient or Form filling status for this session, "
>     "or wait for the webhook. Do not call end."
> )
> ```

> [tab] TypeScript
>
> ```typescript expandable theme={"theme":{"light":"one-light","dark":"material-theme-darker"}}
> // Session must be created with input_type "audio_file" and still be created.
> // Use the Ambient or Form filling ambient_session_id for that product. Do not call end.
> const BASE_URL = "https://sdp.suki.ai";
> const ambientSessionId = "123dfg-456dfg-789dfg-012dfg";
>
> const headers = {
>   sdp_suki_token: "<sdp_suki_token>",
>   sdp_provider_id: "<sdp_provider_id>", // Required for single_auth partners
> };
>
> const mint = await fetch(
>   `${BASE_URL}/api/v1/ambient/audio/file-uploadurl/${ambientSessionId}`,
>   { headers },
> );
> if (!mint.ok) {
>   throw new Error(`Mint failed: ${mint.status} ${await mint.text()}`);
> }
>
> const { presigned_url_response: presigned } = await mint.json();
> // Upload before presigned.expiry_in_minutes elapses (example: 15).
>
> // Read the WAV bytes with your runtime (fs, Blob, File, and similar). One WAV, at most 500 MB.
> const wavBytes: BodyInit = /* Uint8Array | Blob | File */ new Uint8Array();
>
> const put = await fetch(presigned.url, {
>   method: "PUT",
>   headers: {
>     "Content-Type": "audio/wave",
>     "x-goog-if-generation-match": "0",
>   },
>   body: wavBytes,
> });
> if (!put.ok) {
>   throw new Error(`Upload failed: ${put.status} ${await put.text()}`);
> }
>
> console.log(
>   "Upload complete. Poll Ambient or Form filling status for this session, or wait for the webhook. Do not call end."
> );
> ```


## OpenAPI

````yaml GET /api/v1/ambient/audio/file-uploadurl/{ambient_session_id}
openapi: 3.0.1
info:
  title: Suki Developer Platform
  description: >-
    REST and WebSocket APIs for the Suki Developer Platform. Authenticate with
    Login or Register to obtain a Suki access token, then integrate ambient
    clinical documentation, form filling, transcription, content rewrite, and
    reference metadata endpoints.
  contact: {}
  version: '1.0'
servers:
  - url: https://sdp.suki.ai
    description: >-
      Production base URL for Suki Developer Platform REST APIs. WebSocket
      endpoints use the same host with `wss://`.
security:
  - SukiTokenAuth: []
paths:
  /api/v1/ambient/audio/file-uploadurl/{ambient_session_id}:
    get:
      tags:
        - /api/v1/ambient/audio
      summary: Gets a presigned URL to upload a pre-recorded audio file.
      description: >-
        Mints a one-time presigned PUT URL for an **input_type=audio_file**
        session that is still **created**. Works for both Ambient and Form
        filling sessions created with `input_type=audio_file`.


        PUT the WAV to the returned URL with **both** signed headers:
        `Content-Type: audio/wave` and `x-goog-if-generation-match: 0`. Object
        finalize starts processing. Do not call end session.


        Re-using the same URL to overwrite the object returns HTTP 412 (uploads
        are immutable).


        **ING_SDK_005**: session `input_type` is not `audio_file`.
        **ING_SDK_006**: input already submitted (job is no longer created).
      parameters:
        - name: ambient_session_id
          in: path
          description: >-
            Session ID from create. For Ambient, use the Ambient
            `ambient_session_id`. For Form filling, use the Form filling
            `ambient_session_id`. Do not mix the two.
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/ProviderIdHeader'
      responses:
        '200':
          description: Request succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.AudioFileUploadUrlResponse'
              example:
                presigned_url_response:
                  id: dd161483-850b-4c95-a327-75fee2de02e3
                  url: https://storage.googleapis.com/...
                  expiry_in_minutes: 15
                  bucket_name: payattention-platform-suki-dev-02
                  file_name: AUDIT/.../session.wav
        '400':
          description: Bad request. Request validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.BadRequestError'
        '401':
          description: Unauthorized. The Suki access token is missing, expired, or invalid.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.AuthenticationError'
        '403':
          description: Forbidden.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.ForbiddenError'
        '404':
          description: Not found. The session ID does not exist.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.NotFoundError'
        '412':
          description: >-
            Failed precondition. Includes ING_SDK_005 (input_type mismatch) and
            ING_SDK_006 (input already submitted).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.BadRequestError'
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/controllers.InternalServerError'
      security:
        - SukiTokenAuth: []
      x-codeSamples:
        - lang: bash
          label: cURL
          source: |-
            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>'
components:
  parameters:
    ProviderIdHeader:
      name: sdp_provider_id
      in: header
      description: >-
        **Optional** for standard partners.


        **Required** for:


        - **Bearer authentication.** Use the same `provider_id` returned by the
        Login or Register API.

        - **Single Auth Token authentication.** Include the same `provider_id`
        on every request as `sdp_provider_id`.
      required: false
      schema:
        type: string
        example: provider-123
  schemas:
    controllers.AudioFileUploadUrlResponse:
      type: object
      description: >-
        Response body for GET
        /api/v1/ambient/audio/file-uploadurl/{ambient_session_id}.
      properties:
        presigned_url_response:
          $ref: '#/components/schemas/controllers.GeneratePresignedURLResponse'
    controllers.BadRequestError:
      description: Bad Request Response
      type: object
      properties:
        code:
          type: integer
          example: 400
        message:
          type: string
          example: invalid request
    controllers.AuthenticationError:
      description: Authentication Failure Response
      type: object
      properties:
        code:
          type: integer
          example: 401
        message:
          type: string
          example: invalid token
    controllers.ForbiddenError:
      type: object
      properties:
        code:
          type: integer
          example: 403
          description: HTTP status code for the error.
        message:
          type: string
          example: forbidden
          description: Human-readable description of the authorization failure.
      description: Error response when the caller lacks permission.
    controllers.NotFoundError:
      description: Not Found Response
      type: object
      properties:
        code:
          type: integer
          example: 404
        message:
          type: string
          example: not found
    controllers.InternalServerError:
      description: Internal Server Error Response
      type: object
      properties:
        code:
          type: integer
          example: 500
        message:
          type: string
          example: internal server error
    controllers.GeneratePresignedURLResponse:
      type: object
      description: Presigned PUT URL and object location for an `audio_file` upload.
      properties:
        id:
          type: string
          description: Tracking id for the upload. Typically the ambient session id.
          example: dd161483-850b-4c95-a327-75fee2de02e3
        url:
          type: string
          description: >-
            Presigned PUT URL. PUT the WAV with both signed headers:
            `Content-Type: audio/wave` and `x-goog-if-generation-match: 0`.
          example: https://storage.googleapis.com/...
        expiry_in_minutes:
          type: integer
          description: >-
            Minutes until the URL expires. Read this value from the response and
            upload before it elapses.
          example: 15
        bucket_name:
          type: string
          description: Destination bucket.
          example: payattention-platform-suki-dev-02
        file_name:
          type: string
          description: Object path in the bucket.
          example: AUDIT/.../session.wav
  securitySchemes:
    SukiTokenAuth:
      type: apiKey
      in: header
      name: sdp_suki_token
      description: >-
        Suki access token (`suki_token`) from Login or Register. Expires after
        one hour.

````

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