Describe the operation first

Choose the action a caller needs to perform: submit a request, assign an owner, or cancel a reservation. Identify the required information and the conditions under which the action is allowed.

Explain the result in terms the caller can use. A response may need to distinguish immediate completion from accepted background work. Return a stable reference when the caller will need to check progress or ask support about the operation later.

Define failure behavior

List invalid inputs, permission failures, conflicts with current state, and unavailable dependencies. Make the distinction understandable so callers know which failures can be corrected and which may justify waiting or retrying.

Specify the behavior of repeated requests when the operation has side effects. An API consumer should not have to guess whether a timeout permits a safe retry. Include representative request and response examples in the contract.

Keep implementation freedom

Expose concepts that are meaningful to consumers rather than details that exist only because of the current storage model. A schema change inside the application should not unnecessarily require every integration to change at the same time.

Review the contract with someone implementing a caller. Ask them to complete a realistic workflow using only the documentation and examples. Their questions reveal gaps that the server team may overlook because it already knows the implementation.

Version and communicate changes that affect behavior, not just field names. A field retaining its name while changing its meaning can be more disruptive than a clearly announced addition to the interface.

Illustrative scenario

A practical example.

An approval API should express more than “set status to approved.” The operation may require an eligible reviewer, the current version of a request, and a recorded reason. Define those business preconditions before deciding the shape of the endpoint.

Write examples for success, an unauthorized caller, a changed request, and an already completed approval. Consumers need to distinguish conditions they can correct from failures they should retry. Include identifiers that make support conversations precise without exposing sensitive record contents. Finally, test the contract from a consumer’s perspective: can a client discover the current state, perform the action, and understand its result without depending on undocumented implementation details?

Put it into practice.

  • Describe operations in terms of business rules and observable outcomes.
  • Specify errors and concurrent-change behavior alongside successful responses.
  • Keep examples versioned with the contract so consumers can detect meaningful changes.

Working through a similar decision?

Tell us about your project