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

# Transcribe from a file

## Get started in five minutes

### Step 1: Get your API Key

Your API key is used to authenticate your requests. Follow [this link](https://app.fennec-asr.com/dashboard/api-keys) to grab your first API key.

### Step 2: Grab an audio file

<AccordionGroup>
  <Accordion icon="file-audio" title="1. Prepare your audio file">
    Grab an audio file of your choice, or download [this audio file](https://static.wixstatic.com/mp3/748cf5_b8310da2c11b432f86f14922a89bec02.mp3)
    and save it as `sample.mp3` in the same directory where you will save the Python script below.

    <Tip>Our API works best with common audio formats like MP3, WAV, M4A, OGG, WEBM, and FLAC.</Tip>
  </Accordion>
</AccordionGroup>

### Step 3: Install the SDK

```python theme={null}
pip install fennec-asr
```

### Step 4: Transcribe!

```python theme={null}
from fennec_asr import FennecASRClient
print(FennecASRClient(api_key="YOUR_API_KEY").transcribe_file(r"sample.mp3"))
```

Don't want to use the SDK? See the example code below:

<AccordionGroup>
  <Accordion icon="language" title="Example Code">
    <CodeGroup dropdown>
      ```python quickstart.py theme={null}
      import os
      import time
      import requests

      BASE_URL = "https://api.fennec-asr.com/api/v1"
      API_KEY = "YOUR_API_KEY_HERE" # 👈 Paste your API key here
      AUDIO_PATH = "sample.mp3"
      POLL_INTERVAL_S = 3

      def transcribe_audio():
          if not os.path.exists(AUDIO_PATH):
              print(f"❌ Error: Audio file not found at '{AUDIO_PATH}'.")
              print("   Please make sure the audio file is in the same directory as this script.")
              return

          if "YOUR_API_KEY_HERE" in API_KEY:
              print("❌ Error: Please replace 'YOUR_API_KEY_HERE' with your actual API key.")
              return

          headers = {"X-API-Key": API_KEY}

          with open(AUDIO_PATH, "rb") as audio_file:
              files = {"audio": (os.path.basename(AUDIO_PATH), audio_file, "audio/mpeg")}

              print(f"Submitting '{AUDIO_PATH}' for transcription...")
              try:
                  # 1. Submit the job
                  submit_response = requests.post(f"{BASE_URL}/transcribe", headers=headers, files=files)
                  submit_response.raise_for_status()
                  job_id = submit_response.json().get("job_id")
                  print(f"✅ Job submitted successfully! Job ID: {job_id}\n")

                  # 2. Poll for the result
                  status_url = f"{BASE_URL}/transcribe/status/{job_id}"
                  while True:
                      status_response = requests.get(status_url, headers=headers)
                      status_response.raise_for_status()
                      data = status_response.json()
                      status = data.get("status")

                      if status == "completed":
                          print("\n🎉 Transcription Complete!")
                          print("-" * 25)
                          print(data.get("transcript"))
                          print("-" * 25)
                          break
                      elif status == "failed":
                          print("\n❌ Transcription failed.")
                          print("Error:", data.get("transcript"))
                          break
                      else:
                          print(f"  Current status: '{status}'... waiting.")
                          time.sleep(POLL_INTERVAL_S)

              except requests.exceptions.RequestException as e:
                  print(f"An error occurred: {e}")
                  if e.response:
                      print(f"Response Body: {e.response.text}")

      # --- Run the script ---
      if __name__ == "__main__":
          transcribe_audio()
      ```

      ```ts quickstart.ts theme={null}
      #!/usr/bin/env node
      "use strict";

      const BASE = "https://api.fennec-asr.com/api/v1";
      const KEY = process.env.ASR_API_KEY;
      const file = process.argv[2] || "sample.mp3";
      const wait = (ms) => new Promise((r) => setTimeout(r, ms));

      (async () => {
        if (!KEY) throw new Error("Set ASR_API_KEY");
        const { readFile } = require("fs/promises");
        const { basename } = require("path");
        const form = new FormData();
        form.append("audio", new Blob([await readFile(file)], { type: "audio/mpeg" }), basename(file));

        const sub = await fetch(`${BASE}/transcribe`, {
          method: "POST",
          headers: { "X-API-Key": KEY },
          body: form,
          duplex: "half",
        }).then((r) => r.json());

        if (!sub?.job_id) throw new Error("No job_id");
        for (;;) {
          const s = await fetch(`${BASE}/transcribe/status/${sub.job_id}`, {
            headers: { "X-API-Key": KEY },
          }).then((r) => r.json());

          if (s.status === "completed") return void console.log(s.transcript || "");
          if (s.status === "failed") {
            console.error("Failed:", s.transcript || "");
            process.exit(1);
          }
          await wait(3000);
        }
      })().catch((e) => {
        console.error(e.message || e);
        process.exit(1);
      });

      ```
    </CodeGroup>
  </Accordion>
</AccordionGroup>

## Next Steps

Now that you've completed your first transcription, you can explore the API's more powerful features.

<CardGroup cols={2}>
  <Card title="Transcribe from a URL" icon="link" href="/transcribe-from-a-url">
    Submit a public URL for transcription instead of uploading a file.
  </Card>

  <Card title="Improve Accuracy with Context" icon="brain-circuit" href="/essentials/contextual-correction">
    Provide hints and jargon to the AI to get more accurate results for specialized audio.
  </Card>

  <Card title="Automatic Formatting" icon="align-left" href="/essentials/formatting">
    Automatically add newlines and paragraphs to your transcript based on speech pauses.
  </Card>

  <Card title="Full API Reference" icon="code" href="/api-reference/create-transcription-job">
    Explore all endpoints, parameters, and schemas in detail.
  </Card>
</CardGroup>
