# What is API drift?

Source: https://rimfe.com/learn/api-drift
Updated: October 30, 2026

API drift is documentation drift for an interface: the reference, spec or SDK docs no longer match what the endpoints, parameters, fields and errors do. It is common when code changes first and docs second, and it is costly because integrators build against what the docs promised.

## Typical causes

- A response field renamed or removed in a handler, not in the spec.
- A default, limit or pagination size changed in code only.
- A new required parameter that the reference marks optional.
- An enum value added with no page listing it.
- An auth rule tightened without a note in the guide.

## Code-first and spec-first

Code-first teams generate or hand-write the spec from handlers, so drift appears between code and spec, and between spec and prose guides. Spec-first teams edit the spec first, which makes the spec the contract, but the guides that quote it can still lag. Both need a check at review.

## Detecting it

Compare the spec before and after the change, not just the changed lines: operations, parameters, responses, enum values, defaults and required flags. Then look in the reference and the guides for pages that mention each changed item. A removed operation that a page still describes is a conflict; an added one that no page mentions is a gap.

## Keeping it out

- Map code folders and spec files to the reference pages that describe them.
- Review spec changes as public contract changes.
- List the public options and routes so coverage can be counted.
- Check the reference on every pull request, not at release time.

## A small example

A handler starts returning `created_at` instead of `created`, and the OpenAPI file is updated in the same pull request. The reference page regenerates and looks right. A guide on webhooks, written by hand months earlier, still shows `created` in its sample payload. Integrators copy that sample. Nothing failed in CI, because the guide is prose. Comparing the spec change with every page that mentions the old field name is what surfaces it.

## Related

- [OpenAPI](https://rimfe.com/stacks/openapi)
- [GraphQL](https://rimfe.com/stacks/graphql)
- [API and SDK teams](https://rimfe.com/use-cases/api-and-sdk-teams)
- [Keep API docs updated when code changes](https://rimfe.com/guides/keep-api-docs-updated-when-code-changes)
- [ReadMe](https://rimfe.com/docs-frameworks/readme)
- [Rimfe for Sphinx and reStructuredText docs](https://rimfe.com/docs-frameworks/sphinx)
- [Rimfe vs ReadMe](https://rimfe.com/compare/readme)
