REST API verbs—GET, POST, PUT, PATCH, DELETE—determine how clients interact with server resources. Choose the right verb based on the operation’s intent and whether it changes the resource’s state or retrieves data. Using the correct verb ensures predictable behavior, proper caching, and alignment with HTTP standards.

GET Retrieves Data Without Side Effects

Use GET to request data from a server. It is idempotent (repeating the same request returns the same result) and safe (it does not alter server state). For example, sending GET /users/123 fetches user #123’s details without modifying anything. GET requests can include query parameters for filtering, sorting, or pagination, such as GET /orders?status=pending&limit=20

POST Creates New Resources or Triggers Actions

Use POST to create a new resource when the server assigns the identifier, or to execute a non-idempotent action that doesn’t map to standard CRUD operations. For instance, POST /users with a JSON body like {"name": "Alex", "email": "alex@example.com"} creates a new user and returns HTTP 201 Created with a Location header pointing to the new resource (e.g., /users/456). POST is not idempotent: sending the same request twice may create two separate resources. It also handles complex operations like submitting a payment or uploading a file when the action’s outcome is not purely about creating or updating a single resource. Always validate input data on the server and return appropriate error codes (e.g., 400 Bad Request for invalid data).

PUT Replaces an Entire Resource

Use PUT to fully replace an existing resource with new data. The client specifies the resource’s identifier, and the request body must contain the complete updated representation—even fields left unchanged. For example, PUT /users/123 with {"name": "Alex", "email": "alex.new@example.com", "role": "admin"} overwrites the user’s current data entirely. PUT is idempotent: making the same request multiple times leaves the resource in the same state after the first call. If the resource does not exist, a server may create it (idempotent creation), but clients should not rely on this behavior. Returning HTTP 200 OK with the updated resource or 204 No Content is common. Be cautious: omitting fields in the body may unintentionally clear them if the server treats the body as the full new state.

PATCH Updates Part of a Resource

Use PATCH to apply partial modifications to a resource, changing only the fields you specify. This avoids the risk of accidentally clearing data that should remain unchanged. For example, PATCH /users/123 with {"email": "alex.new@example.com"} updates only the email address, leaving name and role intact. PATCH is idempotent only if the update operation itself is deterministic (e.g., setting a value); operations like incrementing a counter are not idempotent. The request body format must be defined by the API—common standards include JSON Patch (RFC 6902) with operations like {"op": "replace", "path": "/email", "value": "new@example.com"} or JSON Merge Patch. Use PATCH when clients may not have the full current state, or when bandwidth efficiency matters. If the resource is missing, return 404 Not Found; if the patch is malformed, return 400 Bad Request.

DELETE Removes a Resource

Use DELETE to remove a resource by its identifier. For example, DELETE /users/123 deletes user #123. DELETE is idempotent: sending it once or ten times has the same effect after the first successful call (the resource is gone). A successful deletion typically returns HTTP 204 No Content (no body), though some APIs return 200 OK with a confirmation message. Be clear about what "deletion" means—some systems perform soft deletes (marking the record inactive) rather than physical removal. If deletion triggers cascading actions (e.g., removing related orders), document them. Never use DELETE to trigger an action that doesn’t actually remove the resource; that belongs in POST. Check for authorization before acting: returning 403 Forbidden if the user lacks permission.

Choosing the Right Verb: Decision Guide

Follow this checklist to select a verb quickly:

  1. Is the request retrieving data only? → Use GET.
  2. Does the request create a new resource and the server assigns the ID? → Use POST.
  3. Does the request replace the entire resource and the client provides the full new state? → Use PUT.
  4. Does the request change only specific fields and the client sends only those? → Use PATCH.
  5. Does the request remove a resource? → Use DELETE.
  6. Does the request perform a complex action (e.g., submit order, authenticate)? → Use POST with a descriptive endpoint like /orders/checkout.

When in doubt, ask: "Does this change state, and if so, how much of the resource does the client intend to alter?" If the answer is "partially," use PATCH; if "fully," use PUT; if "create," use POST. Avoid overloading POST for all changes—this makes APIs harder to reason about and breaks caching and idempotency guarantees.

Updating a User Profile

Consider a user profile resource at /users/789. The current state is:

{"id": 789, "name": "Taylor", "email": "taylor@example.com", "theme": "dark", "notifications": true}

You need to update only the theme to "light" and disable notifications. Using PATCH avoids resending the full object:

  1. Send PATCH /users/789 with body {"theme": "light", "notifications": false}.
  2. Server validates permissions and the new values.
  3. Server returns 200 OK with updated body: {"id": 789, "name": "Taylor", "email": "taylor@example.com", "theme": "light", "notifications": false}.

If instead you used PUT with only those two fields, the server might set name and email to null or omit them, causing data loss. With PATCH, the unchanged fields remain untouched. Similarly, if you were creating a new user, you’d use POST to /users and let the server assign ID 790—then a subsequent GET to /users/790 confirms the full state. This clarity reduces bugs and makes API behavior predictable under repeated calls.

Why This Matters in Practice

Correct verb usage ensures your API behaves predictably for other developers and tools. For example, a CDN or browser cache understands GET responses and serves them without hitting the origin server, improving latency. Idempotent operations like PUT and DELETE allow clients to retry failed requests safely—essential for unreliable networks. Misusing POST for all changes hides intent: a tool checking for safe operations (e.g., link prefetchers) might trigger unintended side effects. Standards-compliant verbs also simplify documentation and testing: tools like Postman or curl can auto-generate examples based on the method, and automated tests verify idempotency more easily. If your API returns 200 OK for a POST that should create a resource but doesn’t, clients can’t distinguish success from failure without parsing the body. Standard verbs carry semantic meaning: 201 Created after POST tells the client exactly what happened. Following these conventions means your API integrates smoothly with proxies, load balancers, and monitoring systems that rely on HTTP semantics.

What if a client sends malformed data?

Validate input before processing. Return 400 Bad Request with a JSON body explaining the error (e.g., {"error": "email is required"}), not a generic message.

Can PATCH create a resource?

Some servers allow it (idempotent creation), but it’s not standard. Clients should use POST for creation unless the API explicitly documents PATCH-based creation.

Is there a performance difference between PUT and PATCH?

PATCH can reduce bandwidth when updating small fields, but the server-side processing time is often similar. Use PATCH when partial updates matter for correctness, not just speed.

Do all endpoints support all verbs?

No. Sub-resources may restrict methods—for example, /users/123/posts might allow GET (list posts) and POST (add a post), but not PUT or DELETE on the collection itself. Always document supported methods per endpoint.