Ctrl + K
HTTP18 min read

Safe vs Unsafe HTTP Methods

Understand the difference between safe and unsafe HTTP methods, including GET, HEAD, OPTIONS, POST, PUT, PATCH, and DELETE, and learn why HTTP method safety matters.

Published: 2026-10-05

HTTP methods communicate what a client wants to do with a resource. Some methods are defined as safe, meaning that the client does not request a state-changing operation. Other methods are unsafe because they can modify server state or trigger an operation with side effects.

Understanding HTTP safety is important when building REST APIs, frontend applications, web crawlers, browser integrations, and automated clients. It also helps explain why a search engine crawler can generally follow GET links but should not blindly submit forms or trigger state-changing endpoints.

The terms safe and unsafe have a specific meaning in HTTP. Safe does not mean that a request can never cause any side effect on the server. It means that the client is not requesting a state-changing action as part of the method's defined semantics.

What Is a Safe HTTP Method?

A safe HTTP method is a method whose defined semantics are intended to be read-only from the perspective of the requested resource. The client asks the server to retrieve information, inspect capabilities, or perform another operation that does not request a state change to the target resource.

GET /api/products/42

The GET request asks the server to retrieve a representation of a product. It does not ask the server to update, delete, or create that product.

A safe method can still cause incidental server-side activity. The server can write access logs, collect metrics, update monitoring information, perform authentication checks, or record analytics. Those activities do not make GET unsafe because they are not the requested modification of the target resource.

What Is an Unsafe HTTP Method?

An unsafe HTTP method is one whose semantics can request a state-changing operation. Examples include creating a resource, modifying a resource, deleting a resource, or triggering another operation with an intended side effect.

POST /api/orders
Content-Type: application/json

{
  "productId": 42,
  "quantity": 1
}

This request can create an order. Because the client is requesting a state-changing operation, POST is unsafe.

Safe Does Not Mean 'No Server Activity'

One of the most common misconceptions is that a safe request must produce absolutely no server-side effects. That is not what HTTP safety means.

  • A GET request can be logged.
  • A GET request can update monitoring counters.
  • A GET request can generate cache entries.
  • A GET request can trigger authentication and authorization checks.
  • A GET request can cause internal processing.

The important distinction is between incidental effects and the requested resource operation. A GET request should not be designed as an instruction to change application state.

Safe HTTP Methods at a Glance

MethodSafe?Typical purpose
GETYesRetrieve a resource or representation
HEADYesRetrieve response metadata without the response body
OPTIONSYesDiscover communication options for a resource
POSTNoSubmit data or trigger processing
PUTNoCreate or replace a resource representation
PATCHNoPartially modify a resource
DELETENoDelete a resource

The classification comes from HTTP method semantics. An application should not redefine GET as an operation that intentionally changes application state simply because GET is technically capable of carrying parameters or reaching any server-side code.

GET Is Safe

GET is the most familiar safe HTTP method. It is primarily used to retrieve a representation of a resource.

GET /articles/123
Accept: application/json

The server may perform substantial work to produce the response, but the GET operation itself does not request a modification of the article.

HEAD Is Safe

HEAD has semantics similar to GET, but the server does not send the response body. It is useful when a client needs response metadata without downloading the complete representation.

HEAD /files/report.pdf

A client can use HEAD to inspect information such as content type, content length, caching metadata, or modification information when provided by the server.

OPTIONS Is Safe

OPTIONS is also a safe method. It can be used to determine the communication options available for a resource or server.

OPTIONS /api/users

Browsers also use OPTIONS requests as part of CORS preflight processing when a cross-origin request requires preflight.

POST Is Unsafe

POST is unsafe because it can request processing that changes server state. A common example is creating a new resource in a collection.

POST /api/users
Content-Type: application/json

{
  "name": "Alex"
}

The server can create a new user as a result of this operation. Repeating the request can also create another user, depending on the API design.

PUT Is Unsafe

PUT is unsafe because it can create or replace the state of a resource at a target URI.

PUT /api/users/42
Content-Type: application/json

{
  "name": "Alex"
}

Even though PUT is defined as idempotent, it is not safe because it intentionally modifies server state.

PATCH Is Unsafe

PATCH is used for partial modifications of a resource and is therefore unsafe.

