import { Tabs, TabsContent, TabsList, TabsTrigger } from "zudoku/ui/Tabs";

# Fast Transcribe
:::warning[**Transcribe V1 has been deprecated!**]
The **Transcribe V1 endpoint** has been deprecated and will be removed in a future release. This documentation has been updated to reference the newer v2alpha API, which includes improvements and ongoing support. If you're still using V1, we recommend migrating to v2alpha as soon as possible to ensure continued functionality. [API Reference](/api/transcribe)
:::


`POST` <span href="" styel={{"cursor": "none", "pointer-events": "none"}}>https://vulavula-services.lelapa.ai/api/v2alpha/transcribe/fast</span>

FORM DATA

**upload** _string of bytes_ <span style={{"color": "red"}}>required</span>

String of bytes of the file.

HEADERS

**X-CLIENT-TOKEN** _string_ <span style={{"color": "red"}}>required</span>

API token generated for the project.

**CONTENT-TYPE** _string_ <span style={{"color": "red"}}>required</span>

Set `content-type` to `multipart/form-data`

PARAMS

**lang_code** _string_ <span style={{"color": "orange"}}>optional</span>

This is the language code that we are going to use to transcribe the uploaded audio.

Optionally, you can specify a language code to specify which model you’re speaking on. The following language codes are valid

```text
Afrikaans - "afr"
isiZulu - "zul"
Sesotho - "sot"
South African English - "eng"
African French - "fra"

```

Note: our "zul" (isiZulu) support is code-switched isiZulu.

If no language code is specified, our built-in language ID will select the most probable language.

<Tabs defaultValue="py">
      <TabsList>
              <TabsTrigger value="py">Python HTTP</TabsTrigger>
              <TabsTrigger value="curl">cURL</TabsTrigger>
            </TabsList>
  <TabsContent value="py">

```python showLineNumbers
    import requests
    import json
    from pprint import pprint

    # set these

    API_KEY = "<INSERT-TOKEN>"
    WAV_FILE = "<INSERT-PATH-TO-AUDIO>"

    def file_data(path: str):
        with open(path, "rb") as f:
            return f.read()

        url = "https://vulavula-services.lelapa.ai/api/v2alpha/transcribe/fast"

        headers = {
        "X-CLIENT-TOKEN": API_KEY,
        }

        files = {
        'upload': ('fra_colours.wav', file_data(WAV_FILE), 'audio/wav')
        }

        # if language code is known, set it
        params = {
        "lang_code": "<INSERT-LANGUAGE-CODE>"
        }

        resp = requests.post(url, headers=headers, files=files, params=params)

        pprint(resp.json())

```

</TabsContent>

<TabsContent value="curl">
```bash
    curl - X 'POST' \
    'https://vulavula-services.lelapa.ai/api/v2alpha/transcribe/fast?lang_code=<INSERT-LANGUAGE-CODE>' \
    - H 'content-type: multipart/form-data'
    - H 'X-CLIENT-TOKEN: <INSERT_TOKEN>' \
    - F upload = @recording.wav
```
</TabsContent>

</Tabs>

**RESPONSE**

<details>
  <summary>🟢 `200 OK`</summary>
  <div>
    <div>The request was successful.</div> <br/>
```json title="RESPONSE example (200)"
{
    "text": "sikubingelele esikomkene ndabenzehoranokqale mini sibingelelenakuwe ska holele ni lotholhlalo zohlakazi at itithi lezindabani",
    "lang_code": "sot"
    "diarisation: {}
}
```

RESPONSE BODY PARAMS

| Object                                                                                                                                                                                             |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **text** _string_ <span style={{"color": "red"}}>required</span>.<br/> The transcribed text of the provided audio file.                                                                            |
| **lang_code** _string_ <span style={{"color": "red"}}>required</span>.<br/> The language code representing the detected/provided language of the transcription, in this case, `"sot"` for Sesotho. |
| **diarisation** _dict_ <span style={{"color": "red"}}>required</span>.<br/> Diarisation data when available.                                                                                       |

  </div>
</details>

<details>
  <summary>🟠 `401 Unauthorized`</summary>
  <div>
    <div>The client token is missing or invalid.</div>
  </div>
</details>

<details>
  <summary>🔴 `415 Unsupported Media Type`</summary>
  <div>
    <div>Not a valid WAV file.</div>
  </div>
</details>

<details>
  <summary>🔴 `500 Internal Server Error`</summary>
  <div>
    <div>An unexpected error occurred on the server.</div>
  </div>
</details>

<details>
  <summary>🔴 `503 The request timed out`</summary>
  <div>
    <div>The request timed out - please try again.</div>
  </div>
</details>
