# Safe Upgrade Decision API – Document Comparison

> Safe Upgrade Decision API – Document Comparison is a paid API for AI agents from x402-safe-upgrade-api.onrender.com, paid per call via x402, $0.02/call, status unknown (last checked 2026-10-11).

Compares two text documents (e.g. changelogs, README files, package docs) and returns similarity metrics to support evidence-backed npm package upgrade decisions.

## Facts

- Endpoint: POST https://x402-safe-upgrade-api.onrender.com/v1/document-comparison?utm_source=zero.xyz
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/safe-upgrade-decision-api-document-comparison-3194fb71
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_2LwoYEqDhCfZMl5I8vLeb

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 safe-upgrade-decision-api-document-comparison-3194fb71 -d '<json body>'
```

Example prompt: Compare the old changelog text for lodash 4.17.20 with the new changelog for 4.17.21 and tell me how similar they are so I can decide if the upgrade is safe — here's the old text: [old changelog] and here's the new text: [new changelog].

## When to prefer this

Choose this endpoint when a coding agent or CI pipeline needs a fast, quantitative similarity signal between two document versions (changelogs, READMEs, release notes) to make an evidence-backed npm upgrade decision. It is especially useful when you want a lightweight numeric score rather than a full semantic diff or LLM-generated summary.

## Known failure modes

- Input text exceeds 200,000 character limit — request rejected
- Missing required fields (leftText or rightText) — validation error
- Service unavailable on Render cold start — timeout or 503
- Payment not included or insufficient — 402 Payment Required response
- Empty documents submitted — may return similarity of 1.0 or 0.0 unexpectedly

## How this service works

Evidence-backed npm package upgrade decisions for coding agents.

## Output

A JSON object containing a summary with at least a `lineSimilarity` score (0–1 float) indicating how similar the two input documents are. Higher scores mean the documents are more alike, suggesting lower upgrade risk.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "leftText": {
   "type": "string",
   "maxLength": 200000,
   "description": "Content supplied by the caller only; it is processed in memory and not retained."
  },
  "leftLabel": {
   "type": "string"
  },
  "rightText": {
   "type": "string",
   "maxLength": 200000,
   "description": "Content supplied by the caller only; it is processed in memory and not retained."
  },
  "rightLabel": {
   "type": "string"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "summary": {
   "lineSimilarity": 0.5
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/safe-upgrade-decision-api-document-comparison-3194fb71/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-safe-upgrade-api.onrender.com](https://www.zero.xyz/host/x402-safe-upgrade-api.onrender.com/llms.txt)
