> For the full page index, fetch https://echonova.ai/llms.txt

# Transcribe audio file

Starts a Speech to Text job for an uploaded audio file of up to 10 minutes and 150MB, and returns its jobId. Get the transcription from GET /v1/speech-to-text/jobs/{jobId} or the job.completed webhook.

## Endpoint

`POST https://api.echonova.ai/v1/speech-to-text`

## Authentication

Keys are created in the portal under Developers, sent as `Authorization: Bearer YOUR_API_KEY`. See [Get an API key](/docs/developers/get-an-api-key).

## Request

| Name              | In       | Type             | Required | Limits                              | Description                                                                                                                                                                                                      |
| ----------------- | -------- | ---------------- | -------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| file              | formData | file             | Yes      |                                     | Audio file (mp3, wav, m4a, webm, ogg). Up to 10 minutes, 150MB.                                                                                                                                                  |
| language          | formData | auto \| ar \| en | No       | one of auto, ar, en, default "auto" | auto lets the service decide (Arabic today, which also handles mixed and clean English speech); ar for Arabic and mixed Arabic/English; en only for wholly English speech. Arabic sent as en comes back garbled. |
| numbers_as_digits | formData | boolean          | No       | default true                        | Write spoken numbers as digits (صفر واحد واحد → 011). Set false to keep them as words. Applies to Arabic; English transcripts are never converted.                                                               |
| identify_speakers | formData | boolean          | No       | default false                       | Identify who speaks when: the finished job then lists the speakers and the transcript split into timed segments, each tagged with its speaker. Leave it out or send false for the transcript text alone.         |

## Responses

| Status | Description           |
| ------ | --------------------- |
| 200    | OK                    |
| 400    | Bad Request           |
| 401    | Unauthorized          |
| 402    | Payment Required      |
| 403    | Forbidden             |
| 413    | Payload Too Large     |
| 429    | Too Many Requests     |
| 500    | Internal Server Error |
| 503    | Service Unavailable   |
| 504    | Gateway Timeout       |

## Response

A success answers 200 with the envelope `{ data, success, statusCode, errorMessage }`. The `data` fields:

| Field  | Type   | Description                                                                                |
| ------ | ------ | ------------------------------------------------------------------------------------------ |
| jobId  | string | The id of the job the call created.                                                        |
| status | string | processing once the request is accepted. Poll the job, or receive a job.completed webhook. |

```json
{
  "data": {
    "jobId": "66e5f0c2a1b2c3d4e5f60718",
    "status": "processing"
  },
  "success": true,
  "statusCode": 200,
  "errorMessage": null
}
```

## Errors

