Guides
Last updated
November 13, 2025

PUT vs PATCH: Understanding the Difference Between Full and Partial Updates

Nicolas Rios
Nicolas Rios

Table of Contents:

Get your free
 API key now
stars rating
4.8 from 1,863 votes
See why the best developers build on Abstract
START FOR FREE
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
No credit card required

When updating data in a RESTful API, developers often face a familiar question: should I use PUT or PATCH? Both HTTP methods serve to modify resources on the server—but they behave quite differently.

👉 In short:

  • PUT replaces the entire resource with a new one.
  • PATCH applies partial updates to an existing resource.

Let's dive into their differences, best practices, and how to implement each in your own APIs.

Frequently Asked Questions

What is the difference between PUT and PATCH?

PUT replaces an entire resource with the data you send: any fields you omit are removed or set to null. PATCH applies only the changes you specify, leaving all other fields untouched. In short, PUT is a full replacement while PATCH is a partial update.

When should I use PUT instead of PATCH?

Use PUT when you intend to completely overwrite a resource and you have the full representation available to send. It is well suited for cases like replacing a configuration object or resetting a record to a known state. If you only need to update one or two fields, PATCH is a better fit to avoid accidentally clearing data.

Is PUT idempotent but PATCH not?

Yes. PUT is idempotent, meaning sending the same request multiple times always produces the same resource state. PATCH is not inherently idempotent (depending on how the server processes it, repeated identical PATCH requests could have cumulative effects). You can make a PATCH operation safer by using conditional request headers like ETags and If-Match.

What are JSON Patch and JSON Merge Patch?

JSON Patch (RFC 6902) and JSON Merge Patch (RFC 7386) are two standard formats for describing PATCH request bodies. JSON Patch uses an array of operation objects (add, remove, replace, etc.) for precise control. JSON Merge Patch is simpler: you send a partial document and the server merges it into the existing resource. Which format to use depends on the API you are working with.

Can using PUT cause data loss?

Yes, if you send a PUT request without including all existing fields, those fields will be removed or nulled out on the server. This is one of the most common gotchas with PUT. Always ensure you fetch the current resource first and include every field in your PUT body if you do not intend to clear the ones you omit.

How do PUT and PATCH compare for bandwidth and performance?

PATCH is generally more efficient because you only send the fields that need to change rather than the entire resource. For large objects with many fields, PATCH reduces both the payload size and server processing overhead. PUT is simpler to reason about but can be wasteful when updating a small subset of a resource's data.

Let’s send your first free
API
call
See why the best developers build on Abstract
Get your free api

🧩 Quick Comparison: PUT vs PATCH

Quick Comparison: PUT vs PATCH - Abstract API

🧱 The Full Replacement Method: Understanding PUT

The PUT method replaces the entire target resource with a new version sent by the client.

<blockquote> RFC 2616 defines PUT as: “The PUT method requests that the enclosed entity be stored under the supplied Request-URI.” </blockquote>

That means if a resource already exists, it is completely replaced — any fields not included in the request are removed.

Example:

Imagine a /users/123 resource:

{

  "id": 123,

  "name": "Alice",

  "email": "alice@example.com",

  "role": "admin"

}

If you send:

{

  "id": 123,

  "name": "Alice Smith"

}

The server will replace the full record — and unless it’s programmed otherwise, email and role could be lost. ⚠️

Use PUT when: you want a clean, full overwrite of the resource.

🧮 The Partial Modification Method: Understanding PATCH

PATCH lets you send only the changes you want to make.

<blockquote> RFC 5789 describes PATCH as: “The PATCH method applies partial modifications to a resource.” </blockquote>

This is perfect for efficiency — particularly when working with large objects or frequent small updates.

Example

Updating only the email of /users/123:

{

  "email": "alice.smith@example.com"

}

The server applies this change without replacing the rest of the data.

Use PATCH when: you only need to change specific fields or perform small, incremental updates.

⚙️ The Critical Difference: Idempotency Explained

A major distinction between PUT and PATCH lies in idempotency — whether multiple identical requests result in the same state.

  • PUT is idempotent.

Sending the same PUT request multiple times results in the same resource state.

  • PATCH is not necessarily idempotent.

Certain operations (like "op": "add" in JSON Patch) can have cumulative effects.

