Permanently delete a file
curl --request DELETE \
--url https://api.uk.veridox.ai/cases/{caseId}/files/{fileId} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.uk.veridox.ai/cases/{caseId}/files/{fileId}"
headers = {"x-api-key": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.uk.veridox.ai/cases/{caseId}/files/{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_URL => "https://api.uk.veridox.ai/cases/{caseId}/files/{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 => [
"x-api-key: <api-key>"
],
]);
$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 := "https://api.uk.veridox.ai/cases/{caseId}/files/{fileId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.uk.veridox.ai/cases/{caseId}/files/{fileId}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uk.veridox.ai/cases/{caseId}/files/{fileId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}Files
Delete File
Permanently erase a file and everything produced from it.
DELETE
/
cases
/
{caseId}
/
files
/
{fileId}
Permanently delete a file
curl --request DELETE \
--url https://api.uk.veridox.ai/cases/{caseId}/files/{fileId} \
--header 'x-api-key: <api-key>'import requests
url = "https://api.uk.veridox.ai/cases/{caseId}/files/{fileId}"
headers = {"x-api-key": "<api-key>"}
response = requests.delete(url, headers=headers)
print(response.text)const options = {method: 'DELETE', headers: {'x-api-key': '<api-key>'}};
fetch('https://api.uk.veridox.ai/cases/{caseId}/files/{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_URL => "https://api.uk.veridox.ai/cases/{caseId}/files/{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 => [
"x-api-key: <api-key>"
],
]);
$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 := "https://api.uk.veridox.ai/cases/{caseId}/files/{fileId}"
req, _ := http.NewRequest("DELETE", url, nil)
req.Header.Add("x-api-key", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.uk.veridox.ai/cases/{caseId}/files/{fileId}")
.header("x-api-key", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uk.veridox.ai/cases/{caseId}/files/{fileId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
request["x-api-key"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}{
"error_code": "request.cases.file.missing-risk-score",
"error_message": "User tried to perform an invalid operation on a file without a risk score.",
"error_details": {
"field": "email_address"
}
}Permanently deletes a file, along with its analysis, its reports, and every conversation that used it, including file comparisons. You can delete a file that is live or already archived. A successful call returns
Archive a file to remove it from view and keep its data. Delete it when the data itself must be erased.
If the same document was uploaded more than once, its uploads can share some analysis outputs, such as reports. A shared output is erased when the last file that uses it is deleted.
204 No Content.
This endpoint requires the permanent file deletion feature to be enabled for your organisation. Without it, the API returns
403 with request.organisations.feature-flag.not-enabled. Learn more.Deletion is irreversible; there is no restore endpoint. Confirm the action before calling this endpoint.
Permission
Requiresorganisation_files:purge, which the Owner role holds by default. A caller without it receives 403 with request.cases.case-file.action-not-permitted.
To delete a file you did not upload, you also need organisation_files:read; otherwise the API returns 404.
An API key never counts as the uploader of a file, so it always needs both permissions. A key granted organisation_files:purge is treated as also holding organisation_files:read, so purge alone is enough.
Archive or Delete
| Archive File | Delete File | |
|---|---|---|
| Permission | organisation_files:delete | organisation_files:purge |
| Effect | Hides the file from all live API responses | Erases the file and everything produced from it |
| File data, analysis, and conversations | Kept | Erased |
| Reversible | No | No |
Best Practices
- Wait for processing to finish: A file can only be deleted once its analysis has finished. Deleting it earlier returns
409 Conflictwithrequest.cases.case-file.not-ready-for-deletion; try again shortly. - Call again after a
502: If the API cannot erase every stored copy, it returns502withrequest.cases.case-file.delete-failed. The file is already hidden and cannot be used again. Call the endpoint again to finish deleting it. - Treat
404after a retry as done: Once a deletion has completed, further calls return404 Not Found.
Audit Log
Each deletion is recorded in your organisation’s audit log asfile.deleted, with the file ID, the case, and the conversations that were deleted. The file name is not recorded.
Related
- Archive File hides a file and keeps its data.
- Case Management covers deletion in context.
Was this page helpful?
⌘I