Coding

HTTP Request Methods Explained: GET, POST, PUT, DELETE and More

HTTP request methods tell a server what a client wants done with a resource: GET reads it, POST sends data for the server to process, PUT replaces it, PATCH changes part of it, and DELETE removes it. Each method also carries two properties that matter in practice, whether it is safe (read-only) and whether it is idempotent (repeating it has the same effect as sending it once).

HTTP request methods at a glance

This table follows the method list on MDN, which matches RFC 9110 and RFC 5789. "Cacheable" for POST and PATCH is conditional: MDN says they are cacheable only when the response carries explicit freshness information and a matching Content-Location header.

MethodWhat it doesSafeIdempotentCacheable
GETTransfer a current representation of the target resourceYesYesYes
HEADSame as GET, but do not transfer the response contentYesYesYes
POSTSubmit data to the target resource for processingNoNoConditional
PUTCreate or replace the target resource with the request contentNoYesNo
PATCHApply a partial modification to a resourceNoNoConditional
DELETERemove all current representations of the target resourceNoYesNo
CONNECTEstablish a tunnel to the server identified by the target resourceNoNoNo
OPTIONSDescribe the communication options for the target resourceYesYesNo
TRACEPerform a message loop-back test along the path to the target resourceYesYesNo

Method names are case-sensitive and the standardized ones are uppercase, so GET is a method and get is not.

What safe and idempotent mean

These two words come from RFC 9110, section 9.2, and they decide how browsers, proxies and HTTP libraries treat a request.

  • Safe means the method's defined semantics are essentially read-only. The client does not request a change of state on the origin server and does not expect one. GET, HEAD, OPTIONS and TRACE are safe.
  • Idempotent means that several identical requests have the same intended effect on the server as a single request. PUT and DELETE are idempotent, and so is every safe method.

Two details are easy to miss. First, "safe" describes what the method is defined to mean, not what a particular server does. A badly written server can delete data on a GET, but then it is breaking the contract, and a crawler or prefetching browser that follows the link will trigger the deletion. Second, idempotent is about the intended effect, not the response. Deleting the same item twice is idempotent even though the first request may return 200 or 204 and the second 404.

The practical payoff is retries. RFC 9110 notes that some requests can be automatically retried after an underlying connection failure, and idempotent methods are the ones where that is safe to do. If a connection drops after you sent a POST, you cannot tell whether the server processed it, and sending it again could create a second order.

GET: read a resource

GET asks for a representation of the target resource. It is the method behind every link you click and every image a page loads. Because it is safe and cacheable, browsers and CDNs can store and reuse the response.

GET /articles/42 HTTP/1.1
Host: example.com
Accept: application/json

RFC 9110 says content in a GET request has no generally defined semantics, and that it cannot change the meaning or target of the request. Some servers and proxies reject GET requests with a body, so put the parameters in the URL query string instead. If a query is too long or too sensitive for a URL, use POST.

HEAD: read only the headers

HEAD behaves like GET but the server sends no response content. Use it to check whether a URL exists, read Content-Length or Last-Modified, or confirm a cached copy is still current, without downloading the body.

POST: send data for processing

POST submits content to the target resource, which handles it according to its own semantics. That vague definition is why POST is used for so much: creating a new item whose URL the server chooses, submitting a form, running a search with a large body, or triggering an action such as sending an email. It is neither safe nor idempotent, so clients do not retry it automatically. For when to prefer it over PUT, see PUT vs POST: differences, idempotency and when to use each.

PUT: create or replace

PUT requests that the state of the target resource be created or replaced by the enclosed content. The client names the exact URL, and the body is the complete new state. Sending the same PUT twice leaves the same result, which is why it is idempotent. A server typically answers 201 when it creates the resource and 200 or 204 when it replaces an existing one.

PATCH: change part of a resource

