Save a snapshot of an HTTP API's response structure, then check if the structure ever changes.
Ignores value changes — only flags when keys are added, removed, or change type. Snapshots are stored as plain JSON files you can commit to git, so your whole team gets alerted when an upstream API breaks.
Existing tools compare two live endpoints simultaneously (like api-diff) or require a cloud account.
http-snap is different:
- Save once → check anytime later
- Structural-only diff: ignores value changes, only catches schema breakage
- Git-friendly: snapshots live in
.http-snaps/→ commit them - CI-ready:
--strictexits 1 on any structural change - Zero dependencies: pure Node.js built-ins
npm install -g http-snapOr run without installing:
npx http-snap save my-api https://api.example.com/endpoint# Save a snapshot
http-snap save <name> <url>
# Check for structural changes
http-snap check <name> <url>
# List all saved snapshots
http-snap list
# Show a saved snapshot's structure
http-snap show <name># Save the shape of a GitHub user response
http-snap save github-user https://api.github.com/users/octocat
# Check it a week later
http-snap check github-user https://api.github.com/users/octocat
# Compare staging vs saved production snapshot
http-snap check prod-users https://staging.myapp.com/api/users/1
# With auth header
http-snap save orders https://api.myapp.com/orders/1 --header "Authorization: Bearer $TOKEN"
# CI mode — fail the pipeline if structure changed
http-snap check prod-users https://api.myapp.com/users/1 --strictNo changes:
http-snap — Structural diff for "github-user"
Snapshot: https://api.github.com/users/octocat (saved 2026-05-20T10:00:00Z)
Current: https://api.github.com/users/octocat
✓ No structural changes detected.
Changes detected:
http-snap — Structural diff for "prod-users"
⚠ 3 structural change(s) found:
+ .data.subscription → {"plan":"string","expiresAt":"string"}
- .data.legacyPlan was "string"
~ .data.role string → number
# .github/workflows/api-monitor.yml
name: API Snapshot Check
on:
schedule:
- cron: '0 9 * * 1-5' # every weekday morning
push:
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npx http-snap check prod-api https://api.myapp.com/health --strictCommit your .http-snaps/ folder. When the API changes, the CI job fails.
- Fetch the URL and parse the JSON response
- Extract shape: recursively walk the JSON, replacing all values with their type (
"string","number","boolean","null", or nested shape) - Save/compare the shape as JSON in
.http-snaps/<name>.json - Diff: find keys added, removed, or changed type — ignore value changes
Array items: the shape of the first element is used as representative.
Nesting depth is capped at 8 levels to keep snapshots readable.
Snapshots are stored in .http-snaps/ relative to where you run the command.
.http-snaps/
github-user.json
prod-api.json
staging-orders.json
Each file looks like:
{
"name": "github-user",
"url": "https://api.github.com/users/octocat",
"status": 200,
"savedAt": "2026-05-20T10:00:00.000Z",
"shape": {
"login": "string",
"id": "number",
"avatar_url": "string",
"public_repos": "number"
}
}MIT
api snapshot · response schema · contract testing · api structure diff · schema snapshot · api regression · json shape · api monitoring · zero dependencies · cli
Built to solve, shared to help — Rushabh Shah 🛠️✨
One of 40+ zero-dependency developer CLI tools — no node_modules, ever.