Making PATCH Safer with Conditional Requests

To prevent race conditions and make PATCH operations more reliable, use ETags and the If-Match header.

Example:

PATCH /users/123 HTTP/1.1

If-Match: "v2"

This ensures the update only applies if the resource’s current version matches "v2", avoiding overwriting newer changes.

Learn more about HTTP headers and conditional requests in our guide to HTTP headers.

💻 Practical Implementation: Multi-Language Code Examples

Using cURL

PUT request:

curl -X PUT https://api.example.com/users/123 \

  -H "Content-Type: application/json" \

  -d '{"id":123,"name":"Alice","email":"alice@example.com"}'

PATCH request:

curl -X PATCH https://api.example.com/users/123 \

  -H "Content-Type: application/json" \

  -d '{"email":"alice.smith@example.com"}'

🟢 Node.js (Express)

Server:

const express = require("express");

const app = express();

app.use(express.json());

let users = [{ id: 1, name: "Alice", email: "alice@example.com" }];

app.put("/users/:id", (req, res) => {

  const id = parseInt(req.params.id);

  users = users.map(u => (u.id === id ? req.body : u));

  res.json({ message: "User replaced", user: req.body });

});

app.patch("/users/:id", (req, res) => {

  const id = parseInt(req.params.id);

  users = users.map(u =>

    u.id === id ? { ...u, ...req.body } : u

  );

  res.json({ message: "User updated", user: users.find(u => u.id === id) });

});

app.listen(3000, () => console.log("Server running on port 3000"));

🐍 Python (Flask)

Server:

from flask import Flask, request, jsonify

app = Flask(__name__)

users = [{"id": 1, "name": "Alice", "email": "alice@example.com"}]

@app.put("/users/<int:user_id>")

def replace_user(user_id):

    global users

    data = request.json

    users = [data if u["id"] == user_id else u for u in users]

    return jsonify({"message": "User replaced", "user": data})

@app.patch("/users/<int:user_id>")

def update_user(user_id):

    for u in users:

        if u["id"] == user_id:

            u.update(request.json)

            return jsonify({"message": "User updated", "user": u})

if __name__ == "__main__":

    app.run(debug=True)

Client (using requests):

import requests

requests.put("https://api.example.com/users/1", json={"id":1,"name":"Alice"})

requests.patch("https://api.example.com/users/1", json={"email":"alice.smith@example.com"})

🧠 The Architect’s Choice: When to Use PUT vs PATCH

When to Use PUT vs PATCH - Abstract API

💡 Pro Tip: For APIs serving large or frequently changing datasets, PATCH can dramatically reduce network overhead and latency.

🔍 Advanced Topic: Structuring PATCH Requests

There are two main formats for PATCH requests:

Format RFC Complexity Idempotent? Example Use Case
JSON Patch RFC 6902 High (uses operations like “add”, “remove”, “replace”) ❌ Not inherently Updating arrays or nested structures
JSON Merge Patch RFC 7386 Low ✅ Yes Simple field updates

Example – JSON Patch:

[

  { "op": "replace", "path": "/email", "value": "alice.smith@example.com" }

]

Example – JSON Merge Patch:

{

  "email": "alice.smith@example.com"

}

⚠️ Common Pitfalls and Real-World Caveats

  • Data loss with PUT: Forgetting fields causes them to be removed.
  • Inconsistent state with PATCH: Repeated non-idempotent operations can yield unpredictable results.
  • Implementation differences: Some platforms (like ServiceNow’s Table API) treat PUT and PATCH similarly, so always review platform documentation before use.

🏁 Conclusion & Key Takeaways

Both PUT and PATCH are vital tools in REST API design — understanding when and how to use them can make your APIs more efficient, reliable, and intuitive.

✅ Use PUT for complete resource replacements.

✅ Use PATCH for partial, efficient updates.

✅ Employ ETags and conditional headers to make updates safer.

✅ Always test your implementation to avoid unintended data loss.

63843d6f

For more insights on API design, explore these AbstractAPI guides:

Nicolas Rios
Nicolas Rios

CEO at Abstract API

Get your free
key now
See why the best developers build on Abstract
get started for free

Related Articles

Get your free
key now
stars rating
4.8 from 1,863 votes
See why the best developers build on Abstract
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
No credit card required