Partially update with PATCH

Use PATCH to change only some fields of a resource. Send just the fields you want to modify; everything else is left untouched.

Overview

Use PATCH to change only some fields of a resource. Send just the fields you want to modify; everything else is left untouched.

In code

curl -X PATCH https://api.example.com/users/1 \
  -H 'Content-Type: application/merge-patch+json' \
  -d '{"role":"editor"}'
await fetch('https://api.example.com/users/1', {
  method: 'PATCH',
  headers: { 'Content-Type': 'application/merge-patch+json' },
  body: JSON.stringify({ role: 'editor' })
});
import requests

res = requests.patch('https://api.example.com/users/1',
                     headers={'Content-Type': 'application/merge-patch+json'},
                     json={'role': 'editor'})
res.raise_for_status()

Details

The most common format is JSON Merge Patch (RFC 7396) with `Content-Type: application/merge-patch+json`: keys you send overwrite the target, and a `null` value deletes that field. For finer control, JSON Patch (RFC 6902, `application/json-patch+json`) sends an array of add/remove/replace operations.

PATCH is not guaranteed idempotent. Relative operations like incrementing a counter give different results when repeated, so if you need retry safety prefer absolute values or pair it with `If-Match`.

Unlike PUT, which requires the full representation, PATCH sends less data and avoids accidentally clearing fields you forgot to include, which makes it a good fit for partial-save UIs.

Related headers

Related status codes