Skip to main content
DELETE
/
api
/
downloads
/
{download_id}
Cancel Download
curl --request DELETE \
  --url https://api.example.com/api/downloads/{download_id}
{
  "message": "<string>"
}

Path Parameters

download_id
string
required
The unique identifier of the download task to cancel

Response

message
string
Confirmation message indicating the download was cancelled

Example Request

cURL
curl -X DELETE https://your-api.com/api/downloads/550e8400-e29b-41d4-a716-446655440000
JavaScript
fetch('https://your-api.com/api/downloads/550e8400-e29b-41d4-a716-446655440000', {
  method: 'DELETE'
})
  .then(response => response.json())
  .then(data => console.log(data.message));
Python
import requests

download_id = "550e8400-e29b-41d4-a716-446655440000"
response = requests.delete(f"https://your-api.com/api/downloads/{download_id}")
print(response.json())

Example Response

{
  "message": "Descarga cancelada"
}

Error Responses

404 Not Found

Returned when the download_id doesn’t exist.
{
  "detail": "Descarga no encontrada"
}

Behavior

  • Sets the download task status to "cancelled"
  • The task remains in the downloads list (visible via GET /api/downloads)
  • The download process will stop, but any partial files may remain on disk
  • To fully remove the task and clean up files, use DELETE /api/downloads//remove

Status Updates

After cancellation, querying GET /api/downloads will show:
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "cancelled",
  "progress": 45.5,
  // ... other fields
}

Cancel vs Remove

ActionEndpointEffect
CancelDELETE /api/downloads/{id}Stops the download, sets status to "cancelled", keeps task in list
RemoveDELETE /api/downloads/{id}/removeRemoves task from list and deletes all associated files

Use Cases

  • User clicks “Cancel” button during download
  • Download is taking too long and user wants to start over
  • Need to free up bandwidth for other downloads
  • Wrong video was selected and needs to be stopped