← Back to Chapters

HTTP Status Code 226 – IM Used

? HTTP Status Code 226 – IM Used

? Quick Overview

226 IM Used is an HTTP success status code indicating that the server has fulfilled a request using instance manipulations. It is mainly associated with Delta Encoding, where the response represents a modification of a previously retrieved resource.

? Key Concepts

  • Part of the 2xx Success status code family
  • Used with Delta Encoding (RFC 3229)
  • Response contains a delta, not the full resource
  • Optimizes bandwidth for large resources

? Syntax / Theory

When a client supports delta encoding, it may request only the changes since a previous version of a resource. If the server responds with status code 226, it means:

  • The response body is a set of changes
  • The client must apply these changes to its cached version
  • The final reconstructed resource is equivalent to a full 200 OK response

? Code Example(s)

? View Code Example
// Node.js example sending HTTP 226 IM Used response
const http = require("http");

http.createServer((req, res) => {
  res.writeHead(226, {
    "Content-Type": "text/plain",
    "IM": "vcdiff"
  });
  res.end("Delta changes applied to cached resource");
}).listen(3000);

? Live Output / Explanation

Response Behavior

The client receives a 226 IM Used status along with delta data. The client applies this delta to the cached resource to reconstruct the latest version efficiently.

? Interactive Example

Simulate how a "Delta" response updates a cached file.

3. Final Reconstructed Resource:

 

Status: 226 IM Used. The delta was successfully merged with the cache.

? Use Cases

  • Large document synchronization
  • Version-controlled APIs
  • Efficient patch-based updates
  • Low-bandwidth network environments

? Tips & Best Practices

  • Use only when both client and server support delta encoding
  • Always validate cached resource versions
  • Fallback to 200 OK if delta cannot be applied
  • Clearly document API behavior for clients

? Try It Yourself

  • Create a server that responds with 226 for cached requests
  • Simulate delta updates in JavaScript
  • Compare payload sizes between 200 and 226 responses
  • Explore RFC 3229 for deeper understanding