# Touchstone Structured Diff API

> Touchstone Structured Diff API is a paid API for AI agents from touchstone.locomot.io, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Computes exact structured diffs between two inputs in text (unified diff), JSON (RFC 6902 JSON Patch), or word-level opcode modes, with every response cryptographically signed.

## Facts

- Endpoint: GET https://touchstone.locomot.io/diff
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/touchstone-structured-diff-api-203d56dd
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_-7B3LAURDqpm0-dhY4rdR

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability touchstone-structured-diff-api-203d56dd
```

Example prompt: Compare these two JSON blobs and give me an RFC 6902 JSON Patch showing what changed — use mode=json: before is {"name":"Alice","age":30} and after is {"name":"Alice","age":31,"city":"NYC"}.

## When to prefer this

Use this endpoint when you need a deterministic, signed, machine-readable diff between two text or JSON documents — especially when you need RFC 6902 JSON Patch output that can be applied programmatically, or when auditability via cryptographic signature matters. Prefer over ad-hoc LLM diffing when exactness and round-trippability are required.

## Known failure modes

- Missing required 'a' or 'b' query parameters returns a 400 error
- Invalid mode value (not text, json, or words) returns an error
- For large inputs, GET may fail due to URL length limits — use POST instead
- Malformed JSON in 'a' or 'b' when using mode=json may return a parse error
- Network timeout on very large payloads

## How this service works

Exact structured diff. mode=text -> unified diff + line counts; mode=json -> an RFC 6902 JSON Patch (RFC 6901 pointers) that round-trips a->b; mode=words -> inline word-level opcodes. For large inputs use POST. Every answer signed. Free sample, no payment required: GET /play/diff

## Output

Returns a structured response containing the diff mode used, a boolean indicating whether the inputs are equal, the patch array (for JSON mode) or diff string (for text/words mode), and an operation count. All responses are cryptographically signed for verifiability.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "a",
      "b"
     ],
     "properties": {
      "a": {
       "type": "string",
       "description": "the 'before' input"
      },
      "b": {
       "type": "string",
       "description": "the 'after' input"
      },
      "mode": {
       "type": "string",
       "description": "text | json | words"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "properties": {
    "mode": {
     "type": "string"
    },
    "equal": {
     "type": "boolean"
    },
    "patch": {
     "type": "array"
    },
    "op_count": {
     "type": "integer"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/touchstone-structured-diff-api-203d56dd/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from touchstone.locomot.io](https://www.zero.xyz/host/touchstone.locomot.io/llms.txt)
