webclaw

Diff

Track changes between two snapshots of a web page. Scrape a URL now, compare it against a previous extraction result, and get a unified diff of what changed.

POST/v1/diff

Compare a URL's current content against a previous extraction snapshot.

Request body

json
{
  "url": "https://example.com/pricing",
  "previous": {
    "metadata": {
      "url": "https://example.com/pricing",
      "title": "Pricing",
      "word_count": 5
    },
    "content": {
      "markdown": "# Pricing\n\nStarter: $9/mo\nPro: $29/mo",
      "plain_text": "Pricing Starter: $9/mo Pro: $29/mo",
      "links": [],
      "images": [],
      "code_blocks": []
    },
    "domain_data": null
  }
}
FieldTypeRequiredDescription
urlstringYesURL to scrape for the current version.
previousobjectNo*A previous ExtractionResult (the extraction field from a prior /v1/scrape call).
Tip
Request formats: ["json"] and save the extraction object from /v1/scrape as your baseline snapshot. Pass it as the previous field in subsequent diff requests. If omitted, the hosted API attempts to use your cached baseline; it returns 400 when no usable baseline exists.

Response

json
{
  "status": "Changed",
  "text_diff": "--- previous\n+++ current\n@@ -2,3 +2,3 @@\n-Starter: $9/mo\n-Pro: $29/mo\n+Starter: $12/mo\n+Pro: $39/mo\n+Enterprise: $99/mo",
  "metadata_changes": [
    {
      "field": "title",
      "old": "Old title",
      "new": "Pricing"
    }
  ],
  "links_added": [
    { "text": "Enterprise", "href": "https://example.com/enterprise" }
  ],
  "links_removed": [],
  "word_count_delta": 70
}
FieldTypeDescription
statusstring"Changed" or "Same".
text_diffstring | nullUnified diff of the text content, or null when unchanged.
metadata_changesarrayList of metadata fields that changed, with old and new values.
links_addedobject[]Link objects with text and href, added since the baseline.
links_removedobject[]Link objects with text and href, removed since the baseline.
word_count_deltanumberDifference in word count (positive = content added).

Example

curl (requires a cached baseline)
curl -X POST https://api.webclaw.io/v1/diff \
  -H "Authorization: Bearer wc_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/pricing"}'

Get started

Ready to build? Start extracting.

Cancel anytime. One key for every format and endpoint.

View on GitHub