# Print the content of the response
print(transcription_response)
```
  </TabItem>
  <TabItem value="typescript" label="typescript">

```typescript


// Retrieve the API key from environment variables
const apiKey = process.env["MISTRAL_API_KEY"];

// Initialize the Mistral client
const client = new Mistral({ apiKey: apiKey });

// If local document, upload and retrieve the signed url
const uploaded_pdf = await client.files.upload({
    file: {
        fileName: "local_audio.mp3",
        content: fs.readFileSync("local_audio.mp3"),
        },
    purpose: "audio",
});

const signedUrl = await client.files.getSignedUrl({
    fileId: uploaded_pdf.id,
});

// Get the transcription
const transcriptionResponse = await client.audio.transcriptions.complete({
    model: "voxtral-mini-latest",
    fileUrl: signedUrl.url,
    // language: "en"
});

// Log the content of the response
console.log(transcriptionResponse);
```

  </TabItem>
  <TabItem value="curl" label="curl" default>

**Upload the Audio File**
```bash
curl --location https://api.mistral.ai/v1/files \
  --header "Authorization: Bearer $MISTRAL_API_KEY" \
  --form purpose="audio" \
  --form file="@local_audio.mp3"
```

**Get the Signed URL**
```bash
curl --location "https://api.mistral.ai/v1/files/$id/url?expiry=24" \
    --header "Accept: application/json" \
    --header "Authorization: Bearer $MISTRAL_API_KEY"
```

**Send Transcription Request**
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
    --header "x-api-key: $MISTRAL_API_KEY" \
    --form 'file_url="<signed_url>"' \
    --form 'model="voxtral-mini-2507"'
```

**Send Transcription Request with Language defined**
```bash
curl --location 'https://api.mistral.ai/v1/audio/transcriptions' \
    --header "x-api-key: $MISTRAL_API_KEY" \
    --form 'file_url="<signed_url>"' \
    --form 'model="voxtral-mini-2507"' \
    --form 'language="en"'
```
  </TabItem>
</Tabs>

<details>
<summary><b>JSON Output</b></summary>

```json
{
  "model":"voxtral-mini-2507",
  "text":"This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, my conversations with you, the American people, in living rooms, in schools, at farms and on factory floors, at diners and on distant military outposts, All these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better President, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers. And I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees. to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy. to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title – citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise. And I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you. And God bless the United States of America.",
  "language":"en",
  "segments":[],
  "usage":{
    "prompt_audio_seconds":203,
    "prompt_tokens":4,
    "total_tokens":3264,
    "completion_tokens":635
  }
}
```
</details>

<details>
<summary><b>Samples</b></summary>
  <Tabs>
    <TabItem value="obama" label="Obama">
        **Audio**
        <audio controls>
          <source src="/audio/obama.mp3" type="audio/mp3"/>
          Your browser does not support the audio element.
        </audio>

        **Transcription**  
        This week, I traveled to Chicago to deliver my final farewell address to the nation, following in the tradition of presidents before me. It was an opportunity to say thank you. Whether we've seen eye to eye or rarely agreed at all, my conversations with you, the American people, in living rooms, in schools, at farms and on factory floors, at diners and on distant military outposts, All these conversations are what have kept me honest, kept me inspired, and kept me going. Every day, I learned from you. You made me a better President, and you made me a better man. Over the course of these eight years, I've seen the goodness, the resilience, and the hope of the American people. I've seen neighbors looking out for each other as we rescued our economy from the worst crisis of our lifetimes. I've hugged cancer survivors who finally know the security of affordable health care. I've seen communities like Joplin rebuild from disaster, and cities like Boston show the world that no terrorist will ever break the American spirit. I've seen the hopeful faces of young graduates and our newest military officers. I've mourned with grieving families searching for answers. And I found grace in a Charleston church. I've seen our scientists help a paralyzed man regain his sense of touch, and our wounded warriors walk again. I've seen our doctors and volunteers rebuild after earthquakes and stop pandemics in their tracks. I've learned from students who are building robots and curing diseases, and who will change the world in ways we can't even imagine. I've seen the youngest of children remind us of our obligations to care for our refugees. to work in peace, and above all, to look out for each other. That's what's possible when we come together in the slow, hard, sometimes frustrating, but always vital work of self-government. But we can't take our democracy for granted. All of us, regardless of party, should throw ourselves into the work of citizenship. Not just when there is an election. Not just when our own narrow interest is at stake. But over the full span of a lifetime. If you're tired of arguing with strangers on the Internet, try to talk with one in real life. If something needs fixing, lace up your shoes and do some organizing. If you're disappointed by your elected officials, then grab a clipboard, get some signatures, and run for office yourself. Our success depends on our participation, regardless of which way the pendulum of power swings. It falls on each of us to be guardians of our democracy. to embrace the joyous task we've been given to continually try to improve this great nation of ours. Because for all our outward differences, we all share the same proud title – citizen. It has been the honor of my life to serve you as President. Eight years later, I am even more optimistic about our country's promise. And I look forward to working along your side as a citizen for all my days that remain. Thanks, everybody. God bless you. And God bless the United States of America.  

        **Language**
        English
     </TabItem>
  </Tabs>
</details>

## Transcription with Timestamps

You can request timestamps for the transcription by passing the `timestamp_granularities` parameter, currently supporting `segment`.  
It will return the start and end time of each segment in the audio file.

<Tabs groupId="code">
  <TabItem value="python" label="python">

```python

from mistralai import Mistral