---
title: Import OpenAPI
subtitle: Put an OpenAPI spec in your project and add an api node to the navigation to get a complete API reference with groups, endpoint pages, parameter tables, examples, and an interactive explorer.
description: Generate an API reference in ButterIX from OpenAPI 3.x / Swagger 2 — the api navigation node, tag grouping and ordering, endpoint titles and URLs, availability, hidden endpoints, multiple APIs, the overview page, and embedding endpoint snippets in MDX.
---

## Generate an API reference in three steps

<Steps>
  <Step title="Add the spec">
    Put a YAML or JSON spec in your project, for example `openapi/payments.yml`. OpenAPI 3.1, 3.0, and Swagger 2.0 are supported (Swagger is upgraded to 3.1 on load), and every `$ref` is fully dereferenced.
  </Step>
  <Step title="Add it to the navigation">
    ```yaml title="docs.yml"
    tabs:
      api:
        display-name: API Reference
        slug: api

    navigation:
      - tab: api
        layout:
          - api: API Reference
            api-name: payments
            openapi: openapi/payments.yml
    ```
  </Step>
  <Step title="Check and preview">
    ```bash
    biti check && biti dev
    ```

    Problems in the spec (such as unresolvable `$ref`s) are reported as `openapi/spec` warnings; a missing or unparseable file is reported as an `api/load` error.
  </Step>
</Steps>

This site's [API reference](/api-reference) is generated this way from `openapi/platform.yml`.

## Grouping and ordering

- Endpoints are grouped by their **first tag**; endpoints without a tag go into "Endpoints".
- Groups follow the order of the spec's top-level `tags` array; undeclared tags come last.
- A group's title is the tag's `x-displayName` (or `x-display-name`), falling back to the tag name. The group's URL segment is generated from the **tag name**, so you can use an English tag name for English URLs and `x-displayName` for a localized title.
- A tag's `description` is shown under its group on the API overview page.

```yaml title="openapi/payments.yml"
tags:
  - name: Payments          # URL: /api/payments/…
    x-displayName: Payments  # shown as "Payments" in the sidebar and overview page
    description: Create, retrieve, and cancel payments.
  - name: Refunds
    x-displayName: Refunds
```

With only one group, endpoints are listed directly under the API section; set `flattened: true` on the navigation node to force ungrouped output.

## Endpoint titles and URLs

| Purpose | Resolution order |
|---|---|
| Title | `x-fern-display-name` → `summary` → `operationId` → `METHOD /path` |
| URL segment | `x-fern-sdk-method-name` → `summary` → `operationId` → `method-path` |

URL segments are also generated with the GitHub anchor algorithm. When `summary` is not in English, use `x-fern-sdk-method-name` to set an English URL:

```yaml
paths:
  /payments:
    post:
      tags: [Payments]
      summary: Create a payment               # title
      x-fern-sdk-method-name: create-payment  # URL: /api/payments/create-payment
```

When a URL segment repeats within a group, later occurrences get a `-2`, `-3` suffix automatically.

## Availability and hiding

