Public API

# Public API

`GET /api/v1/health` reports process liveness.

```json
{
  "data": {
    "status": "ok"
  }
}
```

## Documents

`GET /api/v1/docs/{slug}` returns a curated Markdown document. Unknown
slugs yield problem JSON with status `404` and code `not_found`. Bodies
never include filesystem paths. Success `data` has exactly four fields:
`slug`, `title`, `description`, and `content`.

```json
{
  "data": {
    "slug": "public-api",
    "title": "Public API",
    "description": "Success envelopes and curated document fields.",
    "content": "# Public API\n"
  }
}
```

## Diagrams

`GET /api/v1/docs/diagrams/{id}` returns a curated diagram model.
Unknown ids yield problem JSON with status `404` and code `not_found`.
Validation failures yield problem JSON and never include filenames or
absolute paths. Success `data` has exactly five fields: `id`, `title`,
`description`, `kind`, and `model`. The snapshot file is not a public
id. The Markdown island lazy-loads a first-party renderer for a valid
`g5nx-diagram` fence.

The JSON below is an **abridged contract placeholder** for the five-field
envelope. `model: {}` is not a valid architecture document. Public
architecture and request-flow models must include `nodes`, `edges`, and
a `layout` with a positive `viewBox` and a position box for every node,
as enforced by `PublicDiagramValidator`.

```json
{
  "data": {
    "id": "nx-platform-architecture",
    "title": "gnuboard5NX 모듈 구조",
    "description": "HTTP 앱, 모듈, 계약, UI, 플랫폼 어댑터의 구성.",
    "kind": "architecture",
    "model": {
      "nodes": [
        {"id": "apps-http", "label": "apps/http", "role": "composition-root"},
        {"id": "frontend", "label": "frontend islands", "role": "live-renderer"}
      ],
      "edges": [
        {"from": "frontend", "to": "apps-http", "label": "same-origin JSON"}
      ],
      "layout": {
        "viewBox": {"width": 400, "height": 200},
        "positions": {
          "apps-http": {"x": 200, "y": 20, "width": 140, "height": 64},
          "frontend": {"x": 20, "y": 120, "width": 160, "height": 64}
        }
      }
    }
  }
}
```

## Example fetch

```js
const response = await fetch('/api/v1/docs/overview');
const payload = await response.json();
const { slug, title, description, content } = payload.data;
```

## Shell

```sh
curl -sS https://g5nx.oootool.com/api/v1/health
curl -sS https://g5nx.oootool.com/api/v1/docs/overview
curl -sS https://g5nx.oootool.com/api/v1/docs/diagrams/nx-platform-architecture
```