# Document Redline & Table Diff Edge API (v1.0.0)

> Deterministic Myers redlines, numeric/date edit alerts, Word .docx Track Changes, and composite-key table diffs in milliseconds.

Deterministic two-level Myers O(ND) paragraph and word-level document diffing, automatic numeric/currency/percentage/duration/date change extraction, native OpenXML .docx Track Changes generation, and composite-key CSV/JSON table diffing.

## Why Agents Use This API Instead of DIY
Prevents middle-of-context LLM skimming misses on buried numeric/date edits, cuts 40-page document review payloads by 90-98% in tokens, and emits real OpenXML <w:ins>/<w:del> .docx archives without brittle Python/LibreOffice dependencies.

## Connection & Payment (x402 Default + Optional Bearer API Key)
- **MCP Server (Streamable HTTP):** `https://doc-redline.apikeg.com/mcp` (Registry ID: `com.apikeg/doc-redline` — `initialize`, `tools/list`, `resources/*`, and `prompts/*` are free)
- **OpenAPI 3.1 Spec:** [openapi.json](https://doc-redline.apikeg.com/openapi.json)
- **Full Schema & Examples:** [llms-full.txt](https://doc-redline.apikeg.com/llms-full.txt)
- **RFC 9727 API Catalog:** [.well-known/api-catalog](https://doc-redline.apikeg.com/.well-known/api-catalog)
- **x402 Bazaar Manifest:** [.well-known/x402.json](https://doc-redline.apikeg.com/.well-known/x402.json)
- **MCP Discovery Manifest:** [.well-known/mcp.json](https://doc-redline.apikeg.com/.well-known/mcp.json)
- **A2A Agent Card:** [.well-known/agent-card.json](https://doc-redline.apikeg.com/.well-known/agent-card.json)
- **Primary Payment (Zero Signup):** Cloudflare Monetization Gateway (`HTTP 402` / `x402` v2 with USDC on Base).
- **Optional Monthly API Key:** Pass `Authorization: Bearer ak_live_...` ($5 / $20 / $50 monthly per-product Stripe plans at [apikeg.com/account](https://apikeg.com/account)).
- **Free Preflight:** Append `?dry_run=true` (or header `X-Dry-Run: true`) to validate any request payload at `$0.00` cost.

## Tools & REST Endpoints
- [`diff_documents`](https://doc-redline.apikeg.com/tools/diff-documents.md) (`POST https://doc-redline.apikeg.com/v1/diff-documents`) — $0.002 USD per document redline comparison (x402 instant micropayment): Runs two-level Myers O(ND) section/paragraph and inline word-and-punctuation diffing across two document versions, returning sectionBreadcrumb-tagged hunks, CriticMarkup ({--old--}{++new++}), inline HTML (<del>/<ins>), dedicated numericAndDateChanges alerts, and optional native .docx Track Changes.
- [`diff_tables`](https://doc-redline.apikeg.com/tools/diff-tables.md) (`POST https://doc-redline.apikeg.com/v1/diff-tables`) — $0.002 USD per structured table or catalog diff (x402 instant micropayment): Compares two JSON object arrays or RFC 4180 CSV strings keyed by a single or composite primaryKey, returning exact summary counts, added rows, removed rows, and cell-level modified diffs with exact decimal numericDelta.

## Instant MCP Configuration
```json
{
  "mcpServers": {
    "doc-redline": {
      "type": "streamable-http",
      "url": "https://doc-redline.apikeg.com/mcp"
    }
  }
}
```

## Common Agent Use Cases
- deterministic document redline diff API MCP
- generate Word docx Track Changes w:ins w:del API
- compare two SOW RFP versions CriticMarkup HTML diff
- extract numeric currency duration date changes between documents
- diff two CSV or JSON catalogs by composite primary key
