name: design-a-public-api-contract
description: Specify a versioned public API with resources, errors, compatibility, and usage policies. Use when the user needs a stable contract for an API consumed by clients outside the team.
domain: architecture-design
tags: [api-contract, versioning, compatibility]
triggers: ["public api contract", "design a versioned api", "api compatibility specification"]
Specify a versioned public API with resources, errors, compatibility, and usage policies
Purpose
Specify a versioned public API with resources, errors, compatibility, and usage policies.
When to use
Use when the user needs a stable contract for an API consumed by clients outside the team.
When NOT to use
Do not use this for a local implementation detail; use software-engineering instead.
Inputs required
- The functional and non-functional requirements
- The constraints on scale, budget and timeline
- The existing systems the design must fit
Procedure
- Define the public resources, operations, identifiers, and representation formats.
- Specify validation rules, error bodies, status codes, pagination, and idempotency behavior.
- Set authentication scopes, authorization checks, rate limits, and versioning expectations.
- Document compatibility guarantees and the deprecation process for removable changes.
- Create contract examples for successful and failed requests.
- State the assumptions, review owners, and change-control process for the contract.
Output contract
A design with components, interfaces, data flows, failure modes and a migration path.
Validation checklist
Safety notes
Never present a design as final without stating the assumptions it depends on.
Related skills
design-a-batch-processing-pipeline
design-a-caching-layer
design-a-data-model-for-a-feature
1---2name: design-a-public-api-contract3description: Specify a versioned public API with resources, errors, compatibility, and usage policies. Use when the user needs a stable contract for an API consumed by clien4---5---6name: design-a-public-api-contract7description: Specify a versioned public API with resources, errors, compatibility, and usage policies. Use when the user needs a stable contract for an API consumed by clients outside the team.8domain: architecture-design9tags: [api-contract, versioning, compatibility]10triggers: ["public api contract", "design a versioned api", "api compatibility specification"]11---1213# Specify a versioned public API with resources, errors, compatibility, and usage policies1415## Purpose1617Specify a versioned public API with resources, errors, compatibility, and usage policies.1819## When to use2021Use when the user needs a stable contract for an API consumed by clients outside the team.2223## When NOT to use2425Do not use this for a local implementation detail; use software-engineering instead.2627## Inputs required2829- The functional and non-functional requirements30- The constraints on scale, budget and timeline31- The existing systems the design must fit3233## Procedure34351. Define the public resources, operations, identifiers, and representation formats.362. Specify validation rules, error bodies, status codes, pagination, and idempotency behavior.373. Set authentication scopes, authorization checks, rate limits, and versioning expectations.384. Document compatibility guarantees and the deprecation process for removable changes.395. Create contract examples for successful and failed requests.406. State the assumptions, review owners, and change-control process for the contract.4142## Output contract4344A design with components, interfaces, data flows, failure modes and a migration path.4546## Validation checklist4748- [ ] Every requirement maps to a component49- [ ] Failure and rollback paths are described50- [ ] The trade-offs behind the choice are written down5152## Safety notes5354Never present a design as final without stating the assumptions it depends on.5556## Related skills5758- `design-a-batch-processing-pipeline`59- `design-a-caching-layer`60- `design-a-data-model-for-a-feature`