# Upload audio file Upload an audio file for transcription via multipart form data. Upload an audio file directly to the API for use in transcription jobs. The file is validated for format and size, then stored and made available as a URL that can be passed to the [Create Transcription](/docs/api-reference/audio/create-transcription) endpoint. #### Accepted Audio Formats - **MP3** (`audio/mpeg`) - **WAV** (`audio/wav`) - **M4A** (`audio/mp4`) - **FLAC** (`audio/flac`) - **OGG** (`audio/ogg`) #### Request Body (multipart/form-data) **`file`** file required The audio file to upload. Must be one of the accepted formats listed above. ## Returns Returns a success envelope with the uploaded file details including a file URL that can be used with the Create Transcription endpoint. Request ```bash cURL curl -X POST https://api.aitronos.com/v1/audio/files/upload \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -F "file=@/path/to/recording.mp3" ``` ```python Python SDK from aitronos import Aitronos client = Aitronos(api_key="your-api-key") with open("/path/to/recording.mp3", "rb") as f: result = client.audio.upload_file(file=f) print(f"File uploaded: {result.data.file_url}") ``` ```python Python import requests url = "https://api.aitronos.com/v1/audio/files/upload" headers = {"Authorization": "Bearer YOUR_ACCESS_TOKEN"} with open("/path/to/recording.mp3", "rb") as f: files = {"file": ("recording.mp3", f, "audio/mpeg")} response = requests.post(url, headers=headers, files=files) data = response.json() print(f"Uploaded: {data}") ``` ```javascript JavaScript const fs = require('fs'); const FormData = require('form-data'); const accessToken = process.env.ACCESS_TOKEN; const form = new FormData(); form.append('file', fs.createReadStream('/path/to/recording.mp3')); const response = await fetch('https://api.aitronos.com/v1/audio/files/upload', { method: 'POST', headers: { 'Authorization': `Bearer ${accessToken}`, ...form.getHeaders(), }, body: form, }); const data = await response.json(); console.log('Uploaded:', data); ``` Response ```json 201 Created { "success": true, "data": { "file_id": "afile_abc123def456", "file_url": "https://storage.aitronos.com/audio/afile_abc123def456/recording.mp3", "filename": "recording.mp3", "content_type": "audio/mpeg", "file_size_bytes": 5242880, "uploaded_at": "2026-03-02T12:00:00Z" }, "metadata": { "request_id": "req_1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d", "timestamp": "2026-03-02T12:00:00Z" } } ``` ```json 422 Invalid Format { "success": false, "error": { "code": "INVALID_FILE_FORMAT", "message": "The file format is not supported.", "system_message": "Unsupported audio format. Accepted formats: mp3, wav, m4a, flac, ogg", "type": "validation_error", "status": 422, "details": { "filename": "recording.aac", "content_type": "audio/aac", "accepted_formats": [".mp3", ".wav", ".m4a", ".flac", ".ogg"] }, "trace_id": "abc-123-def", "timestamp": "2026-03-02T12:00:00Z" } } ``` ## Related Resources - [Create Transcription](/docs/api-reference/audio/create-transcription) - [Get Transcription](/docs/api-reference/audio/get-transcription) - [List Transcriptions](/docs/api-reference/audio/list-transcriptions) - [Delete Transcription](/docs/api-reference/audio/delete-transcription) - [Get Paragraphs](/docs/api-reference/audio/get-paragraphs) - [Get Sentences](/docs/api-reference/audio/get-sentences) - [Get Subtitles](/docs/api-reference/audio/get-subtitles) - [Search Transcript](/docs/api-reference/audio/search-transcript) - [Get Redacted Audio](/docs/api-reference/audio/get-redacted-audio)