Quick revision
The short answer
The guideline covers naming and URL conventions, one error format (problem details), pagination, versioning, idempotency, date and money formats and security headers. Adoption comes from tooling, not the document: an OpenAPI linter in CI, shared Spring starters that implement the rules, and a fast review for cross-team APIs. We apply it to new and changed endpoints only, and we watch lint results and waivers to fix rules that do not work.
What to remember
In this answer, we treated an API guideline as a way to cut the cost every consumer pays for inconsistency. It covers naming, errors with problem details, pagination, versioning, idempotency, dates and money, and security headers. We made it real with a linter in CI and a shared starter, applied it to new and changed endpoints instead of forcing rewrites, ran fast and published API reviews for cross-team APIs, and used lint results and waivers to measure adoption and improve the rules.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
The guideline covers naming and URL conventions, one error format (problem details), pagination, versioning, idempotency, date and money formats and security headers. Adoption comes from tooling, not the document: an OpenAPI linter in CI, shared Spring starters that implement the rules, and a fast review for cross-team APIs. We apply it to new and changed endpoints only, and we watch lint results and waivers to fix rules that do not work.
Why this question is asked
When forty teams each invent their own error format and pagination, every consumer writes forty adapters, and every bug report starts with working out which convention a given API follows. Interviewers ask this leadership question to see whether a candidate can raise consistency across an organisation without becoming the department that slows everyone down. In this answer, we will see what belongs in the guideline and why, how to turn it into tools, how to roll it out without forced rewrites, how API review should work, and how to measure whether it is working.
1What Inconsistency Really Costs
Before writing rules, it helps to be clear about the problem we are solving. A consumer of three internal APIs today might parse errors in three shapes, page with page and size in one API, offset and limit in another and a cursor in the third, and see dates as epoch milliseconds, ISO strings and local times without zones. Each difference is small, but each one costs every consumer team time, and some of them cause real bugs, such as a timestamp read in the wrong zone or money rounded through a double.
So the goal of a guideline is not beauty. It is that a developer who has used one company API can use the next one without reading a new manual, and that shared libraries can handle the common parts once.
2What the Guideline Contains
A good guideline is short and concrete, and each rule comes with an example. It covers the areas where differences hurt consumers most.
| Area | Rule of thumb |
|---|---|
| Naming and URLs | plural nouns, kebab-case paths, camelCase JSON fields |
| Errors | RFC 9457 problem details with a stable type URI per error |
| Pagination | cursor for large collections, fixed parameter names |
| Versioning | additive changes by default, explicit rules for breaking ones |
| Idempotency | Idempotency-Key on state-changing POSTs that clients retry |
| Dates and money | ISO 8601 with offset; decimal string plus ISO 4217 currency |
| Security headers | auth scheme, no secrets in URLs, cache rules for private data |
Notice that every row is something a consumer can feel. Problem details, standardised in RFC 9457, gives each error a type, title, status and detail, and Spring supports it directly with ProblemDetail and spring.mvc.problemdetails.enabled. Money as a decimal string with a currency avoids floating-point rounding. We leave out matters of taste that do not affect consumers, because every extra rule costs adoption.
3Tooling Instead of a Document
A guideline that lives only in a wiki is read once and forgotten. The rules that matter should be checked by machines and implemented by shared code. For checking, we write the rules as an OpenAPI linter ruleset, for example with Spectral, and run it in every service's CI against the spec the service publishes. For implementing, we give teams a Spring Boot starter that provides the standard error handler, a page response type and the idempotency filter, so following the guideline is less work than not following it.
The CI step reports violations on the pull request, so a developer learns a rule at the moment it matters, not in a review meeting weeks later. Severity is a lever: new rules start as warnings and become errors once teams have had time to adjust.
4Rolling It Out Without Blocking Delivery
The most important adoption decision is scope. The guideline applies to new APIs and to endpoints being changed anyway. Stable APIs that work are left alone; rewriting them would cost months of migration for every consumer and deliver nothing users notice. The linter supports this by checking only new or changed operations, or by recording a baseline of existing violations that is allowed to shrink but not grow.
For APIs that cross team boundaries or face the public, we add an API review: a short design review of the OpenAPI spec before implementation. It only helps if it is fast, so we commit to a turnaround such as two working days, keep reviewers from several teams rather than one gatekeeper, and publish every decision so the next team can find the precedent instead of asking again.
- Team writes or changes the OpenAPI specstarter gives errors and paging for free
- Linter runs in CIonly new or changed operations
- Public or cross-team API?YesAPI review within two daysNoMerge when lint passes
- Decision publishedreused as precedent
4 steps in order. Play them, or step through them one at a time.
5Measuring Adoption and Learning From Waivers
We track adoption with the data the tools already produce: the share of services whose specs pass the lint, the number of open baseline violations, and how many services use the starter. These numbers tell us where to help, not whom to blame.
Waivers are the other signal. Every exception is recorded with a reason. If several teams keep waiving the same rule, the rule is probably wrong or too strict for real cases, and we revise it. A guideline that changes in response to evidence keeps the trust of the teams that must follow it.
6Follow-up questions
How do you handle a team that needs an exception to the guideline?
We make exceptions cheap to request and visible. The team records the rule, the reason and the scope in a waiver, ideally next to the spec, and the review group answers quickly. Reasonable exceptions, such as a legacy partner format that cannot change, are granted with an expiry or a review date. If the same exception keeps coming up, we change the guideline instead of granting it forever.
Who should own the guideline?
A small group of senior engineers drawn from several teams, with one named maintainer, rather than a separate architecture team that does not ship APIs. People who build APIs every week write rules that are practical, and their teams trust them more.
Why problem details rather than a custom error format?
It is a published standard, so clients, gateways and frameworks already understand it, and Spring has built-in support. A custom format means writing and documenting everything ourselves for no consumer benefit.
7Conclusion
In this answer, we treated an API guideline as a way to cut the cost every consumer pays for inconsistency. It covers naming, errors with problem details, pagination, versioning, idempotency, dates and money, and security headers. We made it real with a linter in CI and a shared starter, applied it to new and changed endpoints instead of forcing rewrites, ran fast and published API reviews for cross-team APIs, and used lint results and waivers to measure adoption and improve the rules.
Open with
I would write a short guideline that covers the things consumers actually feel: resource naming and URL conventions, one error format based on RFC 9457 problem details, one pagination model with fixed parameter names, versioning and what counts as a breaking change, idempotency keys for retried POSTs, ISO 8601 dates with offsets, money as a decimal string with a currency code, and basic security rules.
Then, if they want more
But the document is the smallest part. I would turn the rules into a Spectral ruleset that runs on every service's OpenAPI spec in CI, and ship a Spring Boot starter with the standard error handler, page type and idempotency support, so following the rules is the easy path.
To avoid blocking delivery, the rules apply to new and changed endpoints only; stable APIs are not rewritten, and the linter uses a baseline that can only shrink. Public and cross-team APIs get a design review with a two-day turnaround and published decisions.
Then I would measure adoption through lint results and starter usage, and treat repeated waivers of a rule as evidence that the rule needs to change.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- Spring Framework reference, Spring Web MVC
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "You lead API standards for 40 teams whose REST APIs differ in naming, error formats and...": https://scrivio-interview-library.netlify.app/spring-boot/rest-api-design/7e1b79f329/