← All Articles 🔬 Product Features High By Nishant Kumar Verma

Avoid Breaking API Changes: Find Every Caller First

Avoid breaking API changes: find every caller of an endpoint, including proxies, path variables and other repos, diff the spec in CI, then change it safely.

Quick Answer

To avoid breaking API changes, list every request that calls an endpoint before you rename, remove or reshape it: in the frontend, in other services, behind proxies and in your other repositories. Code search misses many of them, because the path is built from variables and proxies rewrite it. Then change it without breaking anyone: add the new shape next to the old one, move the callers, and remove the old one only when no caller is left.

What Counts as a Breaking API Change

A change is breaking when a caller that worked yesterday fails today without changing its own code. The usual ones:

  • Renaming or moving the path: /orders becomes /v2/orders.
  • Changing the method: a GET that becomes a POST.
  • Removing or renaming a response field: total becomes amount.
  • Making a request field required, or changing its type.
  • Changing status codes or error shapes the caller checks.

Adding an optional field, or a new endpoint, is usually safe.

Why Code Search Misses Callers

The obvious first step is to search the code for the path. It finds the easy callers and misses the rest:

  • Variables in the path: the route is /orders/:id, the caller writes `/orders/${orderId}`.
  • Base URLs from env vars: the host and prefix are not in the code at all.
  • Proxy prefixes: the frontend calls /api/orders, a proxy strips /api, and the backend route is /orders.
  • Other repositories: a second app or service calls the same endpoint.
  • Callers outside your code: mobile apps already installed, partners and webhooks. No code search will find those.

A Vite dev proxy shows the prefix problem in a few lines:

// vite.config.ts
import { defineConfig } from 'vite';

export default defineConfig({
  server: {
    proxy: {
      '/api': {
        target: 'http://localhost:8080',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },
    },
  },
});

Here the frontend's fetch('/api/orders') reaches the backend's /orders. Reading the frontend, you look for an /api/orders route that does not exist. Reading the backend, nothing points back to the frontend, because the link lives in the proxy config.

How to Find Every Caller

  1. Search each form of the path: the literal, the template string with variables, and the path with each proxy prefix.
  2. Read the proxy and rewrite configs: Vite, Next.js rewrites, nginx, your hosting provider's rewrites.
  3. Search the other repositories that talk to this backend.
  4. Check the access logs for the endpoint: they show callers no code search can, such as old mobile app versions.
  5. Write the list down with file and line for each caller in your code, so the change and its review can check it.

How to Detect Breaking API Changes in CI

If you publish an OpenAPI spec, diff it on every pull request. An open-source tool such as oasdiff compares the old and the new spec and reports breaking changes. It only knows what the spec describes: it tells you that a change breaks callers, not which callers in your code, and it misses routes and fields the spec leaves out. Use it next to the caller list, not instead of it.

How to Change It Without Breaking Callers

// Breaks every caller that still reads `total`
return Response.json({ amount: order.total });

// Safe step: send both while callers move over
return Response.json({ amount: order.total, total: order.total });
  1. Expand: add the new path or field next to the old one.
  2. Move the callers on your list to the new shape, one by one.
  3. Watch the old one: count calls to the old path. The server cannot see which clients read a response field, so for a field, rely on your caller list and on which app versions are still in use.
  4. Contract: remove the old one once the list is empty and the logs are quiet.

For endpoints other people call, version them instead, and give callers a date. This is the rename AI coding agents get wrong most easily: see why AI agents break your frontend when they change an API.

How Vibe X-Ray Finds the Callers

VibeDoctor Vibe X-Ray links each request in your code to the route that answers it, after every manual and push scan. Our guide to mapping frontend API calls to backend endpoints covers how that map is read.

  • HTTP Requests tab: search for the endpoint's path. Each row shows the function and file:line that sends the request and the route that answers it, including requests that pass a proxy.
  • Blast Radius: select the route's handler, and the callers it lists include the code whose requests it answers, not only the functions that call it directly.
  • Vibe Story: each area that sends or answers requests has an HTTP tab, listing its endpoints with the requests that call them, or "No caller found in this repo".
  • Your other projects: open the frontend project's HTTP Requests tab. Its requests to this backend are matched by the backend's website address, or by a link you add in Settings.

"No caller found in this repo" does not mean safe to delete: the endpoint may be called from outside, so check the logs too. During the Free Week and on paid plans you see every request and search match, and Blast Radius crosses requests. After the Free Week, Free accounts see the first few requests and search matches and one area of Vibe Story, and Blast Radius stays inside the code.

To try VibeDoctor from Claude Code or Codex, paste this into the agent:

connect to vibedoctor using https://vibedoctor.io/mcp/start

Not a developer? Connect your GitHub repository on vibedoctor.io for a free scan.

FAQ

What is a breaking API change?

Any change that makes a caller fail without that caller changing its own code: a renamed path or field, a new required field, a different method or a changed type.

How do I find all usages of an API endpoint?

Search every form of the path, including variables and proxy prefixes, in every repository that calls the backend, and check the access logs for callers outside your code. A request map from the code does the code part for you.

How do I detect breaking API changes before they ship?

Diff your OpenAPI spec on every pull request, run contract tests on the fields your frontend reads, and check the list of callers for each endpoint you change. The spec diff says a change breaks callers; the caller list says which ones.

Is it safe to delete an endpoint with no callers in the code?

Not on that alone. Installed mobile apps, partners, webhooks and scripts can call it from outside. Check the logs for a while before you remove it.

Should I version my API instead?

For endpoints other teams or customers call, yes. For endpoints only your own frontend calls, expanding and then contracting is usually simpler than running two versions.

Diagnose your codebase - free

VibeDoctor checks for and 148 other issues across 21 diagnostic areas - security, performance, code quality, and more.

SCAN MY APP →