Skip to main content

Endpoint

DELETE
/tasks/{id}
Permanently deletes a task from the database

Request

Path Parameters

id
number
required
The unique identifier of the task to delete

Example Request

curl -X DELETE http://localhost:9999/tasks/1

Response

Status Codes

204
No Content
Successfully deleted the task. No response body is returned.
404
Not Found
Task with the specified ID does not exist
422
Unprocessable Entity
Invalid ID parameter (must be a valid number)

Example Responses

(No response body)

Important Notes

This operation is permanent and cannot be undone. The task will be completely removed from the database.
A successful deletion returns a 204 No Content status with an empty response body. This is the standard REST convention for DELETE operations.

Implementation Details

This endpoint is defined in src/routes/tasks/tasks.routes.ts:96-116 and implemented in src/routes/tasks/tasks.handlers.ts:84-99. The endpoint validates the ID parameter using IdParamsSchema from the stoker library, attempts to delete the task from the database, and returns:
  • 204 No Content if the deletion was successful (rowsAffected > 0)
  • 404 Not Found if no task exists with the specified ID (rowsAffected === 0)

Build docs developers (and LLMs) love