Import OpenAPI
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.
Generate an API reference in three steps
This site's 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
tagsarray; undeclared tags come last. - A group's title is the tag's
x-displayName(orx-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 andx-displayNamefor a localized title. - A tag's
descriptionis shown under its group on the API overview page.
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: RefundsWith 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:
paths:
/payments:
post:
tags: [Payments]
summary: Create a payment # title
x-fern-sdk-method-name: create-payment # URL: /api/payments/create-paymentWhen 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 |
This site's AI site translation 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
securityandsecuritySchemes(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 (withx-enum-descriptionssupport), expandable nested objects, switchableoneOf/anyOfvariants, and mergedallOf. - Responses: a description and field table for each status code, with expandable error responses.
- On the right: request examples (9 languages, see Code samples) and response examples (switchable across status codes), plus a "Try it" button (see Try it and proxy).
- The page's
.mdversion 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:
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
endpointsareMETHOD /path, as in the spec; on sites with several APIs useapi-name::GET /jobs/{id}. - To turn off the explorer for a whole API, set
playground: { hidden: true }on itsapientry 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
componentsand 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-nameis written along with it to keep the current one. - With the preview in another language, you edit the translation file and the spec stays untouched.
If your backend exports the spec, the next export overwrites these edits. Change the comments in your source code instead.
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:
- api: Platform API
api-name: platform
openapi: openapi/platform.yml
summary: pages/api/platform-overview.mdxMultiple APIs
A site can have multiple api nodes, each referencing a different spec. Use api-name to tell them apart:
navigation:
- tab: api
layout:
- api: Payments API
api-name: payments
openapi: openapi/payments.yml
- api: Accounts API
api-name: accounts
openapi: openapi/accounts.ymlTo show only part of a spec, filter with tags:
- 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:
<EndpointRequestSnippet endpoint="POST /sites/{site}/domains" />
<EndpointResponseSnippet endpoint="POST /sites/{site}/domains" />
<EndpointSchemaSnippet endpoint="POST /sites/{site}/domains" selector="request.body" />curl -X POST https://api.butterix.com/v1/sites/acme-payments/domains \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"domain": "docs.acme.com"
}'import requests
url = "https://api.butterix.com/v1/sites/acme-payments/domains"
payload = {
"domain": "docs.acme.com"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())const response = await fetch("https://api.butterix.com/v1/sites/acme-payments/domains", {
method: "POST",
headers: {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
},
body: JSON.stringify({
"domain": "docs.acme.com"
})
});
const data = await response.json();
console.log(data);package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
url := "https://api.butterix.com/v1/sites/acme-payments/domains"
payload := strings.NewReader(`{
"domain": "docs.acme.com"
}`)
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}require "uri"
require "net/http"
require "json"
url = URI("https://api.butterix.com/v1/sites/acme-payments/domains")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <token>"
request["Content-Type"] = "application/json"
request.body = {
"domain": "docs.acme.com"
}.to_json
response = http.request(request)
puts response.read_bodyHttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.butterix.com/v1/sites/acme-payments/domains"))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\"domain\":\"docs.acme.com\"}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://api.butterix.com/v1/sites/acme-payments/domains', [
'body' => '{"domain":"docs.acme.com"}',
'headers' => [
'Authorization' => 'Bearer <token>',
'Content-Type' => 'application/json',
],
]);
echo $response->getBody();using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://api.butterix.com/v1/sites/acme-payments/domains");
request.Headers.Add("Authorization", "Bearer <token>");
request.Content = new StringContent("{\"domain\":\"docs.acme.com\"}", Encoding.UTF8, "application/json");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());import Foundation
var request = URLRequest(url: URL(string: "https://api.butterix.com/v1/sites/acme-payments/domains")!)
request.httpMethod = "POST"
request.setValue("Bearer <token>", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = """
{
"domain": "docs.acme.com"
}
""".data(using: .utf8)
let (data, _) = try await URLSession.shared.data(for: request)
print(String(decoding: data, as: UTF8.self)){
"domain": "docs.acme.com",
"verified": false,
"primary": false,
"verifyRecord": {
"type": "TXT",
"name": "_butterix.docs.acme.com",
"value": "butterix-verify=a1b2c3d4e5f6"
},
"cname": "sites.butterix.com",
"createdAt": 1
}{
"error": "Use 5–40 lowercase letters, numbers and single hyphens."
}{
"error": "That subdomain is taken."
}With multiple APIs, prefix the endpoint with api-name::, for example endpoint="payments::POST /payments". To show a schema by type:
<Schema type="Domain" />See Components overview › 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 |
/.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.