What is API Contract?

An API Contract is a formal, binding specification defining the endpoints, inputs, outputs, error conditions, and SLA guarantees agreed upon between API providers and consumers.

How it works

API contracts prevent breaking changes by guaranteeing payload shapes, status codes, and security requirements. OpenAPI specifications serve as formal executable API contracts.

Common mistakes

  • Introducing breaking changes without bumping major API version
  • Making schema fields non-optional without notice