ADR 0025: External and internal API documentation
Ratification
This ADR decides how we split documentation for external integrators (partners,
client developers) and engineers in this repo. Git history on main is the record for
this file.
- Discussion Issue: optional — link when opened with
[ADR]title - Merge PR: see git history for this file
- Accepted: 2026-04-14
Context
Why this matters: One group needs a stable contract and release notes; the other needs business rules, how things behave in production, and why we built it that way — hard to put fully in OpenAPI. If we mix both in random prose, external readers see internal detail they do not need, and engineers search code when text is missing.
We already govern HTTP quality via
ADR 0007 (OpenAPI snapshot, examples, CI) and
public change history via ADR 0013. This ADR does not change
those rules. It only names which artifact is official for which audience and where internal
narrative lives (docs/internal/; see
ADR 0026).
Decision
-
External contract (integrators). The OpenAPI document committed under
docs/openapi/(baseline snapshot and the same contract exposed at runtime when the app serves/openapi.json) is the sole normative description of the public HTTP API for external development: paths, methods, schemas, declared errors, examples, and documented headers. Partners and third-party clients should treat it as immutable truth for what we publish at a given release; changes flow through versioning and changelog policy (ADR 0004, ADR 0013). -
External discovery aids. Swagger UI at
/docs(when the app runs) and the staticdocs/openapi/openapi-explorer.htmlpage are views on that contract; they are not independent sources of truth. If explorer text disagrees with the committed baseline after a merge, the fix is to align code and baseline (ADR 0007), not to treat the browser copy as authoritative. -
Internal service documentation. Narrative that explains why the API behaves as
it does, business invariants, cross-cutting processes (idempotency, error
monitoring expectations, messaging topics), and traceability of decisions over time lives under
docs/internal/as HTML, governed by ADR 0026. Layout is multi-page: a landing page, service overview, an HTTP API hub underdocs/internal/api/, and per-resource folders with a single hub (index.html) plus optional per-endpoint pages — see ADR 0026 anddocs/howto/internal-service-docs-layout.html(contributor layout;STRUCTURE.mdlinks there). It does not replace OpenAPI for external consumers. -
Python API reference. Generated HTML under
docs/api/remains the reference for in-repo Python modules (per ADR 0016), distinct from HTTP OpenAPI and fromdocs/internal/.
Scope
- In scope: Audience split, location of internal HTML docs, primacy of OpenAPI for external HTTP contract.
- Out of scope: A separate public developer portal product, monetization, or org-wide API catalogue outside this repository.
Relationship to other artifacts
| Artifact | Primary audience | Authoritative for |
|---|---|---|
| OpenAPI baseline + runtime | External integrators | HTTP request/response contract at a version |
Root CHANGELOG.md |
Integrators & release readers | What changed between releases (API surface, behavior) |
docs/internal/ (HTML) + how-to layout / STRUCTURE.md stub |
Engineers in this repo | Behavioral semantics, business rules, ops expectations, per-resource hubs and method pages (per ADR 0026) |
docs/api/ (pdoc) |
Contributors | Python package internals |
Alternatives considered
-
Single prose manual for everything.
- Pros: one place to open.
- Cons: duplicates OpenAPI; drifts from CI-checked contract; poor for machine clients.
-
OpenAPI-only, no internal tree.
- Pros: minimal files.
- Cons: business rules and rationale scatter across code review and chat; disputes default to reading code.
Consequences
Positive
- Clear expectation: integrators trust OpenAPI + changelog; engineers extend internal docs when behavior is non-obvious.
- Aligns with existing governance (ADR 0007, 0013) without changing contract-test meaning.
Trade-offs
- Two maintained surfaces (OpenAPI + internal HTML) require discipline; internal pages must link to operations and PRs when they change behavior.
Page history
| Date | Change | Author |
|---|---|---|
| Added Page history section (repository baseline). | Ivan Boyarkin |