> For the complete documentation index, see [llms.txt](https://synapse-labs.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://synapse-labs.gitbook.io/docs/services/whisper.md).

# Whisper

## Create a new user

<mark style="color:blue;">`POST`</mark> `/whisper`

Transcribe audio

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

**Body**

| Name       | Type   | Description        | Default |
| ---------- | ------ | ------------------ | ------- |
| `audio`    | string | Base64 audio       | `none`  |
| `language` | number | Audio lang \| Auto | `none`  |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "text": "The beach was a popular spot on a hot summer day. People were swimming in the ocean, building sandcastles, and playing beach volleyball.",
  "segments": [
    {
      "id": 0,
      "seek": 0,
      "start": 0.0,
      "end": 3.319999933242798,
      "text": "The beach was a popular spot on a hot summer day.",
      "tokens": [
        50364, 440, 7534, 390, 257, 3743, 4008, 322, 257, 2368, 4266, 786, 13, 50530
      ],
      "temperature": 0.0,
      "avg_logprob": -0.2860786020755768,
      "compression_ratio": 1.2363636493682861,
      "no_speech_prob": 0.00985979475080967
    },
    ...
  ],
  "language": "english"
  "input_length_ms": 1278
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}

{% tab title="500" %}

```json
{
  "error": "Error during transcription"
}
```

{% endtab %}
{% endtabs %}

**Example**

```javascript
const res = await fetch('https://synapselabs.onrender.com/whisper', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer <your_api_key>'
  },
  body: JSON.stringify({
    audio: fs.readFileSync('demo.mp3', 'base64');
  }),
});

const data = await res.json();
console.log(data.text); //"This is a demo of OpenAI's Whisper transcription model"
```
