Adding an API
The five artefacts a documented API needs, and the checks that bind them together.
Editorial Verified 2026-08-31
Navigation or explanatory writing with no source-sensitive claim of its own.
- Page ID
-
contribute/adding-an-api - Normative authority
- No normative source. Navigation only.
- Networks
- none
- Documentation version
- 2026.08
- Audience
- developer
- Owner
- bitcoin-universe-docs
Esta página aún no está disponible en tu idioma.
The five artefacts
Section titled “The five artefacts”- A sanitized route inventory in
contracts/routes/, exported by the runtime repository. - An OpenAPI 3.1 document in
contracts/openapi/. - Schema definitions in
contracts/schemas/common.schema.json, reused rather than duplicated. - A reference page under
reference/api/that renders the inventory and explains the guarantees. - A source manifest entry so the revision is recorded.
The checks that bind them
Section titled “The checks that bind them”| Check | What it prevents |
|---|---|
| Inventory equals documented paths, in both directions | A documented route that does not exist, and a runtime route that is undocumented |
| Inventory revision equals the manifest revision | An inventory drifting from its recorded source |
| Operation identifiers unique across all documents | Collisions in a generated client |
| Every operation has a summary, a declared tag, and responses | A stub masquerading as documentation |
| Every response example validates against its schema | An example that would never be returned |
| Deprecated routes name a replacement | A dead end |
| No production host or routable address | A credential pointed at production from a browser |
Order of work
Section titled “Order of work”- Export the sanitized inventory from the runtime repository. It must contain no hostname, credential, or internal topology.
- Add the source manifest entry with the exact revision.
- Commit the inventory here.
- Write the OpenAPI document, reusing schema definitions.
- Run
npm test. The inventory check will tell you exactly what is missing on either side. - Write the reference page.
- Regenerate the client with
npm run generate.
Schema rules
Section titled “Schema rules”- Satoshi and protocol quantities are decimal strings with a pattern. Never numbers.
- Identifiers carry their pattern. An Atomical ID and a location are different types.
- Every definition carries a description, and at least one example where a value is representable.
- Reuse before adding. A near-duplicate definition is a future inconsistency.
Internal routes
Section titled “Internal routes”Document them, marked as internal and not publicly reachable, so integrators understand the boundary. Never include a credential value, a hostname, or anything that would let someone reach them.
Examples
Section titled “Examples”Every example must validate against its own schema, and CI enforces it. An example is documentation people copy, so a wrong one is worse than none.