Tasks delete endpoint does not work if the optional parameter was not provided.
As per documentation [https://docs.pulpproject.org/dev-guide/integration/rest-api/tasks.html#deleting-completed-tasks\] the state (string) - (optional) only delete tasks currently in this state.
However if the state is not provided the response is always 403. If the state is provided then response can be 204. Basically, an optional parameter is behaving as necessary.
Use HTTP DELETE on the path: /pulp/api/v2/tasks/ without provide the state.