PATCH /api/users/42
Content-Type: application/json

{
  "name": "Alex"
}

The request asks the server to change the existing resource, so it cannot be considered safe.

DELETE Is Unsafe

DELETE is unsafe because it requests removal of a resource.

DELETE /api/users/42

Although DELETE is an idempotent HTTP method, it is still unsafe. Idempotency and safety describe different properties.

Safe vs Idempotent

Safety and idempotency are related HTTP concepts, but they should not be confused.

PropertyQuestion it answers
SafeDoes the method's defined semantics request a state-changing operation?
IdempotentDoes repeating the same request have the same intended effect as performing it once?

A method can be both safe and idempotent. GET is an example. A method can be idempotent but unsafe. PUT and DELETE are examples.

MethodSafe?Idempotent?
GETYesYes
HEADYesYes
OPTIONSYesYes
PUTNoYes
DELETENoYes
POSTNoNo
PATCHNoNot inherently

Why the Distinction Matters

HTTP clients, browsers, crawlers, proxies, caches, and other automated systems can use method semantics when deciding how to handle requests. If a method is incorrectly used for a state-changing operation, automated clients can trigger unintended changes.

For example, an application should not create an account deletion endpoint such as:

GET /delete-account?id=42

The problem is not that GET cannot technically reach the deletion code. The problem is that GET is defined as safe, while account deletion is a state-changing operation.

Why State-Changing GET Requests Are Dangerous

A state-changing GET endpoint can be accidentally triggered by systems that reasonably assume GET is safe. Search engine crawlers, link preview systems, browser features, prefetching mechanisms, monitoring systems, or users following links can all cause GET requests.

GET /api/delete-user/42
⚠️ Do not design GET endpoints to intentionally perform destructive or state-changing actions. Use an appropriate unsafe method and require the client to explicitly request the operation.

HTTP Safety and Web Crawlers

Web crawlers discover resources by following links and requesting URLs. GET is specifically designed to be safe for this kind of retrieval.

If visiting a URL could delete data, create an account, publish content, or perform another important action, a crawler or automated client could unintentionally trigger that operation.

This is one reason state-changing operations should not be hidden behind GET URLs simply because a GET link is convenient to implement.

HTTP Safety and Browser Prefetching

Browsers and other clients can perform speculative retrieval in some situations. Safe methods are designed so that retrieving a resource does not intentionally request a state-changing operation.

An application that uses GET for destructive actions can therefore expose itself to behavior that the developer did not expect.

HTTP Safety and Caching

Safe methods are closely associated with retrieval and therefore work naturally with HTTP caching mechanisms. GET responses can be cached when the response and cache-control rules permit it.

Unsafe methods are generally treated differently by HTTP caches because they represent operations that can modify server state. A cache must not simply treat an unsafe request like a reusable read operation.

Safe Does Not Mean Cacheable

Safety and cacheability are separate concepts. A safe method is not automatically cacheable in every situation, and an unsafe method is not simply classified as unsafe because it cannot be cached.

Caching behavior depends on HTTP caching rules, response headers, request semantics, and the particular method. Safety describes the requested operation, while cacheability describes whether a response can be stored and reused under the applicable rules.

Safe Methods and User Actions

A user can trigger a safe request through a link or page navigation without that request being intended to change application state.

<a href="/products/42">
  View product
</a>

Following the link causes a GET request. The server should interpret that request as retrieval of the product rather than as a command to modify it.

Unsafe Actions Should Be Explicit

Operations that create, modify, or delete data should be represented using methods whose semantics communicate that an action can change server state.

POST /api/orders

PUT /api/users/42

PATCH /api/users/42

DELETE /api/users/42

This distinction makes APIs easier for clients and infrastructure to reason about and reduces the chance that a passive retrieval mechanism will accidentally perform an important operation.

Safe Methods and HTML Forms

HTML forms commonly use GET and POST. GET forms are appropriate for operations where the submitted values are used to retrieve or filter information.

<form method="get" action="/search">
  <input name="q" />
  <button type="submit">Search</button>
</form>

Submitting the form results in a GET request such as:

GET /search?q=javascript

A search operation is a typical example of a safe request.

POST Forms for State-Changing Operations

When a form submits information that creates or modifies server-side state, POST is commonly used.

