DocsFilesDelete

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/delete

Parameters

Pass the file id either as a query parameter or in a JSON body.

ParameterWhereTypeDescription
fileIdquery or bodystringThe ID of the file to delete
fileIdsbodystring or array of stringsSeveral 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 CodeDescription
200All requested files deleted
207Some files deleted; see deleted and failed
400No file ID given, or an ID is not a valid file ID
401Unauthorized
404A requested file does not exist or does not belong to your account
409A requested file has an order in progress; see fileIds
500Server error; nothing was deleted