---
title: "Transcriptions · Function API"
description: "POST /api/v1/audio/transcriptions: every request field, the response, audio formats and errors, with curl, JavaScript and Python."
canonical: https://functionvoice.ai/docs/api/transcriptions
---

# Transcriptions

`POST /api/v1/audio/transcriptions`

Send a recording and get its text back. Send it as `multipart/form-data` with the file, or as JSON with the audio in base64.

```bash tab="curl"
curl https://functionvoice.ai/api/v1/audio/transcriptions \
  -H "Authorization: Bearer $FUNCTION_API_KEY" \
  -F model=function/dictate-1.2 \
  -F file=@recording.m4a
```

```js tab="JavaScript"
import { readFile } from "node:fs/promises";

const body = new FormData();
body.append("model", "function/dictate-1.2");
body.append("file", new Blob([await readFile("recording.m4a")]), "recording.m4a");

const response = await fetch("https://functionvoice.ai/api/v1/audio/transcriptions", {
  method: "POST",
  headers: { Authorization: `Bearer ${process.env.FUNCTION_API_KEY}` },
  body,
});
const { text } = await response.json();
console.log(text);
```

```python tab="Python"
import os
import requests

with open("recording.m4a", "rb") as audio:
    response = requests.post(
        "https://functionvoice.ai/api/v1/audio/transcriptions",
        headers={"Authorization": f"Bearer {os.environ['FUNCTION_API_KEY']}"},
        data={"model": "function/dictate-1.2"},
        files={"file": audio},
    )
print(response.json()["text"])
```

## JSON body

```bash tab="curl"
curl https://functionvoice.ai/api/v1/audio/transcriptions \
  -H "Authorization: Bearer $FUNCTION_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "function/transcribe-1.2",
    "input_audio": { "data": "'"$(base64 < recording.wav)"'", "format": "wav" },
    "language": "en",
    "keyterms": ["Priya", "Q3 roadmap"]
  }'
```

| Field | Type | Description |
| --- | --- | --- |
| `model` | string | `function/dictate-1.2` for polished text, `function/transcribe-1.2` for every word as it was said. `function/dictate` and `function/transcribe` name the latest version. **Required.** |
| `input_audio` | object | The recording. **Required.** |
| `input_audio.data` | string | The audio as base64: the raw bytes, not a data URI. **Required.** |
| `input_audio.format` | string | `wav`, `m4a` (AAC) or `pcm` (raw 16-bit little-endian mono). **Required.** |
| `language` | string | The language spoken, as an ISO-639-1 code such as `en` or `es`. English if left out. Dictate writes in the language that was spoken. |
| `keyterms` | array of strings | Names and terms to spell exactly as given: people, products, jargon. Up to 1,000, each up to 100 characters. |
| `sample_rate` | integer | For `pcm` only: its sample rate in Hz. 8000 to 48000. 16000 if left out. |
| `response_format` | string | `verbose_json` adds `task`, `language` and `duration` to the answer. `json` if left out. |

## Multipart body

| Field | Type | Description |
| --- | --- | --- |
| `model` | string | `function/dictate-1.2` for polished text, `function/transcribe-1.2` for every word as it was said. `function/dictate` and `function/transcribe` name the latest version. **Required.** |
| `file` | file | The recording. Its format is read from the file. **Required.** |
| `language` | string | The language spoken, as an ISO-639-1 code such as `en` or `es`. English if left out. Dictate writes in the language that was spoken. |
| `keyterms[]` | array of strings | Names and terms to spell exactly as given: people, products, jargon. Up to 1,000, each up to 100 characters. Repeat the field once per term. |
| `sample_rate` | integer | For `pcm` only: its sample rate in Hz. 8000 to 48000. 16000 if left out. |
| `response_format` | string | `verbose_json` adds `task`, `language` and `duration` to the answer. `json` if left out. |

`prompt`, `temperature`, `timestamp_granularities`, `provider`, `user`, `session_id` are accepted and ignored, so a client written for the common transcription shape works unchanged.

## Audio

| Format | What it takes |
| --- | --- |
| WAV | Any common sample rate, mono or stereo. |
| M4A | AAC, as phones record it. |
| PCM | Raw 16-bit little-endian mono, 16 kHz unless `sample_rate` says otherwise. |

Up to 10 minutes and 24 MB a request. MP3, FLAC, Ogg and WebM are refused with `unsupported_audio_format`.

## Response

```json title="Response"
{
  "text": "Can you send the deck to Priya by Friday?",
  "usage": {
    "seconds": 3.82,
    "cost": 0.0013611111
  }
}
```

| Field | Type | Description |
| --- | --- | --- |
| `text` | string | The text: polished for Dictate, as said for Transcribe. Empty when nothing was said. |
| `usage` | object | What the request used and cost. |
| `task` | string | With `verbose_json` only. |
| `language` | string or null | With `verbose_json` only: the language heard, when known. |
| `duration` | number | With `verbose_json` only: the recording's length, in seconds. |

The `X-Function-Generation-Id` header names the request. It is the id in the dashboard's request list. Quote it when you report a problem.

## Errors

| Status | `error_type` | Meaning |
| --- | --- | --- |
| 400 | `invalid_request` | A field is missing or wrong. The message says which. |
| 400 | `unsupported_audio_format` | Not WAV, M4A or PCM. |
| 401 | `missing_api_key` | No key in the Authorization header. |
| 401 | `invalid_api_key` | The key is wrong or revoked. |
| 401 | `expired_api_key` | The key is past its expiry. |
| 402 | `payment_required` | Add a payment method in the dashboard. |
| 403 | `ip_not_allowed` | The request came from outside the key's IP allowlist. |
| 403 | `forbidden` | The key isn't allowed to use this model. |
| 403 | `spend_limit` | The key reached its spending limit. `metadata.limit_source` says which: `key_lifetime`, `key_week` or `key_month`. |
| 413 | `payload_too_large` | Over 10 minutes or 24 MB of audio. |
| 429 | `rate_limited` | Over 120 requests a minute for the key. Wait for `Retry-After`. |
| 500 | `internal_error` | Something went wrong on our side. Try again. |
| 502 | `transcription_failed` | The audio couldn't be transcribed this time. Try again. You aren't charged. |
| 503 | `unavailable` | The service is briefly unavailable. Try again after `Retry-After`. |

Every error has the [same shape](/docs/api/errors).
