Sweeppea API v3

Delete File

Delete a file from the authenticated user's Drive. Permanently removes the file from S3 storage and the database.

POST https://api-v3.sweeppea.com/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

{
  "Response": true,
  "Telemetry": {
    "DataConsumed": 0,
    "APICalls": 42,
    "MaxAPICalls": 1500000
  },
  "Data": {
    "FileToken": "uuid-v4-string",
    "Filename": "report.pdf",
    "SizeMB": 0.03
  },
  "Message": "File deleted successfully."
}

Error Responses

{
  "Response": false,
  "Message": "Invalid or Missing FileToken.",
  "Help": {
    "ExpectedBody": {
      "FileToken": "string (required) — UUID v4 of the file to delete"
    }
  }
}
{
  "Response": false,
  "Message": "Missing or invalid Bearer token. Send your API token in the Authorization header as: Authorization: Bearer YOUR_API_TOKEN",
  "Code": 401
}
{
  "Response": false,
  "Message": "Invalid API token. It does not match any account.",
  "Code": 403
}
{
  "Response": false,
  "Telemetry": {
    "DataConsumed": 0,
    "APICalls": 42,
    "MaxAPICalls": 1500000
  },
  "Message": "File not found or access denied.",
  "Code": 404
}
{
  "Response": false,
  "Message": "Internal server error. Please try again; if it persists, contact support with the time of this request.",
  "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
© Sweeppea. All rights reserved.