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

← All HTTP methods · HTTP status codes · HTTP headers