<form method="post" action="/account">
  <input name="displayName" />
  <button type="submit">Save</button>
</form>

The form communicates that the submission is an operation rather than simply retrieving a resource.

Safe Methods and CSRF

The distinction between safe and unsafe methods is also important for web security. Cross-site request forgery attacks attempt to cause a user's browser to send an unwanted request to a site where the user is authenticated.

A state-changing endpoint should not rely on GET semantics. Unsafe operations should use appropriate server-side protections, such as CSRF defenses where applicable, proper authentication and authorization, and suitable request validation.

⚠️ Using POST instead of GET is not, by itself, a complete CSRF defense. Applications still need appropriate CSRF protection and cookie, authentication, authorization, and request-validation strategies for their architecture.

Safe Methods and REST API Design

REST-style API design benefits from preserving the semantics of HTTP methods. A client can then understand the general nature of an operation from the method itself instead of needing a custom convention for every endpoint.

OperationTypical methodSafe?
Retrieve a productGETYes
Search productsGETYes
Create an orderPOSTNo
Replace a profilePUTNo
Update selected profile fieldsPATCHNo
Delete an orderDELETENo

Query Parameters Do Not Make GET Unsafe

GET requests frequently contain query parameters, but query parameters do not determine whether a method is safe.

GET /products?category=books&page=2

This remains a safe GET request because the parameters are being used to describe what the client wants to retrieve.

The problem occurs when an application interprets GET parameters as a command to modify state:

GET /products/delete?id=42

The presence of query parameters does not change the method's safety semantics.

Safe Methods and API Documentation

API documentation should clearly communicate what each endpoint does. If an endpoint uses an unusual behavior, relying only on its URL can make the API difficult to use safely.

  • Document the HTTP method.
  • Document whether the endpoint retrieves or changes state.
  • Document request parameters and their meaning.
  • Document authentication and authorization requirements.
  • Document relevant response status codes.
  • Document retry behavior for operations that can be repeated.

Can a Safe Method Have Side Effects?

Yes. A server can perform incidental processing when handling a safe request. For example, a GET request can produce logs, metrics, cache entries, or other internal activity.

The important rule is that these side effects are not the requested modification of the target resource. A developer should not intentionally use GET as a command for changing application state.

Safe vs Unsafe: Practical Examples

RequestClassificationReason
GET /articles/10SafeRetrieves an article
GET /search?q=httpSafeRetrieves search results
HEAD /image.pngSafeRetrieves response metadata
OPTIONS /api/usersSafeInspects communication options
POST /api/usersUnsafeCan create a user
PUT /api/users/10UnsafeCan replace resource state
PATCH /api/users/10UnsafeCan modify resource state
DELETE /api/users/10UnsafeCan remove a resource

Common Mistakes

Mistake 1: Thinking Safe Means 'No Side Effects Anywhere'

Safe describes the intended semantics of the request, not the absence of every possible internal server action. Logging and metrics do not turn GET into an unsafe method.

Mistake 2: Thinking Idempotent Means Safe

PUT and DELETE are idempotent but unsafe. They can change server state while still having idempotent semantics.

Mistake 3: Using GET for Deletion

A URL such as /delete?id=42 should not be implemented as a GET operation. Automated retrieval systems can request the URL without intending to delete anything.

Mistake 4: Assuming POST Automatically Prevents Security Problems

POST is unsafe, but simply changing a GET endpoint to POST does not automatically solve authentication, authorization, CSRF, validation, or duplicate-submission problems.

Mistake 5: Treating Every GET as Cacheable

Safety and cacheability are separate concepts. A safe request can still have response-specific caching restrictions, and caching behavior depends on HTTP rules and response metadata.

How to Test Safe and Unsafe Endpoints

An HTTP request builder or API testing tool can help verify that endpoints follow their intended semantics.

  • Send the endpoint using its documented HTTP method.
  • Inspect the response status and headers.
  • Verify whether the resource state changed.
  • Try the same operation with an unintended method when testing server validation.
  • Check that state-changing operations are not exposed through GET.
  • Test authentication and authorization requirements.
  • Test CSRF protections where applicable.

Example API Review

GET    /api/products/42
POST   /api/orders
PUT    /api/users/42
PATCH  /api/users/42
DELETE /api/users/42

