Pcornel
Automation · APIs

API Versioning

Cheat sheet · https://pcornel.dk/topic.php?topic=5310

Back to the Topic

Answer

Evolution of an API contract across URI, header, media-type or provider-specific version selectors and lifecycle states.

Remember

  • Version number newer ≠ backward compatible; breaking changes can exist within policy boundaries.
  • Client library version ≠ API version automatically; SDK and service contracts can evolve independently.
  • Deprecated ≠ immediately unavailable; deprecation and removal dates are distinct lifecycle states.
  • Same endpoint ≠ same schema across versions; defaults, fields and error contracts may change.

First checks

  • curl -sS <api>/v2/items — versioned path
  • Version header (Accept: application/vnd.x.v2+json) — alternative
  • Deprecation/Sunset headers — lifecycle

Verify in this order

client pinned version → server version

Where it usually breaks

A version selector proves which contract was requested, not that the client is compatible with every behavior of that version.

Client payload/auth → HTTP transport → endpoint validation/policy → request accepted → queued/job execution → target mutation → effective state → consumer workload.

API Versioning API boundary map

BoundaryHealthy evidenceSuspicious evidence
Caller / requestEnvironment/version, identity and exact request contract are attributableHidden defaults, wrong endpoint/version, leaked or mismatched credentials
Server / responseStatus, headers, structured body and request ID are interpreted togetherStatus-only handling, ignored error body, ambiguous async result or unsafe retry
State / proofWrite result is reconciled with resource read-back or acceptance testResponse success treated as final target success without verification
TroubleshootingFirst failed boundary is preserved, changed minimally and retestedBlind retries, credential rotation, replay or payload edits before evidence is captured

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5310

Confirmation

Confirm action

Continue?