How to Delete Task
Delete one or more prediction jobs by their IDs.
Warning: Deleted predictions cannot be recovered. Only finished predictions in your organization can be deleted.
Endpoint
POST https://api.wavespeed.ai/api/v3/predictions/deleteRequest
curl --fail-with-body --connect-timeout 10 --max-time 60 \
--request POST 'https://api.wavespeed.ai/api/v3/predictions/delete' \
--header "Authorization: Bearer $WAVESPEED_API_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"ids": ["247ae6a651", "8f5f0bdc7b3742"]
}'Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
ids | array | Yes | List of prediction IDs to delete |
Response
{
"code": 200,
"message": "success",
"data": {
"deleted_count": 2,
"deleted_ids": ["247ae6a651", "8f5f0bdc7b3742"]
}
}Response Fields
| Field | Type | Description |
|---|---|---|
code | integer | HTTP status code (200 for success) |
message | string | Status message |
data.deleted_count | integer | Number of predictions deleted by this request |
data.deleted_ids | array | IDs actually deleted by this request; skipped IDs are not included |
Python Example
import os
import requests
api_key = os.environ["WAVESPEED_API_KEY"]
def delete_tasks(task_ids):
response = requests.post(
"https://api.wavespeed.ai/api/v3/predictions/delete",
headers={
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json"
},
json={"ids": task_ids},
timeout=(10, 60),
)
response.raise_for_status()
body = response.json()
if body.get("code") != 200:
raise RuntimeError(body.get("message", "Failed to delete predictions"))
return body
# Delete a single task
result = delete_tasks(["pred_abc123"])
print(f"Deleted: {result['data']['deleted_count']}")
# Delete multiple tasks
result = delete_tasks(["pred_1", "pred_2", "pred_3"])
print(f"Deleted: {result['data']['deleted_count']}")Notes
- Multiple predictions can be deleted in a single request
- Tasks with status
createdorprocessingcannot be deleted. They are skipped, and deletion does not cancel a running task. - Non-existent IDs, tasks outside your organization, and already deleted tasks are also skipped. Check
deleted_idsanddeleted_count; a successful response does not mean every requested ID was deleted. - Deleted tasks remain visible in prediction history, detail queries, and billing records with their prediction ID, model, and
deletedstatus. Their request content and outputs are no longer returned, and shared results are unavailable. - Deleting a task does not refund its charge or remove its billing record.
When to Delete
| Scenario | Recommendation |
|---|---|
| Task still running or stuck | Check its status; deletion cannot stop it. Contact support if it remains stuck. |
| Finished task no longer needed | Download any outputs you want to keep, then delete the task |
| Wrong parameters | A new submission is a separate request with its own charge. Delete the old task only after it finishes. |
Error Responses
| Code | Description |
|---|---|
| 401 | Invalid API key |
| 400 | Invalid request (missing ids) |