| Status | errorMessage                                                   | When                                                                                                                                                                                                                                                                                       | Fix                                                                                                                       |
| ------ | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| 400    | Multipart: Boundary not found                                  | The Content-Type header says multipart/form-data but carries no boundary, usually because the client set the header by hand.                                                                                                                                                               | Remove the hand-written header and let the client set it with the boundary.                                               |
| 400    | Unexpected file field - <name>                                 | The form has a part with a field name other than file, or more than one part named file (only one file is accepted).                                                                                                                                                                       | Send exactly one file part, and name it file.                                                                             |
| 400    | File is required                                               | The form has no file part, or the request was not multipart at all.                                                                                                                                                                                                                        | Send a multipart form with one part named file.                                                                           |
| 400    | Unsupported file type: <type>. Please upload an audio file.    | The part's Content-Type does not start with audio/; <type> is what the client sent.                                                                                                                                                                                                        | Set the part's type, for example audio/wav or audio/mpeg.                                                                 |
| 400    | Audio exceeds the 10-minute limit.                             | The file's duration is over 10 minutes.                                                                                                                                                                                                                                                    | Split the recording into parts of 10 minutes or less.                                                                     |
| 400    | Could not read the audio length. Try another file.             | The file is empty or could not be decoded as audio.                                                                                                                                                                                                                                        | Check the file plays, or export it again in a common format.                                                              |
| 400    | language must be one of: auto, ar, en                          | The language form field holds something other than auto, ar or en.                                                                                                                                                                                                                         | Send auto, ar or en, or leave the field out.                                                                              |
| 400    | numbers_as_digits must be true or false                        | The numbers_as_digits form field is not true, false, 1 or 0.                                                                                                                                                                                                                               | Send true or false, or leave the field out.                                                                               |
| 400    | identify_speakers must be true or false                        | The identify_speakers form field is not true, false, 1 or 0.                                                                                                                                                                                                                               | Send true or false, or leave the field out.                                                                               |
| 401    | Unauthorized                                                   | The Authorization header is missing or is not Bearer ek\_..., no key matches the token, or the key is deleted, disabled or its account is closed.                                                                                                                                          | Send Authorization: Bearer ek\_... with an enabled key from this environment.                                             |
| 402    | Insufficient subscription balance                              | The workspace balance cannot cover the charge for this call; nothing ran and nothing was charged.                                                                                                                                                                                          | Add credits to the workspace.                                                                                             |
| 403    | Subscription not found                                         | The workspace that owns the key has no subscription.                                                                                                                                                                                                                                       | Check the workspace's plan in the portal.                                                                                 |
| 403    | Subscription expired or inactive                               | The subscription is in a state other than active or trial.                                                                                                                                                                                                                                 | Renew the subscription.                                                                                                   |
| 403    | This API key does not have access to Speech-to-Text services   | The key is restricted and Speech to Text is not among its services.                                                                                                                                                                                                                        | Edit the key and grant Speech to Text, or use another key.                                                                |
| 413    | File too large                                                 | The upload is over 150 MB; the request is cut off before the file is read.                                                                                                                                                                                                                 | Re-encode at a lower bitrate or as mono.                                                                                  |
| 429    | ThrottlerException: Too Many Requests                          | The key made more than 100 requests to one endpoint in 60 seconds, or one IP address made more than 100 requests to one endpoint in 60 seconds (the IP limit is counted before the key is checked, so it can answer with no key at all); a Retry-After header carries the seconds to wait. | Wait Retry-After seconds, then retry.                                                                                     |
| 429    | Monthly spending limit exhausted                               | The call would take the key past its Credit Limit for this billing cycle; nothing ran and there is no Retry-After header.                                                                                                                                                                  | Raise or clear the limit on the key, or wait for the next cycle.                                                          |
| 500    | Something went wrong                                           | An error the API did not classify.                                                                                                                                                                                                                                                         | Check the request, then retry after a short wait; contact support if it persists.                                         |
| 503    | Audio processing is temporarily unavailable. Please try again. | Too many uploads were being measured at once, or measuring timed out; nothing was charged.                                                                                                                                                                                                 | Retry after a short wait.                                                                                                 |
| 503    | Transcription is temporarily unavailable. Please try again.    | Transcription was unavailable for the request; the charge is refunded.                                                                                                                                                                                                                     | Retry once; if the same file fails every time, send it to POST /v1/speech-to-text, whose job carries the reason in error. |
| 503    | Database unavailable                                           | A transient outage inside the API.                                                                                                                                                                                                                                                         | Retry after a short wait.                                                                                                 |
| 504    | Database timed out                                             | A transient timeout inside the API.                                                                                                                                                                                                                                                        | Retry after a short wait.                                                                                                 |

## Code samples

:::tabs

```bash title="cURL"
curl -X POST "https://api.echonova.ai/v1/speech-to-text" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "file=@audio.mp3;type=audio/mpeg" \
  -F "language=auto" \
  -F "numbers_as_digits=true" \
  -F "identify_speakers=false"
```

```python
import requests

response = requests.post(
    "https://api.echonova.ai/v1/speech-to-text",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    files={"file": ("audio.mp3", open("audio.mp3", "rb"), "audio/mpeg")},
    data={"language": "auto", "numbers_as_digits": "true", "identify_speakers": "false"},
)
print(response.json())
```

```javascript
import { readFile } from 'node:fs/promises';

const formData = new FormData();
formData.append('file', new Blob([await readFile('audio.mp3')], { type: 'audio/mpeg' }), 'audio.mp3');
formData.append('language', 'auto');
formData.append('numbers_as_digits', 'true');
formData.append('identify_speakers', 'false');

const response = await fetch('https://api.echonova.ai/v1/speech-to-text', {
  method: 'POST',
  headers: { Authorization: 'Bearer YOUR_API_KEY' },
  body: formData,
});
console.log(await response.json());
```

:::