PUT overwrites the whole resource, so changing one field means sending all of them. PATCH, defined in RFC 5789, sends a set of changes to apply to the existing resource instead. The request body is a patch document, and its format depends on the media type: JSON Patch and JSON Merge Patch are two common ones.

RFC 5789 says PATCH is neither safe nor idempotent by default, although a client can design its patches to be idempotent. A server that supports it should list the accepted formats in an Accept-Patch response header, and answers 415 if it does not support the format you sent. To choose between the two, read PUT vs PATCH.

DELETE: remove a resource

DELETE asks the server to remove all current representations of the target resource. It is idempotent, so repeating it is fine. As with GET, content in a DELETE request has no generally defined semantics, so identify what to delete with the URL, not the body. Common success responses are 200, 202 (accepted, will be deleted later) and 204 (done, nothing to return).

OPTIONS: ask what is allowed

OPTIONS describes the communication options for the target resource. A server usually answers with an Allow header listing the methods it supports for that URL:

OPTIONS /articles/42 HTTP/1.1
Host: example.com

Example response headers (the values depend on the server):

HTTP/1.1 204 No Content
Allow: GET, HEAD, PUT, DELETE, OPTIONS

Browsers also send OPTIONS on their own as a CORS preflight before some cross-origin requests, to ask whether the real request is permitted. If your API returns an error to those preflight requests, the actual request never gets sent.

CONNECT and TRACE: the specialist methods

CONNECT establishes a tunnel to the server identified by the target resource. Its main use is HTTPS through an HTTP proxy: the client asks the proxy to open a TCP tunnel to the destination, then speaks TLS through it. You rarely write one by hand.

TRACE performs a message loop-back test along the path to the target, so the final recipient reflects the request it received. It is mainly a diagnostic tool, and many servers disable it. Leaving it off is a common hardening step.

Newer method: QUERY

MDN also lists a QUERY method, as of this writing in November 2026. It is described as safe and idempotent like GET, but it allows request content with defined semantics, which makes it a candidate for complex searches that do not fit in a URL. Check that your server, proxies and client library support it before you rely on it.

Which method should I use?

  • Reading data with no side effects: GET.
  • Creating something where the server picks the ID, or running an action: POST.
  • Replacing a whole resource at a known URL: PUT.
  • Changing a few fields: PATCH.
  • Removing a resource: DELETE.

The method says what you are trying to do, and the status code says what happened. For the response side, see HTTP status codes explained.

If a method is rejected

A 405 Method Not Allowed response means the URL exists but does not support the method you used. The server should include an Allow header listing the methods it does accept, so read that header first. A 404 on a method that should work often means the route is registered for a different method, for example a handler that accepts POST while you sent PUT. HTML forms can only submit GET and POST, so to send PUT, PATCH or DELETE from a browser you need JavaScript such as fetch:

await fetch("/articles/42", { method: "DELETE" });

Frequently asked questions

What are the main HTTP request methods?
RFC 9110 defines eight: GET, HEAD, POST, PUT, DELETE, CONNECT, OPTIONS and TRACE. PATCH is defined separately in RFC 5789. Day to day, most web and API traffic uses GET, POST, PUT, PATCH and DELETE.
What does safe mean for an HTTP method?
A safe method has read-only semantics: the client does not request, and does not expect, a change of state on the origin server. RFC 9110 defines GET, HEAD, OPTIONS and TRACE as safe.
What does idempotent mean for an HTTP method?
A method is idempotent if sending the same request several times has the same intended effect on the server as sending it once. RFC 9110 lists PUT, DELETE and all safe methods as idempotent. POST and PATCH are not.
Can a GET request have a body?
The syntax allows it, but RFC 9110 says content in a GET request has no generally defined semantics and cannot change the meaning or target of the request. Put parameters in the URL for GET, or use POST when you need to send a body.
Are HTTP method names case-sensitive?
Yes. RFC 9110 says the method token is case-sensitive, and all standardized method names are uppercase. A request sent as get is a different, unrecognized method.

Sources