Protocols
Saved & recent

Safe HTTP methods

Also called: HTTP method safety, read-only methods

A safe HTTP method asks for essentially read-only behavior: the client is not requesting a change to the resource’s state. GET and HEAD are common examples. Incidental effects such as access logs can still happen. Safety describes the requested operation, not encryption, authorization or freedom from software bugs.

Imagine a link preview fetching GET /invoices/8. It should retrieve information without approving the invoice. An endpoint that approves it merely because a crawler follows the link violates this expectation. PUT and DELETE are not safe, even though their intended effects are idempotent when implemented correctly.

Read first
HTTP methods
Related
Idempotency, HTTP methods, HTTPS
Further reading
draft invoice crawler invoice stays draft GET invoice invoice copy safe method · read draft invoice approved invoice explicit approval unsafe operation · state change
Reading the draft invoice with GET leaves its intended resource state unchanged. A separate approval action changes that state and is unsafe in HTTP’s sense; incidental logging may still occur during reads.

View in the full Protocols collection