Find unused, shadow and failing API endpoints from your logs
OpenAPI spec vs. real traffic. api-dead-ends reads the logs and metrics you already have and lists the endpoints that fail or spike, are undocumented (shadow), or are not called (zombie candidates).
npx api-dead-ends init
Version 0.4.0 · Node.js 20+ · MIT · GitHub · llms.txt
- Errors and spikes
- Spec drift
- Usage and coverage
- CI and logging
$ npx api-dead-ends report --usage usage.csv --spec openapi.json ▲ Recent spikes: 2 GET /products/search 4.3% 5xx, last 3 days (before: 0.1%) × Server errors: 2 (+3 below threshold) POST /promo/apply 5,751 × 5xx 23.4% DELETE /orders/{id} 345 × 5xx 7.7% ! Undocumented (called, not in spec): 3 GET /api/v1/products/{id}/reviews 34,507 calls POST /api/v1/orders/{id}/retry 1,251 calls ○ Not called in 30 days: 3 (a hint, not a verdict) POST /orders/{id}/repeat 0 calls GET /export/orders.csv 0 calls looks periodic ↓ Deprecated but still called: 2 GET /legacy/catalog 6,826 calls
In short
- What it does: puts your OpenAPI spec (or route list) next to real traffic and lists what fails, what changed, what is undocumented and what is not called.
- What it needs: Node.js 20+ and one query against the logs or metrics you already have. Only counts per method, path and status.
- Safe: local and read-only. It never changes your code and never sends your logs anywhere.
- No AI needed: numbers come from code, so the same input gives the same report. AI agents are optional.
- Honest: "not called" is a hint, not a verdict. A human decides.
What it finds
Twelve checks in four groups. Open any group for its example and the full list. Numbers are from the synthetic demo: 30 days, 4,210,931 requests, 26 documented operations.
Errors and spikes5xx, 4xx, spikes, what changed today
The share of 5xx for every endpoint, not one error rate for the whole API.
GET /products/search · 5xx share per day
- Server errors. POST /promo/apply: 5,751 of 24,541 calls end in 500.
- Client errors. PATCH /users/me: 854 of 5,951 calls answered 400.
- Recent spikes. GET /products/search: 4.3% 5xx in the last 3 days, 0.08% over the whole period.
- What changed today. On an hourly table: 5xx since which hour, peak req/s against the same hours before, and the masked error texts.
Spec driftundocumented, deprecated, noise
Endpoints that real clients call but your spec does not describe, and old ones that are still in use.
| Endpoint | Calls | First seen |
|---|---|---|
| GET /api/v1/products/{id}/reviews | 34,507 | Oct 26 |
| POST /api/v1/orders/{id}/retry | 1,251 | Oct 26 |
| GET /api/v2/products | 520 | Nov 16 |
- Undocumented (shadow). Called in production, missing from the spec. Customer words in paths are folded into
{word}. - Deprecated, still called. GET /legacy/catalog: 6,826 calls in 30 days.
- Noise kept apart. Preflight requests, scanners and typos never pass for real endpoints.
Usage and coveragenot called, E2E gaps, duplicates
What nobody called in the window, and what your end-to-end tests never reached.
| Endpoint | Calls | Note |
|---|---|---|
| POST /orders/{id}/repeat | 0 | |
| GET /export/orders.csv | 0 | looks periodic |
| GET /admin/stats | 0 |
- Not called (zombie candidates). A hint, not a verdict: check monthly jobs, partners, old app versions and unlogged traffic.
- E2E coverage gaps. New in 0.4.0
report --e2eafter your staging suite. Covered means a response other than 401, 403 or 404. - Duplicate requests.
probefinds the same API call sent several times per page load.
CI and loggingbaseline gate, log coverage
Fail the build only on what is new, and find endpoints your logs do not see.
npx api-dead-ends report --usage usage.csv --spec openapi.json \ --write-baseline baseline.json # once npx api-dead-ends report --usage usage.csv --spec openapi.json \ --baseline baseline.json --fail-on new-shadow,deprecated-growth # exit 0 ok · 1 check failed · 2 bad input
- CI gate. Fails on a new undocumented endpoint or growing deprecated use. Never on "not called".
- Log coverage gaps.
coverage,logging-checkandlogging-probefind what the ingress sees but your app logs miss.
Demo numbers are synthetic (examples/ in the repo).
How it runs
Three steps. Nothing is installed in your app.
npx api-dead-ends initscans your repo and writes the exact commands for each service.- Run one query against your logs or metrics, with your own access. You get a usage table.
npx api-dead-ends report --usage usage.csv --spec openapi.yamlwrites report.md, report.html and report.json.
| Endpoint | Calls | Finding |
|---|---|---|
| GET /products | 1,116,763 | Healthy |
| POST /promo/apply | 24,541 | Server errors |
| PATCH /users/me | 5,951 | Client errors |
| GET /api/v1/products/{id}/reviews | 34,507 | Undocumented |
| GET /legacy/catalog | 6,826 | Deprecated, called |
| POST /orders/{id}/repeat | 0 | Not called (hint) |
Why not just Datadog, Sentry or an AI?
- Spec vs. reality. Monitoring shows what is called; it does not know what your spec promises. api-dead-ends puts both side by side.
- Numbers from code, not from a model. Same input, same report. AI is optional, on top.
- CI fails only on what is new. A new undocumented endpoint or growing use of a deprecated one. Never on "not called".
Your log source
Verified on real production data: Elasticsearch, Kibana and OpenSearch; VictoriaLogs with Kong gateway JSON access logs and a Rails route list as the spec. The others are built from vendor docs; feedback welcome.
VictoriaLogs verified
npx api-dead-ends fetch victorialogs --url http://localhost:9428 \ --service gateway --days 30 --daily -o usage.csv npx api-dead-ends report --usage usage.csv --spec openapi.yaml --out report/
Elasticsearch, Kibana, OpenSearch verified
Only a browser login to Kibana? A browser opens, you log in, and the read-only aggregation runs through your session (needs Playwright).
npx api-dead-ends fetch kibana --url "<Discover URL>" \ --service my-api --daily -o usage.csv npx api-dead-ends report --usage usage.csv --spec openapi.yaml --out report/
Datadog APM from vendor docs
Trace metrics keep about 15 months: the best source for "not called". It prints the query; you run it with your keys.
npx api-dead-ends query datadog-apm npx api-dead-ends convert datadog-apm datadog-apm.json -o usage.csv npx api-dead-ends report --usage usage.csv --spec openapi.yaml --out report/
Prometheus, Thanos, Mimir, VictoriaMetrics from vendor docs
npx api-dead-ends query prometheus --preset generic npx api-dead-ends convert prometheus prometheus.json \ --method-field method --path-field route --status-field status -o usage.csv npx api-dead-ends report --usage usage.csv --spec openapi.yaml --out report/
Grafana Loki from vendor docs
npx api-dead-ends query loki npx api-dead-ends convert loki loki.json \ --method-field method --path-field path --status-field status -o usage.csv npx api-dead-ends report --usage usage.csv --spec openapi.yaml --days 15 --out report/
CloudWatch Logs Insights from vendor docs
npx api-dead-ends query cloudwatch npx api-dead-ends convert cloudwatch cloudwatch.json \ --method-field httpMethod --path-field path --status-field status -o usage.csv npx api-dead-ends report --usage usage.csv --spec openapi.yaml --out report/
nginx or Apache access logs files on disk
npx api-dead-ends convert accesslog /var/log/nginx/access.log* --daily -o usage.csv npx api-dead-ends report --usage usage.csv --spec openapi.yaml --out report/
Any CSV, and the rest App Insights, Athena, BigQuery, New Relic, Dynatrace, Splunk
npx api-dead-ends convert csv export.csv \
--map method=method,path=route,status=status,day=day --daily -o usage.csv
npx api-dead-ends query <name> # for the othersNo OpenAPI spec? bin/rails routes | npx api-dead-ends spec from-routes - -o openapi.json builds one from your route list. All sources: docs/SOURCES.md.
For AI agents
Agents read the same local results, wrapped as data, never as instructions. Short docs for language models are in llms.txt (on GitHub: github.com/talikbaku/api-dead-ends/blob/main/llms.txt).
Rules the agent follows
- "Not called" is never proof that an endpoint is dead. State the window and confidence; recommend, never delete.
- Never paste raw logs, bodies, tokens or customer data.
- Humans run queries against production. Never send non-GET requests there.
agent → analyze_usage { "usage": "usage.csv", "spec": "openapi.json" } ade → { "schema": "api-dead-ends/analyze_usage@2", "untrusted": true, "data": { "serverErrors": [ { "method": "POST", "path": "/promo/apply", "calls": 24541, "errors5xx": 5751 } ] } } agent → "POST /promo/apply fails 23% of the time. Want the daily numbers?"
Any MCP client, one line of config:
{ "mcpServers": { "ade": { "command": "npx",
"args": ["-y", "api-dead-ends@0.4.0", "mcp"] } } }Claude Code plugin:
/plugin marketplace add talikbaku/api-dead-ends /plugin install api-dead-ends@api-dead-ends-marketplace
Keep the version pinned. Also in the MCP Registry as io.github.talikbaku/api-dead-ends. Details: docs/MCP.md.
Setup for a specific assistant (10 more)
Claude Code, MCP only
In every project.
claude mcp add --scope user ade -- npx -y api-dead-ends@0.4.0 mcp
Claude Desktop
Settings, Developer, Edit Config: claude_desktop_config.json, then restart.
{ "mcpServers": { "ade": { "command": "npx",
"args": ["-y", "api-dead-ends@0.4.0", "mcp"] } } }Cursor
~/.cursor/mcp.json for all projects, or .cursor/mcp.json for one.
{ "mcpServers": { "ade": { "command": "npx",
"args": ["-y", "api-dead-ends@0.4.0", "mcp"] } } }VS Code
.vscode/mcp.json in your project. The key is servers.
{ "servers": { "ade": { "type": "stdio", "command": "npx",
"args": ["-y", "api-dead-ends@0.4.0", "mcp"] } } }Windsurf
~/.codeium/windsurf/mcp_config.json
{ "mcpServers": { "ade": { "command": "npx",
"args": ["-y", "api-dead-ends@0.4.0", "mcp"] } } }Codex CLI
~/.codex/config.toml
[mcp_servers.ade] command = "npx" args = ["-y", "api-dead-ends@0.4.0", "mcp"]
Gemini CLI
~/.gemini/settings.json for all projects, or .gemini/settings.json for one.
{ "mcpServers": { "ade": { "command": "npx",
"args": ["-y", "api-dead-ends@0.4.0", "mcp"] } } }Zed
Zed settings.json.
{ "context_servers": { "ade": { "command": "npx",
"args": ["-y", "api-dead-ends@0.4.0", "mcp"] } } }UTCP
No server needed: a UTCP manual with the read-only tools. Needs utcp-cli 1.1.3 or newer.
npx -y api-dead-ends@0.4.0 utcp
Any other chat
Paste prompts/any-ai.md with your report.json. It runs locally, so remote-only chat apps cannot start it.
https://github.com/talikbaku/api-dead-ends/blob/main/prompts/any-ai.md
FAQ
How do I find unused API endpoints?
Export request counts per method, path and status from your logs or metrics, then run npx api-dead-ends report --usage usage.csv --spec openapi.yaml. Operations from the spec with no calls in the window are listed as "not called", with the window length and a confidence level. It is a hint, not a verdict.
How do I detect shadow APIs from logs?
The same report lists every endpoint that real traffic calls but your spec does not describe, as "undocumented". In CI, --fail-on new-shadow fails the build when a new one appears.
Is it safe to delete an endpoint that is not called?
Not on that alone. The endpoint may be used monthly, by a partner or an old app version, or its traffic may not be logged. api-dead-ends recommends; a human decides.
Does it need AI?
No. The numbers come from code: same input, same report. The MCP server and the Claude Code plugin are optional, for help reading the results.
Does it send my logs anywhere?
No. It runs locally and reads only aggregated counts: method, templated path, status and calls. It prints queries for you to run; the commands that touch the network (fetch, probe, logging-probe) are ones you start yourself.
Can I use it without an OpenAPI spec?
Yes. Build a spec from your framework's route list with spec from-routes (Rails, Flask, Django, Spring, Gin, Echo, Laravel, Express), or spec from-next for Next.js.
Which logs and metrics does it support?
Verified on Elasticsearch, Kibana, OpenSearch and VictoriaLogs. Built from vendor docs: Datadog, Prometheus and compatible stores, Loki, App Insights, CloudWatch, Athena, BigQuery, New Relic, Dynatrace, Splunk, nginx and Apache access logs, and any CSV.
How long a traffic window do I need?
For "not called", confidence is low under 35 days, medium under 90 and high from 90 days. APM metrics often keep months; logs often keep 7 to 30 days.
Is it free?
Yes. It is open source under the MIT licence, with zero dependencies.
Start with one command
init scans your repo, asks a few questions (Enter accepts the default) and writes the next steps for each service. It never changes your code.
npx api-dead-ends init
One-time, by card, Apple Pay or Google Pay. Processed by Stripe.
Or globally: npm install -g api-dead-ends · npm · GitHub · try the demo