> ## Documentation Index
> Fetch the complete documentation index at: https://docs.monolex.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# MonoAPI

> Import JSON OpenAPI or Swagger specifications as readable Markdown and searchable Monomento knowledge.

MonoAPI is the API-specification ingestion edge of the Monomento stack. It
reads a JSON specification from HTTP or a local file, renders the parts an
agent most often needs, and stores that Markdown in
[Monomento](/ai-clis/monomento) as `doc_type=openapi` unless indexing is
disabled.

*Published contract: `monoapi 0.2.1`, OpenCLIs build
`2026-04-12-113646`. The installed-state row, immutable payload, public CDN
pointer, and CDN release metadata agree on this identity. The exact installed
payload was also code-signature verified on macOS.*

## Quick Start

```bash theme={null}
openclis install monoapi

monoapi --version
monoapi fetch ./openapi.json --no-index
monoapi fetch https://api.example.com/openapi.json
monoapi list
```

Use `--no-index` first when the specification is unfamiliar. It proves that
the document parses and lets you inspect the generated Markdown without
changing the shared search index.

## Published Command Surface

The current public build has **2 operational root commands** plus help and
version aliases.

| Command                          | Reads                                          | Writes                                                  | Contract                                                                                                           |
| -------------------------------- | ---------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `fetch <url-or-file>`            | One HTTP response or one local UTF-8 JSON file | One `openapi` document and its Monomento search records | Converts, prints a summary, and indexes. A changed document at the same stored path replaces the previous content. |
| `fetch <url-or-file> --no-index` | Same source                                    | Nothing persistent                                      | Prints generated Markdown to stdout.                                                                               |
| `list`                           | Shared Monomento database                      | Nothing                                                 | Lists only rows whose `doc_type` is `openapi`.                                                                     |
| `help`, `--help`, `-h`           | Embedded root guide                            | Nothing                                                 | Prints the same root guide as bare `monoapi`.                                                                      |
| `version`, `--version`, `-v`     | Package identity                               | Nothing                                                 | Prints `monoapi 0.2.1`.                                                                                            |

There is no direct MCP schema or endpoint-execution command. MonoAPI describes
an API; it does not call the operations in that API and it does not manage
credentials.

## Parser and Help Boundary

MonoAPI uses a small hand-written dispatcher, not a nested argument parser.
There is no command-specific help surface in the published build:

```bash theme={null}
monoapi help fetch       # prints the root guide; trailing text is ignored
monoapi fetch --help     # treats --help as the input file and fails
```

Do not probe a subcommand by appending `--help`; for fetch-like tools that
token can be interpreted as real input. Use bare `monoapi`, `monoapi help`, or
this page.

<Note>
  Repository HEAD also contains a `docs [topic]` dispatcher for a future
  build. The immutable `0.2.1 / 2026-04-12-113646` payload rejects `docs` with
  a non-zero exit, so automation must not depend on it yet.
</Note>

## What the Converter Preserves

The converter is intentionally compact rather than exhaustive.

| Specification area | Rendered behavior                                                                                     |
| ------------------ | ----------------------------------------------------------------------------------------------------- |
| Identity           | `info.title`, `info.version`, and `info.description`                                                  |
| Servers            | OpenAPI 3 `servers` URLs and descriptions                                                             |
| Authentication     | OpenAPI 3 `components.securitySchemes`; HTTP and API-key details, with OAuth flattened to `OAuth 2.0` |
| Operations         | `GET`, `POST`, `PUT`, `PATCH`, and `DELETE` under `paths`                                             |
| Parameters         | Name, location, required state, and a compact type                                                    |
| Request bodies     | Every media type present under an OpenAPI 3 request body                                              |
| Responses          | Status, description, and the schema from the first response media type                                |
| Models             | OpenAPI 3 `components.schemas` properties, required fields, and enums                                 |

Important limits:

* Input is JSON only. YAML must be converted before MonoAPI reads it.
* Swagger 2 JSON path operations can be rendered, but Swagger 2
  `securityDefinitions`, `definitions`, and body-schema conventions are not a
  full-fidelity OpenAPI 3 translation.
* `$ref` values are reduced to their final path segment. References are not
  recursively or cross-file resolved.
* `HEAD`, `OPTIONS`, and `TRACE` operations are not emitted.
* The complete specification and generated Markdown are held in memory. HTTP
  reads have a 30-second client timeout.

Treat the generated reference as an orientation layer, then compare important
claims with the service's live behavior and primary documentation.

## Identity, Deduplication, and Storage

The stored key is the input string supplied to `fetch`: the URL or local path
is not canonicalized first. Deduplication is therefore scoped to that stored
path. Re-fetching identical content at the same path is skipped; changed
content replaces it; two different aliases can remain separate documents.

MonoAPI uses Monomento's shared global database resolution:

1. `$MONOMENTO_HOME/monomento.db` when `MONOMENTO_HOME` is set;
2. otherwise `~/.monolex/monomento.db` when it exists;
3. otherwise the legacy Monolex application-support database when present.

Use [Monomento](/ai-clis/monomento) for cross-source search and section reads.

## Published Platforms

| Platform            | Binary        |
| ------------------- | ------------- |
| macOS Apple Silicon | `monoapi`     |
| macOS Intel         | `monoapi`     |
| Linux ARM64         | `monoapi`     |
| Linux x86-64        | `monoapi`     |
| Windows ARM64       | `monoapi.exe` |
| Windows x86-64      | `monoapi.exe` |

These six platform entries come from the immutable CDN `meta.json`, not from
an inferred cross-platform claim.

## Relationships

| Need                                                 | Tool                            |
| ---------------------------------------------------- | ------------------------------- |
| OpenAPI or Swagger JSON definition                   | **MonoAPI**                     |
| General static HTML or docs manifest                 | [MonoFetch](/ai-clis/monofetch) |
| JavaScript-rendered or authenticated page            | [MonoSurf](/monosurf/index)     |
| Local PDF, Office file, EPUB, image, or audio        | [MonoDoc](/ai-clis/monodoc)     |
| Search and read imported material                    | [Monomento](/ai-clis/monomento) |
| Join documentation with code, git, and work evidence | [MonoFlow](/ai-clis/monoflow)   |

The normal evidence flow is `monoapi fetch`, `monomento search`, then
`monomento read` for the section that owns the endpoint or schema.
