Delete Upload API Documentation¶
Overview¶
The Delete Upload API deletes a user’s upload record and optionally its associated file from S3.
It requires the upload ID and ensures only the owner of the upload can delete it.
This is typically used to clean up unused or failed uploads.
Base URL:
https://api.apidatatools.com/delete-upload-api
Endpoint (DELETE)¶
DELETE https://api.apidatatools.com/delete-upload-api
Headers¶
| Header | Description | Required | Example |
|---|---|---|---|
x-api-key | User’s API key for authentication | Yes | abcdef1234567890 |
x-upload-id | Unique ID of the upload to delete | Yes | upl_4c0a85f67aa74ecb95a9494a96e4a327 |
Example Request¶
curl -X DELETE "https://api.apidatatools.com/delete-upload-api" \
-H "x-api-key: your_api_key" \
-H "x-upload-id: upl_4c0a85f67aa74ecb95a9494a96e4a327"
Example Successful Response¶
{
"message": "Upload upl_4c0a85f67aa74ecb95a9494a96e4a327 deleted successfully"
}
Example with Python¶
import requests
url = "https://api.apidatatools.com/delete-upload-api"
headers = {
"x-api-key": "your_api_key",
"x-upload-id": "upl_4c0a85f67aa74ecb95a9494a96e4a327"
}
r = requests.delete(url, headers=headers)
print(r.status_code)
print(r.json())
Example with JavaScript (fetch)¶
async function deleteUpload(uploadId) {
const res = await fetch("https://api.apidatatools.com/delete-upload-api", {
method: "DELETE",
headers: {
"x-api-key": "your_api_key",
"x-upload-id": uploadId
}
});
const data = await res.json();
console.log(data);
}
deleteUpload("upl_4c0a85f67aa74ecb95a9494a96e4a327");
Error Handling¶
| Error Code | HTTP Status | Description | Example |
|---|---|---|---|
Unauthorized | 401 | Missing or invalid credentials | {"error": "Unauthorized"} |
Missing Upload-Id header | 400 | Header x-upload-id not provided | {"error": "Missing Upload-Id header"} |
Upload not found | 404 | Upload ID not found or does not belong to requester | {"error": "Upload not found"} |
Failed to delete upload record | 500 | internal issue | {"error": "Failed to delete upload record"} |
Notes for Developers¶
- Deletion is idempotent — repeated requests for the same upload ID return
404after it’s deleted. - Use this API to manage storage by deleting old, unused, or failed uploads.