Skip to main content
DELETE
/
v1
/
tasks
/
{task_id}
Delete Task
curl --request DELETE \
  --url https://api.xpander.ai/v1/tasks/{task_id} \
  --header 'x-api-key: <api-key>'
{
  "detail": "Invalid or missing API key"
}
Delete a task by ID. Running tasks will be cancelled before deletion, and all associated data including results and conversation history will be permanently removed.

Path Parameters

task_id
string
required
Unique identifier of the task to delete (UUID format)

Response

Returns 204 No Content on successful deletion (empty response body).

Example Request

curl -X DELETE -H "x-api-key: <your-api-key>" \
  "https://api.xpander.ai/v1/tasks/<task-id>"

Response Status Codes

StatusMeaning
204Task deleted successfully
404Task not found
401Unauthorized (invalid API key)
403Forbidden (task belongs to different organization)

Important Notes

  • Permanent deletion - This action cannot be undone
  • Running tasks - Will be cancelled before deletion
  • Data removal - Results, conversation history, and all associated data are removed
  • Sub-tasks - All sub-tasks are also deleted

Example with Error Handling

TASK_ID="<task-id>"

RESPONSE=$(curl -w "\n%{http_code}" -X DELETE \
  -H "x-api-key: <your-api-key>" \
  "https://api.xpander.ai/v1/tasks/$TASK_ID")

HTTP_CODE=$(echo "$RESPONSE" | tail -n1)

if [[ $HTTP_CODE == "204" ]]; then
  echo "Task deleted successfully"
elif [[ $HTTP_CODE == "404" ]]; then
  echo "Task not found"
else
  echo "Error: $HTTP_CODE"
fi

Use Cases

  • Clean up completed tasks - Remove old task data to save storage
  • Cancel running tasks - Stop a task that’s in progress
  • Manage sensitive data - Delete tasks containing sensitive information
  • Maintain organization - Remove test or failed tasks

Authorizations

x-api-key
string
header
required

API Key for authentication

Path Parameters

task_id
string
required

Response

Successful Response