Delete a resource

Remove the target resource with the DELETE method. On success you usually get a bodyless 204 No Content.

Overview

Remove the target resource with the DELETE method. On success you usually get a bodyless 204 No Content.

In code

curl -X DELETE https://api.example.com/users/1 \
  -H 'Authorization: Bearer <token>'
const res = await fetch('https://api.example.com/users/1', {
  method: 'DELETE',
  headers: { Authorization: 'Bearer <token>' }
});
if (res.status !== 204 && !res.ok) throw new Error('delete failed');
import requests

res = requests.delete('https://api.example.com/users/1',
                      headers={'Authorization': 'Bearer <token>'})
res.raise_for_status()

Details

The success code varies. Servers return 204 when there is no body to send, 200 when they include a result or message, and sometimes 202 Accepted when the deletion is merely queued.

DELETE is idempotent. Deleting an already-deleted resource usually returns 404, but the final state (resource gone) is the same, so retries are safe. Some APIs even return 204 for a resource that no longer exists.

Because deletion is hard to undo, it almost always requires authentication, and you can add `If-Match` to delete only a specific version and guard against concurrent modifications.

Related headers

Related status codes