4.3 Delete files
DELETE
/documentClassification/deleteFiles
This endpoint permanently deletes one or more specific files from a batch within a document classification process.
You must provide the classificationId
, batchId
, and a list of fileIds
in the request body. This action is irreversible and will remove the specified files and their associated results, without affecting the rest of the batch or classification.
Use this endpoint to precisely remove files without deleting the entire batch or classification. Separate endpoints exist for deleting entire classifications or batches.
Server URL
https://api.extracta.ai/api/v1
Headers
Content-Type
application/json
Authorization
Bearer <token>
Body
classificationId
string
true
The classification id.
batchId
string
true
The batch id.
fileIds
list<string>
true
A list of specific file ids.
Body Example
{
"classificationId": "classificationId",
"batchId": "batchId",
"fileIds": ["fileId1", "fileId2", "fileId3"]
}
Code Example
const axios = require('axios');
async function deleteFiles(token, classificationId, batchId, fileIds) {
const url = "https://api.extracta.ai/api/v1/documentClassification/deleteFiles";
try {
const response = await axios.delete(url, {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
},
data: {
classificationId: classificationId,
batchId: batchId,
fileIds: fileIds
}
});
return response.data;
} catch (error) {
throw error.response ? error.response.data : new Error('An unknown error occurred');
}
}
async function main() {
const token = 'apiKey';
const classificationId = 'classificationId';
const batchId = 'batchId';
const fileIds = ["fileId1", "fileId2", "fileId3"];
try {
const response = await deleteFiles(token, classificationId, batchId, fileIds);
console.log("Files Deleted:", response);
} catch (error) {
console.error("Failed to delete files:", error);
}
}
main();
Responses
{
"status": "success",
"message": "Files deleted"
}
Last updated
Was this helpful?