Delete a file from the authenticated user's Drive. Permanently removes the file from S3 storage and the database.
POST /files/delete
This endpoint permanently deletes a file from the user's Drive. It validates ownership of the file, removes the file object from S3 storage, and deletes the corresponding document from the database. This action cannot be undone.
This endpoint requires Bearer token authentication via the Authorization header.
| Parameter | Type | Required | Description |
|---|---|---|---|
FileToken |
String | Yes | UUID v4 of the file to delete |
{
"FileToken": "uuid-v4-string"
}curl -X POST "https://api-v3.sweeppea.com/files/delete" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"FileToken": "uuid-v4-string"
}'const response = await fetch('https://api-v3.sweeppea.com/files/delete', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
FileToken: 'uuid-v4-string'
})
});
const data = await response.json();
console.log(data);import requests
url = "https://api-v3.sweeppea.com/files/delete"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
payload = {
"FileToken": "uuid-v4-string"
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())200 OK
{
"Response": true,
"Telemetry": {
"DataConsumed": 0,
"APICalls": 42,
"MaxAPICalls": 1500000
},
"Data": {
"FileToken": "uuid-v4-string",
"Filename": "report.pdf",
"SizeMB": 0.03
},
"Message": "(OK) File deleted successfully."
}400 Bad Request — Missing or invalid FileToken
{
"Response": false,
"Message": "Invalid or Missing FileToken.",
"Help": {
"ExpectedBody": {
"FileToken": "string (required) — UUID v4 of the file to delete"
}
}
}401 Unauthorized
{
"Response": false,
"Message": "Invalid or Missing Bearer Token",
"Code": 401
}403 Forbidden
{
"Response": false,
"Message": "Invalid API Token",
"Code": 403
}404 Not Found — File not found or access denied
{
"Response": false,
"Telemetry": {
"DataConsumed": 0,
"APICalls": 42,
"MaxAPICalls": 1500000
},
"Message": "File not found or access denied.",
"Code": 404
}500 Internal Server Error
{
"Response": false,
"Message": "Internal Server Error",
"Code": 500
}- Permanent Deletion: This action permanently removes the file from both S3 storage and the database. It cannot be undone.
- Ownership Validation: Only the file owner can delete it. The endpoint verifies that the
FileTokenbelongs to the authenticated user. - Storage Freed: The file size is freed from the user's storage quota immediately after deletion.