# API Reference

The iClosed.io API is documented with OpenAPI 3.0. Use the spec for code generation, Postman/Insomnia import, or interactive docs.

## OpenAPI spec

- **Spec file:** [openapi/v1/openapi.json](/openapi/v1/openapi)


## Viewing with Redocly

This project is wired for [Redocly CLI](https://redocly.com/docs/cli/). From the repo root (use `nvm use 22` if you use nvm):

```bash
# Lint the API spec
npx @redocly/cli lint

# Preview the API reference (interactive docs) — serves at http://localhost:8080
npx @redocly/cli preview-docs iclosed@v1

# Custom port, e.g. 3000
npx @redocly/cli preview-docs iclosed@v1 -p 3000

# Bundle the spec (outputs bundled file)
npx @redocly/cli bundle openapi/v1/openapi.json -o openapi/v1/bundled.json
```

Configuration is in [redocly.yaml](/assets/redocly.bcc0316026b40a9f9380deefb032a6a4c19dd2a905c9e93016c20256211c3bd4.8a5edab2.yaml) at the project root. The API is registered as `iclosed@v1`.

## Host locally

| What | Command | URL |
|  --- | --- | --- |
| **Reunite/Realm** (full theme, sidebar, API + docs) | `npm run preview` or `npm run preview:reunite` | http://localhost:4000 |
| **API reference only** (Redoc) | `npm run preview:api` or `npx @redocly/cli preview-docs iclosed@v1` | http://localhost:9999 |
| **Docs** (markdown only) | `npm run preview:docs` or `npx serve docs` | http://localhost:3000 |


**To see how it will look when Redocly hosts it** (navbar, footer, theme, sidebar): run `npm run preview` (or `npx @redocly/cli preview --product=realm`). That uses the same Realm layout and theme as Reunite.

## Related docs

- [Introduction](/) — Base URLs, first request, endpoint quick reference
- [Authentication](/docs/authentication) — API keys and headers