{
 "openapi": "3.1.0",
 "info": {
  "title": "Shiftmoor website change monitor API",
  "version": "1.0.0",
  "description": "Check a public web page's text and what changed since the last check; manage watched pages, alerts webhook and change feeds. Free: 5 checks a day without a key, 20 with a free key; Pro: 500 a day. © 2026 CyberMax.",
  "contact": {
   "email": "cybermax.tools@gmail.com",
   "url": "https://shiftmoor.cybermaxtools.com/"
  }
 },
 "servers": [
  {
   "url": "https://shiftmoor.cybermaxtools.com"
  },
  {
   "url": "https://shiftmoor.cybermax-tools.workers.dev"
  }
 ],
 "components": {
  "securitySchemes": {
   "licence": {
    "type": "apiKey",
    "in": "header",
    "name": "x-licence"
   }
  },
  "schemas": {
   "Change": {
    "type": "object",
    "properties": {
     "text": {
      "type": "string",
      "example": "2 lines added, 1 removed"
     },
     "more": {
      "type": "string"
     },
     "detail": {
      "type": "object",
      "properties": {
       "added": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "removed": {
        "type": "array",
        "items": {
         "type": "string"
        }
       }
      }
     }
    }
   },
   "Watch": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "url": {
      "type": "string"
     },
     "label": {
      "type": [
       "string",
       "null"
      ]
     },
     "options": {
      "type": "object",
      "properties": {
       "keyword": {
        "type": "string"
       },
       "ignore_numbers": {
        "type": "boolean"
       }
      }
     },
     "added": {
      "type": "string"
     },
     "status": {
      "type": "string"
     },
     "last_checked": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "next_check": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "now": {
      "type": [
       "string",
       "null"
      ]
     },
     "last_change": {
      "type": [
       "string",
       "null"
      ],
      "format": "date-time"
     },
     "error": {
      "type": [
       "string",
       "null"
      ]
     }
    }
   }
  }
 },
 "paths": {
  "/api/check": {
   "get": {
    "operationId": "checkPage",
    "summary": "A page's text now and what changed since the last public check",
    "parameters": [
     {
      "in": "query",
      "name": "url",
      "required": true,
      "schema": {
       "type": "string",
       "format": "uri"
      }
     },
     {
      "in": "header",
      "name": "x-licence",
      "schema": {
       "type": "string"
      },
      "description": "Your Shiftmoor key (free key from POST /api/free, or the key from your purchase). ?key= also works."
     }
    ],
    "responses": {
     "200": {
      "description": "Checked",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "url": {
           "type": "string"
          },
          "checked_at": {
           "type": "string",
           "format": "date-time"
          },
          "found": {
           "type": "boolean"
          },
          "title": {
           "type": "string"
          },
          "lines": {
           "type": "integer"
          },
          "words": {
           "type": "integer"
          },
          "fingerprint": {
           "type": "string"
          },
          "preview": {
           "type": "array",
           "items": {
            "type": "string"
           }
          },
          "since_last_check": {
           "type": [
            "object",
            "null"
           ],
           "properties": {
            "at": {
             "type": "string"
            },
            "changed": {
             "type": "boolean"
            },
            "lines_added": {
             "type": "integer"
            },
            "lines_removed": {
             "type": "integer"
            },
            "added_lines": {
             "type": "array",
             "items": {
              "type": "string"
             }
            }
           }
          },
          "checks_left_today": {
           "type": "integer"
          }
         }
        }
       }
      }
     },
     "400": {
      "description": "Not a public http(s) address"
     },
     "401": {
      "description": "Invalid key"
     },
     "422": {
      "description": "Page unreachable or blocked by robots.txt"
     },
     "429": {
      "description": "Daily limit reached"
     }
    }
   }
  },
  "/api/free": {
   "post": {
    "operationId": "freeKey",
    "summary": "Create a free key (no email, no card; 3 pages, checked daily)",
    "responses": {
     "200": {
      "description": "Key",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "key": {
           "type": "string"
          },
          "tier": {
           "type": "string"
          },
          "limits": {
           "type": "object"
          }
         }
        }
       }
      }
     },
     "429": {
      "description": "3 free keys a day per network"
     }
    }
   }
  },
  "/api/watches": {
   "get": {
    "operationId": "listWatches",
    "summary": "Your plan, limits, feeds and watched pages",
    "security": [
     {
      "licence": []
     }
    ],
    "responses": {
     "200": {
      "description": "Watches",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "plan": {
           "type": "string"
          },
          "tier": {
           "type": "string"
          },
          "used": {
           "type": "integer"
          },
          "webhook": {
           "type": [
            "string",
            "null"
           ]
          },
          "feeds": {
           "type": "object",
           "properties": {
            "json": {
             "type": "string"
            },
            "rss": {
             "type": "string"
            }
           }
          },
          "watches": {
           "type": "array",
           "items": {
            "$ref": "#/components/schemas/Watch"
           }
          }
         }
        }
       }
      }
     }
    }
   },
   "post": {
    "operationId": "addWatch",
    "summary": "Watch a page (takes the first snapshot now)",
    "security": [
     {
      "licence": []
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "required": [
         "url"
        ],
        "properties": {
         "url": {
          "type": "string",
          "format": "uri"
         },
         "label": {
          "type": "string",
          "maxLength": 80
         },
         "keyword": {
          "type": "string",
          "maxLength": 60
         },
         "ignore_numbers": {
          "type": "boolean"
         }
        }
       }
      }
     }
    },
    "responses": {
     "201": {
      "description": "Added",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "ok": {
           "type": "boolean"
          },
          "watch": {
           "$ref": "#/components/schemas/Watch"
          },
          "baseline": {
           "type": "string"
          }
         }
        }
       }
      }
     },
     "402": {
      "description": "Plan limit reached"
     },
     "409": {
      "description": "Already watched"
     },
     "422": {
      "description": "Nothing to watch on that page"
     }
    }
   }
  },
  "/api/watches/{id}": {
   "delete": {
    "operationId": "removeWatch",
    "summary": "Stop watching a page",
    "security": [
     {
      "licence": []
     }
    ],
    "parameters": [
     {
      "in": "path",
      "name": "id",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Removed"
     },
     "404": {
      "description": "Not found"
     }
    }
   }
  },
  "/api/settings": {
   "post": {
    "operationId": "setWebhook",
    "summary": "Set or clear the alerts webhook (https)",
    "security": [
     {
      "licence": []
     }
    ],
    "requestBody": {
     "content": {
      "application/json": {
       "schema": {
        "type": "object",
        "properties": {
         "webhook": {
          "type": [
           "string",
           "null"
          ]
         }
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Saved"
     },
     "400": {
      "description": "Not an https webhook"
     }
    }
   }
  },
  "/feed.json": {
   "get": {
    "operationId": "changeFeedJson",
    "summary": "Your changes as JSON",
    "parameters": [
     {
      "in": "query",
      "name": "key",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "Changes"
     }
    }
   }
  },
  "/feed.rss": {
   "get": {
    "operationId": "changeFeedRss",
    "summary": "Your changes as RSS 2.0",
    "parameters": [
     {
      "in": "query",
      "name": "key",
      "required": true,
      "schema": {
       "type": "string"
      }
     }
    ],
    "responses": {
     "200": {
      "description": "RSS"
     }
    }
   }
  }
 },
 "x-webhook-body": {
  "description": "POSTed to your webhook on each change",
  "example": {
   "text": "Shiftmoor: Rival pricing — 2 lines added, 1 removed\nhttps://example.com/pricing",
   "content": "…",
   "product": "shiftmoor",
   "watch": {
    "id": "a1b2c3d4e5",
    "url": "https://example.com/pricing",
    "label": "Rival pricing"
   },
   "change": {
    "text": "2 lines added, 1 removed",
    "more": "+ Starter $24/month\n+ Up to 3 seats\n- Starter $19/month",
    "detail": {
     "added": [
      "Starter $24/month",
      "Up to 3 seats"
     ],
     "removed": [
      "Starter $19/month"
     ]
    }
   }
  }
 }
}
