Delete a transcription by file ID
curl --request DELETE \
--url http://localhost:2000/transcription/{fileId} \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:2000/transcription/{fileId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:2000/transcription/{fileId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "2000",
CURLOPT_URL => "http://localhost:2000/transcription/{fileId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:2000/transcription/{fileId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("http://localhost:2000/transcription/{fileId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:2000/transcription/{fileId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"message": "Successfully deleted the transcription",
"data": {}
}{
"errorMessage": "This transcription does not exist anymore in the system."
}Audio Transcription
Delete Transcription
Permanently removes the transcription record for the specified audio file from the system.
DELETE
/
transcription
/
{fileId}
Delete a transcription by file ID
curl --request DELETE \
--url http://localhost:2000/transcription/{fileId} \
--header 'Authorization: Bearer <token>'import requests
url = "http://localhost:2000/transcription/{fileId}"
headers = {"Authorization": "Bearer <token>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {Authorization: 'Bearer <token>'}};
fetch('http://localhost:2000/transcription/{fileId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "2000",
CURLOPT_URL => "http://localhost:2000/transcription/{fileId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "http://localhost:2000/transcription/{fileId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("http://localhost:2000/transcription/{fileId}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:2000/transcription/{fileId}")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Delete.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"message": "Successfully deleted the transcription",
"data": {}
}{
"errorMessage": "This transcription does not exist anymore in the system."
}Permanently removes the transcription record for the specified audio file from the system. This action cannot be undone.
Request
Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | string | Yes | Bearer token |
Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| fileId | string | Yes | Unique identifier of the transcription or audio file to delete |
Parameter Details
- fileId: Must be a valid transcription or file identifier
- Used to locate and delete the transcription record
- This action is permanent and cannot be undone
Response
200 OK - Transcription successfully deleted
{
"message": "Successfully deleted the transcription",
"data": {}
}
404 Not Found
{
"errorMessage": "This transcription does not exist anymore in the system."
}
500 Internal Server Error
{
"error": {
"code": "SERVER_ERROR",
"message": "Internal server error"
}
}
Example
curl -X DELETE 'http://localhost:2000/transcription/670fcae25abf2d8e5c8a4a12' \
-H 'Authorization oBearerbearer your-jwt-token'
'
Use Cases
- Data Cleanup: Remove old or unnecessary transcriptions
- Storage Management: Free up storage space by deleting transcriptions
- Privacy Compliance: Remove transcriptions containing sensitive information
- Error Correction: Delete incorrect transcriptions for reprocessing
- User Management: Remove transcriptions when users are deleted
Implementation Examples
React Delete Transcription Component
import React, { useState } from 'react';
function TranscriptionManager({ fileId, onDelete }) {
const [deleting, setDeleting] = useState(false);
const [showConfirm, setShowConfirm] = useState(false);
const handleDelete = async () => {
setDeleting(true);
try {
const response = await fetch(`/transcription/${fileId}`, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${token}`
}
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(errorData.errorMessage || 'Failed to delete transcription');
}
setShowConfirm(false);
if (onDelete) onDelete(fileId);
} catch (error) {
console.error('Delete error:', error);
alert(`Error: ${error.message}`);
} finally {
setDeleting(false);
}
};
return (
<div className="transcription-manager">
{!showConfirm ? (
<button
onClick={() => setShowConfirm(true)}
className="delete-button"
disabled={deleting}
>
Delete Transcription
</button>
) : (
<div className="confirm-dialog">
<p>Are you sure you want to delete this transcription? This action cannot be undone.</p>
<div className="confirm-buttons">
<button
onClick={handleDelete}
disabled={deleting}
className="confirm-delete"
>
{deleting ? 'Deleting...' : 'Yes, Delete'}
</button>
<button
onClick={() => setShowConfirm(false)}
disabled={deleting}
className="cancel-delete"
>
Cancel
</button>
</div>
</div>
)}
</div>
);
}
Batch Delete Transcriptions
function BatchTranscriptionDelete({ transcriptions, onDeleteComplete }) {
const [selectedItems, setSelectedItems] = useState(new Set());
const [deleting, setDeleting] = useState(false);
const handleSelectAll = () => {
if (selectedItems.size === transcriptions.length) {
setSelectedItems(new Set());
} else {
setSelectedItems(new Set(transcriptions.map(t => t.fileId)));
}
};
const handleItemToggle = (fileId) => {
const newSelected = new Set(selectedItems);
if (newSelected.has(fileId)) {
newSelected.delete(fileId);
} else {
newSelected.add(fileId);
}
setSelectedItems(newSelected);
};
const handleBatchDelete = async () => {
if (selectedItems.size === 0) return;
setDeleting(true);
const deletePromises = Array.from(selectedItems).map(fileId =>
fetch(`/transcription/${fileId}`, {
method: 'DELETE',
headers: { 'Authorization': `Bearer ${token}` }
})
);
try {
const results = await Promise.allSettled(deletePromises);
const successful = results.filter(r => r.status === 'fulfilled').length;
const failed = results.filter(r => r.status === 'rejected').length;
if (onDeleteComplete) {
onDeleteComplete({
successful,
failed,
total: selectedItems.size
});
}
setSelectedItems(new Set());
} catch (error) {
console.error('Batch delete error:', error);
} finally {
setDeleting(false);
}
};
return (
<div className="batch-delete">
<div className="selection-controls">
<label>
<input
type="checkbox"
checked={selectedItems.size === transcriptions.length}
onChange={handleSelectAll}
/>
Select All ({selectedItems.size} selected)
</label>
<button
onClick={handleBatchDelete}
disabled={deleting || selectedItems.size === 0}
className="batch-delete-button"
>
{deleting ? 'Deleting...' : `Delete Selected (${selectedItems.size})`}
</button>
</div>
<div className="transcription-list">
{transcriptions.map(transcription => (
<div key={transcription.fileId} className="transcription-item">
<label>
<input
type="checkbox"
checked={selectedItems.has(transcription.fileId)}
onChange={() => handleItemToggle(transcription.fileId)}
/>
{transcription.fileName || transcription.fileId}
</label>
<span className="transcription-info">
{new Date(transcription.createdAt).toLocaleDateString()}
</span>
</div>
))}
</div>
</div>
);
}
Transcription Cleanup Service
class TranscriptionCleanupService {
static async deleteOldTranscriptions(daysOld = 90) {
const cutoffDate = new Date();
cutoffDate.setDate(cutoffDate.getDate() - daysOld);
try {
// Get list of old transcriptions (assuming there's an endpoint for this)
const response = await fetch(`/transcription/list?before=${cutoffDate.toISOString()}`, {
headers: { 'Authorization': `Bearer ${token}` }
});
if (!response.ok) {
throw new Error('Failed to fetch old transcriptions');
}
const { transcriptions } = await response.json();
// Delete old transcriptions
const deletePromises = transcriptions.map(transcription =>
fetch(`/transcription/${transcription.fileId}`, {
method: 'DELETE',
headers: { 'Authorization': `Bearer ${token}` }
})
);
const results = await Promise.allSettled(deletePromises);
return {
total: transcriptions.length,
successful: results.filter(r => r.status === 'fulfilled').length,
failed: results.filter(r => r.status === 'rejected').length
};
} catch (error) {
console.error('Cleanup error:', error);
throw error;
}
}
static async deleteTranscriptionsByUser(userId) {
try {
const response = await fetch(`/transcription/list?userId=${userId}`, {
headers: { 'Authorization': `Bearer ${token}` }
});
if (!response.ok) {
throw new Error('Failed to fetch user transcriptions');
}
const { transcriptions } = await response.json();
const deletePromises = transcriptions.map(transcription =>
fetch(`/transcription/${transcription.fileId}`, {
method: 'DELETE',
headers: { 'Authorization': `Bearer ${token}` }
})
);
await Promise.all(deletePromises);
return transcriptions.length;
} catch (error) {
console.error('User cleanup error:', error);
throw error;
}
}
}
// Usage examples
try {
// Delete transcriptions older than 90 days
const cleanupResult = await TranscriptionCleanupService.deleteOldTranscriptions(90);
console.log(`Cleanup complete: ${cleanupResult.successful} deleted, ${cleanupResult.failed} failed`);
// Delete all transcriptions for a specific user
const userDeletedCount = await TranscriptionCleanupService.deleteTranscriptionsByUser('user123');
console.log(`Deleted ${userDeletedCount} transcriptions for user`);
} catch (error) {
console.error('Cleanup failed:', error);
}
Best Practices
- Confirmation: Always confirm before deleting transcriptions
- Backup: Consider backing up important transcriptions before deletion
- Batch Operations: Use batch deletes for multiple items
- Error Handling: Handle partial failures in batch operations
- Audit Logging: Log deletion events for compliance
Security Considerations
- Authorization: Ensure users can only delete their own transcriptions
- Permissions: Require appropriate permissions for deletion
- Audit Trail: Maintain audit logs of deletion activities
- Data Recovery: Consider recovery options for accidental deletions
Performance Considerations
- Batch Size: Limit batch delete operations to avoid timeouts
- Storage Cleanup: Ensure storage is properly cleaned up after deletion
- Database Performance: Large-scale deletions may impact database performance
Related Endpoints
- Use
/transcription/get-transcription/{fileId}to retrieve transcriptions - Use transcription list endpoints to find transcriptions to delete
- Use user management endpoints for user-specific cleanup
Notes
- Deletion is permanent and cannot be undone
- Only the transcription text is deleted; original audio files may remain
- System may automatically clean up very old transcriptions
- Consider implementing soft deletes for recovery options
- Storage space is freed up immediately after deletion
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Unique identifier of the transcription or audio file to delete.
Example:
"670fcae25abf2d8e5c8a4a12"
Was this page helpful?