DELETE
The HTTP DELETE method requests removal of the specified resource from the server.
Usage
A DELETE request instructs the server to remove the target resource. The server determines what removal means in practice: the resource might be permanently erased, archived, or marked as inactive.
REST APIs rely heavily on DELETE to represent
resource destruction. An API endpoint like
DELETE /api/users/123 signals a clear intent to remove
the user record identified by 123. This maps directly
to the PUT/POST/GET/DELETE
pattern for create, update, read, and destroy operations.
The server responds with one of several status codes depending on the outcome:
- 200 OK confirms removal and includes a response body describing the result.
- 202 Accepted acknowledges the request but indicates removal has not yet completed.
- 204 No Content confirms removal with no response body.
A DELETE request is idempotent. Sending the same request multiple times produces the same server state as sending the request once. The first request removes the resource, and subsequent requests have no additional effect. The response codes might differ, though: the first request returns 200 OK or 204 No Content, while later requests return 404 Not Found or 410 Gone.
Properties
| Property | Value |
|---|---|
| Safe | No |
| Idempotent | Yes |
| Cacheable | No |
Example
Deleting a resource
A client requests removal of a specific file. The server removes the file and responds with 204 No Content to confirm the action without a message body.
Request
DELETE /uploads/report.pdf HTTP/1.1
Host: api.example.re
Response
HTTP/1.1 204 No Content
REST API deletion with confirmation
A REST API returns 200 OK with a JSON body confirming the deletion and identifying the removed resource.
Request
DELETE /api/users/123 HTTP/1.1
Host: api.example.re
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9...
Response
HTTP/1.1 200 OK
Content-Type: application/json
{"deleted": true, "id": 123}
The Authorization header carries a bearer token
because most APIs require Authentication before
allowing destructive operations.
Takeaway
The HTTP DELETE method requests removal of a resource from the server. The method is idempotent, making repeated requests safe for the server state, and forms a core part of RESTful API design alongside GET, POST, and PUT.