This API uses methods according to their general semantics: GET retrieves information, while POST, PUT, PATCH, and DELETE represent operations that can change state.

💡 When reviewing an API, ask a simple question for every GET endpoint: 'Could this request intentionally change application state?' If the answer is yes, the endpoint should be redesigned around an appropriate unsafe method.

Safe Methods in Frontend Applications

Frontend developers frequently interact with safe and unsafe methods through fetch, Axios, TanStack Query, or other HTTP clients. The distinction should be reflected in how UI actions are implemented.

const response = await fetch("/api/products/42");

const product = await response.json();

A GET request is appropriate for retrieving the product. A user action such as deleting the product should use an unsafe method instead:

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

This makes the intended operation explicit both in frontend code and at the HTTP protocol level.

Safe Methods and Navigation

Normal web navigation is strongly associated with GET. When a user follows a link, the browser requests the destination resource rather than sending an instruction to modify application data.

<a href="/account">
  Open account
</a>

A web application should therefore be designed so that opening a URL does not unexpectedly perform destructive or transactional operations.

Safe Methods and URL Design

URLs identify resources, while HTTP methods communicate the requested operation. Good API design combines the two instead of encoding every action directly into a GET URL.

Less appropriate designTypical HTTP-oriented design
GET /delete-user?id=42DELETE /users/42
GET /create-order?product=42POST /orders
GET /update-user?id=42&name=AlexPATCH /users/42

The second column makes the state-changing nature of the operations explicit.

Safety Does Not Depend on the Response Status

An endpoint does not become safe simply because it returns 200 OK, 204 No Content, or another successful status. Safety is a property of the method semantics and the requested operation.

Likewise, a safe method can return an error status such as 404 Not Found or 500 Internal Server Error without becoming unsafe.

Safe Methods and HTTP Specifications

HTTP defines method semantics so that clients and intermediaries can make reasonable assumptions about how requests should behave. Safety is one of those semantic properties.

The practical benefit is interoperability. A browser, crawler, proxy, API client, or other HTTP implementation does not need to understand every application's internal business logic before knowing that GET is intended for safe retrieval rather than an intentional destructive command.

Frequently Asked Questions

What is a safe HTTP method?

A safe HTTP method is one whose defined semantics are intended to be read-only with respect to the requested resource. GET, HEAD, and OPTIONS are common safe methods.

Which HTTP methods are safe?

GET, HEAD, and OPTIONS are safe HTTP methods. Safe methods are intended not to request a state-changing operation on the target resource.

Is POST a safe HTTP method?

No. POST is unsafe because it can submit data, create resources, or trigger processing that changes server state.

Is PUT safe?

No. PUT is idempotent but unsafe because it can create or replace the state of a resource.

Is DELETE safe?

No. DELETE is unsafe because it requests removal of a resource. It is nevertheless defined as idempotent.

Can a safe HTTP method have side effects?

Yes. A safe request can produce incidental effects such as logging, metrics, or cache activity. Safety means the request does not intentionally request a state-changing operation on the target resource.

Why should GET not be used for deletion?

GET is defined as safe and can be triggered by navigation, crawlers, prefetching, and other automated retrieval mechanisms. A destructive action behind GET could therefore happen without the client intending to perform it.

Are safe HTTP methods always idempotent?

The standard safe methods such as GET, HEAD, and OPTIONS are also idempotent. However, safety and idempotency describe different properties and should not be treated as synonyms.

Conclusion

Safe and unsafe HTTP methods describe whether the method's semantics request a state-changing operation. GET, HEAD, and OPTIONS are safe, while POST, PUT, PATCH, and DELETE are unsafe because they can request operations that modify server state.

Safety is different from idempotency. PUT and DELETE demonstrate this clearly: both are unsafe because they can modify server state, but both are also defined as idempotent. A request can therefore be unsafe without being non-idempotent.

Following HTTP method semantics makes APIs easier to understand and safer to operate with browsers, crawlers, caches, proxies, and automated clients. In particular, state-changing operations should not be hidden behind GET URLs. Use safe methods for retrieval and appropriate unsafe methods for operations that intentionally change application state.

Found an issue?

Found an error, outdated information, or something missing from this article? Let me know through the Contact page.

Your feedback helps improve our articles and keep them accurate and useful.