Signature case study

The Documentation of a Real API, from Requirement to Revision

The KC1 prediction API is a working service from my MSc project. Here is its documentation taken through nine phases and sixteen stages, from the requirement to a revision for an engineering change, with every file it produced.

Real, and reproducible. The API, the model, the requests and the change are real: anyone can clone the project and get the same answers. The work was done on 19 November 2026. No engineer of the project reviewed the documents; this page says so where it matters.

Go straight to a piece of evidence

Requirement

What developers needed, and what was missing.

Stage 1

Engineering Requirement

Developers who call the KC1 API need to know what it takes, what it returns and what each error means. The project’s README described the API in one section, and there was no reference, no quick start and no list of errors.

Output A brief: three documents for developers, every example taken from the API itself.

Research

The sources at one commit, and every endpoint called before a word was written.

Stage 2

Source Information

The sources, at the commit the documentation describes (9b696fc):

And the model card and the dataset card, for the model behind the answers.

Stage 3

Technical Analysis

I trained the model with the project’s own trainer and called every endpoint with FastAPI’s test client: the right requests, and every way a request can go wrong. The run reproduced the model card: F1 0.500 at a threshold of 0.50. The recording found what reading the code suggested: 21 required fields, three of them also accepted under other names, and no extra field allowed. It also found a fault: a value such as 1e999 got 500 instead of 422.

The 13 recorded exchanges, as JSON, with the versions they were recorded with.

Author

Three documents, one for each thing a developer comes to do.

Stage 4

Information Architecture

Three documents, one for each thing a developer comes to do, following Diátaxis:

The reader wants toDocumentDITA topic
get a first answerGet Your First Prediction from the KC1 APItask
look up a field or an errorKC1 Prediction API Referencereference
fix a failing requestTroubleshoot the KC1 APItroubleshooting

One map holds them, and the library files them on the KC1 shelf, next to the model and dataset cards.

Stage 5

Document Authoring

Every example in them is a recorded exchange, copied, not retyped. The Python example was run against the API.

Illustrate

A real request captured, marked to the house standard, and the flow drawn as a diagram.

Stage 6

Screenshot Capture

The API serves its own page at /docs, made by Swagger UI. I ran the API and a real request through that page in Chrome, and kept a screenshot of each step, with the box of every control the step names. This computer can’t reach the CDN the page loads Swagger UI from, so the same files came from the npm package swagger-ui-dist 5.35.1.

Stage 7

Visual Annotation

The Screenshot Studio placed each mark on the box the capture measured, in the house style: green rectangles 4 pixels out from the control, numbered callouts that cover nothing the reader needs. The status code is marked by the box of its text, not of its table cell.

The server response in Swagger UI, with the status code 200 and the response body marked
Step 3 of the quick start’s walkthrough, as published.

Stage 8

Technical Illustration

A sequence diagram shows what happens to a request: validation, the 422 branch, the model, the threshold. It’s written in Mermaid in the reference itself, and drawn once as SVG for the web; for the PDF it’s drawn as a PNG, because the PDF’s renderer can’t read Mermaid’s styles.

See it in the reference.

Review

What was checked against the running API, and what wasn’t.

Stage 9

Technical Review

What was checked against the running API, and what wasn’t:

  • Every response in the documents is a recorded exchange.
  • The model reproduces the model card’s results.
  • The Python example ran, with the test client in place of the network, and printed what the reference says.
  • The Swagger walkthrough ran against the API on this computer.
  • The Docker commands come from the project’s README. Docker isn’t available here, and the guide says so.
  • No engineer of the project has reviewed the documents yet.

Validate

The house style guide’s checks, run on every build.

Stage 10

Editorial Validation

DocumentStyle check, 34 rules
Get Your First Prediction from the KC1 API5 errors, 0 warnings, 0 suggestions
KC1 Prediction API Reference6 errors, 0 warnings, 0 suggestions
Troubleshoot the KC1 API4 errors, 0 warnings, 0 suggestions

The build runs the check on every change, so this table shows the current result.

Publish

PDF, HTML5 and DITA from one source, a captioned walkthrough, and the release.

Stage 11

Structured Publishing

DITA Open Toolkit 4.3.4 published the three documents as a task, a reference and a troubleshooting topic, from DITA 1.3 whose 6 files are all valid against the OASIS DTDs. Links between the documents became links between topics, and each screenshot got a printed width.

Stage 12

Multimedia Training

A 15-second walkthrough of the request through the API’s page, made from the annotated screenshots. It has no sound: the captions say everything, burned in below the picture and as a WebVTT file.

Stage 13

Documentation Release

Version 1.0 of the three documents, for API version 1.0.0, published on 19 November 2026 in the library, as a PDF and as HTML5. The fault from stage 3 is in the troubleshooting guide as a known issue.

Change

A fault found during research became a fix, and the API was recorded again.

Stage 14

Engineering Change

