write
HTTP DELETE
Removes the target resource, or requests its removal. Once deleted, subsequent requests typically return 404 or 410.
DELETE /path/{id} HTTP/1.1 Properties
| Property | Value / Meaning |
|---|---|
| Safe | No - DELETE removes a resource. |
| Idempotent | Yes - repeating DELETE on an already-deleted resource still leaves it deleted (usually 404 or 204). |
| Cacheable | No - and caches should invalidate the URL on a successful DELETE. |
| Has body | Rarely - some APIs accept one, but semantics are undefined by RFC 9110. |
| Body in response | Optional - usually 204 No Content, sometimes 200 with a status envelope. |
Examples
curl -X DELETE https://api.example.com/users/42 Delete user 42.
curl -X DELETE -H 'If-Match: "abc123"' https://api.example.com/users/42 Conditional delete using an ETag to avoid deleting a stale version.
curl -X DELETE -H 'Authorization: Bearer $TOKEN' https://api.example.com/sessions/current Log out by deleting the current session.
DELETE /files/report.pdf HTTP/1.1\nHost: files.example.com Raw request to remove a file resource.
Gotcha
Idempotence means the second DELETE should not error just because the resource is gone - return 204 or 404, not 500. Some proxies and CDNs strip request bodies from DELETE, so do not put required data there.
Related methods
HTTP PUT
Replaces the target resource entirely with the request payload, or creates it if it does not exist at the given URL. The client dictates the resource identifier, so PUT is idempotent.
HTTP PATCH
Applies a partial modification to a resource, described by the patch document in the request body (e.g. JSON Patch or JSON Merge Patch). Only the specified fields change; the rest of the resource is untouched.
HTTP POST
Submits an entity to the specified resource, often causing a change in state or side effect on the server. Used for creating resources, form submissions, and RPC-style calls.
HTTP COPY
WebDAV extension (RFC 4918) that copies a resource from the Request-URI to the URI given in the Destination header. Can copy collections recursively based on the Depth header.
HTTP MOVE
WebDAV extension (RFC 4918) that moves a resource from the Request-URI to the Destination URI, equivalent to a COPY followed by a DELETE of the source. Preserves the resource across the rename or relocation.