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

# Transcribe Audio

> This endpoint allows you to transcribe audio files to text using Azure Speech-to-Text services. Only available for public agents.

This endpoint converts audio files to text using Azure's Speech-to-Text API. It is designed to be used from public-facing chatbot widgets and **does not support API key authentication**.

**Use Cases:**

* Enable voice input in chatbot widgets
* Transcribe user audio messages for AI agent processing
* Convert voice notes to text for conversation logs
* Build voice-enabled customer support interfaces

<Warning>
  This endpoint **does not support API key authentication**. It only works by providing a valid `agentId` of a **public agent**. The agent must have its visibility set to "public" for this endpoint to work.
</Warning>

### Headers

<ParamField header="Content-Type" type="string" required default="multipart/form-data">
  Must be set to `multipart/form-data` for file uploads.
</ParamField>

### Body (multipart/form-data)

<ParamField body="file" type="file" required>
  The audio file to transcribe. Supported formats:

  * `audio/wav`
  * `audio/webm`
</ParamField>

<ParamField body="agentId" type="string" required>
  The ID of a **public agent**. This is required for all requests. The agent must have its visibility set to "public".
</ParamField>

### Response

<ResponseField name="text" type="string">
  The transcribed text from the audio file.
</ResponseField>

### Error Responses

| Status Code | Description                                                       |
| ----------- | ----------------------------------------------------------------- |
| 401         | Unauthorized - Invalid or missing agentId, or agent is not public |
| 400         | Invalid request - No file provided or invalid file format         |
| 500         | Transcription failed - Azure service error                        |

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST 'https://dashboard.laburen.com/api/transcribe-audio' \
  --form 'file=@"/path/to/audio.wav"' \
  --form 'agentId="clxxxxxxxxxxxxxxxxx"'
  ```

  ```javascript JavaScript theme={null}
  const apiUrl = 'https://dashboard.laburen.com/api';
  const agentId = 'clxxxxxxxxxxxxxxxxx'; // Must be a public agent

  // Create FormData with the audio file and agentId
  const formData = new FormData();
  formData.append('file', audioBlob, 'audio.wav');
  formData.append('agentId', agentId);

  const response = await fetch(`${apiUrl}/transcribe-audio`, {
    method: 'POST',
    body: formData,
  });

  const data = await response.json();
  console.log(data.text); // Transcribed text
  ```

  ```python Python theme={null}
  import requests

  api_url = "https://dashboard.laburen.com/api"
  agent_id = "clxxxxxxxxxxxxxxxxx"  # Must be a public agent

  with open("audio.wav", "rb") as audio_file:
      response = requests.post(
          f"{api_url}/transcribe-audio",
          files={
              "file": ("audio.wav", audio_file, "audio/wav"),
          },
          data={
              "agentId": agent_id,
          },
      )

  data = response.json()
  print(data["text"])  # Transcribed text
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "text": "Hello, I need help with my order that was placed last week."
  }
  ```
</ResponseExample>