The fault became a fix: pull request 2 in the project’s repository makes the API answer 422 for a value that isn’t finite, raises the version to 1.0.1, and adds a test that fails before the fix and passes after it. The project’s CI built the image, trained the model and passed every test. It was merged on 19 November 2026 (merge commit cd23130), so the project’s API is now version 1.0.1.

Stage 15

Impact Analysis

Which documents does the change touch? I recorded the API again on the fix’s branch, and compared every exchange with the first recording.

RequestCase1.0.01.0.1
GET /root200200
GET /healthhealth200200
POST /predictpredict sample200200
POST /predictpredict flagged200200
POST /predictpredict clean200200
POST /predictmissing fields422422
POST /predictextra field422422
POST /predictnot a number422422
POST /predictnot finite500422 Changed
POST /predictpython names200200
GET /predictwrong method405405
GET /predictionsunknown path404404
POST /predictnot json422422

1 of 13 exchanges changed. Besides its version, the OpenAPI description is the same. Then every section of the documents that shows what the change touches, found by searching them for the status 500, the value 1e999 and the version 1.0.0:

Revise

Revision 1.1 of the two documents the change touched, line by line.

Stage 16

Revised Publication

Revision 1.1 of the two documents the change touches, published with version 1.0.1 on 19 November 2026: the library shows it now. The quick start doesn’t change. Its three Swagger UI screenshots show 1.0.0 beside the API’s name, and nothing else on them changed, so they wait for the quick start’s next revision.

KC1 Prediction API Reference: 1.0 to 1.1

Show the changes: 3 lines added, 4 removed
…owner: Karan Deshmukhauthor: Karan DeshmukhRemoved: version: 1.0Added: version: 1.1status: Publisheddate: 2026-11-19…|---|---|| Base URL | `http://127.0.0.1:8000`, when you start the API with the project's Docker Compose file. The Compose file publishes the port on this computer only. |Removed: | API version | 1.0.0 |Added: | API version | 1.0.1 || Format | JSON in and JSON out. Send `Content-Type: application/json`. || Authentication | None. The API has no sign-in and no keys. Keep it on `127.0.0.1`, as the Compose file does, or put an authenticating gateway in front of it. |…| Status | When | Body ||---|---|---|Removed: | `422 Unprocessable Content` | A field is missing, a field isn't one of the 21, a value isn't a number, or the body isn't a JSON object. | `detail`: one entry for each problem, with its `type`, its location `loc`, a message `msg` and the `input` that caused it. |Added: | `422 Unprocessable Content` | A field is missing, a field isn't one of the 21, a value isn't a number or isn't finite, or the body isn't a JSON object. | `detail`: one entry for each problem, with its `type`, its location `loc`, a message `msg` and the `input` that caused it. || `404 Not Found` | The path doesn't exist, such as `/predictions`. | `{"detail": "Not Found"}` || `405 Method Not Allowed` | The path exists but takes another method, such as `GET /predict`. | `{"detail": "Method Not Allowed"}` |Removed: | `500 Internal Server Error` | A number too large for a 64-bit float, such as `1e999`. This is a known fault: see [Troubleshoot the KC1 API](/docs/kc1/api-troubleshooting). | `Internal Server Error`, as plain text | A request that sends only `loc` gets one entry for each of the 20 missing fields. Here is the first one.

Revision 1.0 and revision 1.1, in Markdown. 6 errors, 0 warnings, 0 suggestions against the style guide.

Troubleshoot the KC1 API: 1.0 to 1.1

Show the changes: 8 lines added, 4 removed
…owner: Karan Deshmukhauthor: Karan DeshmukhRemoved: version: 1.0Added: version: 1.1status: Publisheddate: 2026-11-19…The body isn't a JSON object, often because the client sent a form. Send JSON, and set the header `Content-Type: application/json`. With curl, use `-H "Content-Type: application/json" -d @module.json`. Removed: ## Error 500 for a very large numberAdded: ## 422 and "Input should be a finite number" Removed: A value too large for a 64-bit float, such as `1e999`, makes the API fail with `500 Internal Server Error` instead of refusing the request with a 422. The value becomes infinity when the API reads it. The API then refuses it, but it can't write infinity into the JSON of the error message, and the error message itself fails.Added: A value is too large to be a finite number, such as `1e999`, or it's `NaN`. The API reads `1e999` as infinity and refuses it. Removed: Check that every value is a finite number before you send it. It's a known issue in version 1.0.0. A fix is in review in [pull request 2](https://github.com/domail2karandeshmukh-cyber/group6-kc1-defect-prediction/pull/2). Its version 1.0.1 writes infinity as text in the error message and answers 422. A test covers `1e999`, `-1e999` and `NaN`.Added: ```jsonAdded: {"type": "finite_number", "loc": ["body", "loc"], "msg": "Input should be a finite number", "input": "inf"}Added: ``` Added: Send finite numbers. Before version 1.0.1, the API answered `500 Internal Server Error` to such a value instead of a 422.Added:  ## Error 405 for the wrong method 

Revision 1.0 and revision 1.1, in Markdown. 3 errors, 0 warnings, 0 suggestions against the style guide.