| Extension | Effect |
|---|---|
| `x-fern-availability: beta` (or `x-availability`) | Shows a status badge on the endpoint title and in the sidebar; values include `beta`, `alpha`, `preview`, `deprecated` |
| `x-beta: true` | Same as `beta` |
| `deprecated: true` | Shows "Deprecated" |
| `x-hidden`, `x-internal`, `x-fern-ignore` | No page is generated, and the endpoint is left out of the [published spec](#download-the-spec) |

This site's [AI site translation](/api-reference/editor/translate) endpoint is marked `x-fern-availability: beta`.

## What an endpoint page contains

Each endpoint page is generated from the spec:

- Method badge, full path, and a copy button; with multiple `servers`, readers can switch the base URL.
- **Authentication**: from `security` and `securitySchemes` (Bearer, API key location, and so on).
- Field tables for **path / query / header parameters** and the **request body**: type, required, default, constraints (`minimum`, `maxLength`, `pattern`…), enum values (with `x-enum-descriptions` support), expandable nested objects, switchable `oneOf` / `anyOf` variants, and merged `allOf`.
- **Responses**: a description and field table for each status code, with expandable error responses.
- On the right: **request examples** (9 languages, see [Code samples](./code-samples.mdx)) and **response examples** (switchable across status codes), plus a "Try it" button (see [Try it and proxy](./try-it.mdx)).
- The page's `.md` version includes the parameter tables, request body fields, a cURL example, the response fields of every status code, and a response example for AI to read.

### Where examples come from

Request body and response examples are picked in this order: the first entry in `examples` (switchable when there are several) → `example` → generated from the schema (using the field's `example`, `default`, the first enum value, or a placeholder based on type and `format`).

## Adjust how endpoint pages look

Endpoint pages are generated from the spec and have no source file. Set how they look with `api-reference` in `docs.yml`; it applies to every endpoint page:

```yaml title="docs.yml"
api-reference:
  layout: split            # split: two columns (default); stacked: one column, examples below the parameters
  examples-width: 40       # percent of the examples column in two columns, 30–60, default 50
  content-width: 1100px    # maximum content width; full page width when omitted
  try-it: true             # the API explorer
  request-examples: true   # request examples
  response-examples: true  # response examples
  errors: true             # error responses
  endpoints:
    "GET /jobs/{id}":      # just this endpoint
      layout: stacked
      try-it: false
```

- Keys under `endpoints` are `METHOD /path`, as in the spec; on sites with several APIs use `api-name::GET /jobs/{id}`.
- To turn off the explorer for a whole API, set `playground: { hidden: true }` on its `api` entry in the navigation. Precedence: endpoint > navigation entry > site.
- In the console: site-wide settings are under **Docs settings → API reference**. Open an endpoint page and use **Page settings** to adjust just that endpoint; everything follows the site by default.

## Edit text in the editor

Open an endpoint page in the console's editor and click its title, a description, a parameter or a response to edit the text. Saving writes it back to the spec file. Only that text is replaced; comments, order and everything else stay as they are.

- Editable text: endpoint titles and descriptions, parameter and field descriptions, response descriptions, authentication descriptions, and the group name in the breadcrumb. Types, required flags, paths and examples are read-only; change those in the spec file.
- Text defined under `components` and the like is shared by every endpoint that references it. The edit box says how many endpoints it affects, and they all change when you save.
- Clicking anywhere outside the box cancels. Unsaved text is kept and restored when you click the same text again; **Cancel** or Esc discards it.
- An endpoint's title and description can also be edited in **Page settings**, which is where you add a description to an endpoint that has none. To describe a parameter or field that has no description yet, edit the spec file.
- Changing a title doesn't change the URL: if the URL was generated from the title, `x-fern-sdk-method-name` is written along with it to keep the current one.
- With the preview in another language, you edit the [translation file](../features/i18n.mdx#translate-api-specs) and the spec stays untouched.

<Note>
  If your backend exports the spec, the next export overwrites these edits. Change the comments in your source code instead.
</Note>

## API overview page

The `api` node itself maps to an overview page (at the API section's URL) that lists all groups and endpoints. Its body defaults to the spec's `info.description`; point `summary` at an MDX file to customize it completely:

```yaml
- api: Platform API
  api-name: platform
  openapi: openapi/platform.yml
  summary: pages/api/platform-overview.mdx
```

## Multiple APIs

A site can have multiple `api` nodes, each referencing a different spec. Use `api-name` to tell them apart:

```yaml
navigation:
  - tab: api
    layout:
      - api: Payments API
        api-name: payments
        openapi: openapi/payments.yml
      - api: Accounts API
        api-name: accounts
        openapi: openapi/accounts.yml
```

To show only part of a spec, filter with `tags`:

```yaml
- api: Refunds
  api-name: payments
  openapi: openapi/payments.yml
  tags: [Refunds]
```

## Embed endpoints in guides

Any MDX page can reference endpoints from the API reference directly, and the content stays in sync with the spec:

```mdx
<EndpointRequestSnippet endpoint="POST /sites/{site}/domains" />
<EndpointResponseSnippet endpoint="POST /sites/{site}/domains" />
<EndpointSchemaSnippet endpoint="POST /sites/{site}/domains" selector="request.body" />
```

<EndpointRequestSnippet endpoint="POST /sites/{site}/domains" />

<EndpointResponseSnippet endpoint="POST /sites/{site}/domains" />

<EndpointSchemaSnippet endpoint="POST /sites/{site}/domains" selector="request.body" />

With multiple APIs, prefix the endpoint with `api-name::`, for example `endpoint="payments::POST /payments"`. To show a schema by type:

```mdx
<Schema type="Domain" />
```

<Schema type="Domain" />

See [Components overview › API](../components/overview.mdx#api) for all API components.

## Download the spec

The build publishes the spec files, so readers can import them into Postman or generate SDKs, and agents can read them:

| URL | Content |
|---|---|
| `/openapi.json`, `/openapi.yaml`, `/openapi.yml` | With one API, its spec; with several, a list of each API's id, title, and spec URLs |
| `/openapi/<api-name>.json`, `.yaml`, `.yml` | The spec of one API |
| `/_biti/openapi/<api-name>.yml` (`.json` for JSON specs) | The spec in its original format, for example this site's [`/_biti/openapi/platform.yml`](/_biti/openapi/platform.yml) |
| `/.well-known/api-catalog` | API catalog (RFC 9727): each API's spec URLs and reference page |

Hidden endpoints, and the schemas and tags only they use, are left out of the published specs. Where a page of the site has one of these URLs, the page wins. On password-protected sites the specs need authorization too.
