Tasks can be deleted by a request to the API. In order to delete tasks, the ids of the tasks to be deleted need to be supplied.
You can only delete tasks in the new state. If you try to delete tasks in other states they are not deleted, and the response will tell which tasks were not deleted in an errors array with the task id, the task state, and an error message.
There is no hard limit on the number of tasks that can be submitted for deletion, but there is a chance that requests with a large number of tasks fail with a 5xx error. A safe limit to avoid such errors is 100,000 tasks.
Click Try It! to start a request and see the response here!