Delete File
Delete one or more files you own. The file is removed from your account along with its audio and any transcripts.
Only files that have not been ordered, or whose order is delivered or refunded, can be deleted. A file with an order in progress is refused with 409; cancel the order first or wait until it is delivered.
Endpoint
DELETE ${baseUrl}/files/deleteParameters
Pass the file id either as a query parameter or in a JSON body.
| Parameter | Where | Type | Description |
|---|---|---|---|
| fileId | query or body | string | The ID of the file to delete |
| fileIds | body | string or array of strings | Several file IDs, as an array or a comma-separated list |
Response
interface DeleteFileResponse {
success: boolean
message: string
deleted?: string[] // file IDs that were deleted
failed?: string[] // file IDs that could not be deleted (207 / 500 only)
fileIds?: string[] // file IDs with an order in progress (409 only)
}Example Request
// Single file via query parameter
const response = await fetch('${baseUrl}/files/delete?fileId=abc123', {
method: 'DELETE',
headers: {
Authorization: 'Basic YOUR_API_KEY',
},
})
// Several files via JSON body
const bulk = await fetch('${baseUrl}/files/delete', {
method: 'DELETE',
headers: {
Authorization: 'Basic YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({ fileIds: ['abc123', 'def456'] }),
})
const data = await response.json()Error Codes
| Status Code | Description |
|---|---|
| 200 | All requested files deleted |
| 207 | Some files deleted; see deleted and failed |
| 400 | No file ID given, or an ID is not a valid file ID |
| 401 | Unauthorized |
| 404 | A requested file does not exist or does not belong to your account |
| 409 | A requested file has an order in progress; see fileIds |
| 500 | Server error; nothing was deleted |