Delete File
Delete a file from the authenticated user's Drive. Permanently removes the file from S3 storage and the database.
POST
/files/delete
Description
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.
Authentication
This endpoint requires Bearer token authentication via the Authorization header.
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
FileToken |
String | Yes | UUID v4 of the file to delete |
Code Examples
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"
}'
Response
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."
}
Error Responses
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
}
Important Notes
- ⚠️ 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 FileToken belongs to the authenticated user
- 💾 Storage Freed: The file size is freed from the user's storage quota immediately after deletion