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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://synapse-labs.gitbook.io/docs/services/whisper.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
