> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiIwZDYyYjQwOS1hNzhkLTRjMjUtYjMzNi0wMzk3MTk0NjllNTIiLCJleHAiOjE3Nzg0OTg0MTYsImlhdCI6MTc3ODQ5ODExNn0.2wiXw9VoJLkyHrpIjOEouoFWpKz0wVpCN7PWNKZDJb0
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# 从 Fern Definition 导出到 OpenAPI

> 使用 fern export 命令将 Fern Definition 导出为 OpenAPI 3.1 格式。防止供应商锁定并轻松转换您的 API 定义。

为了防止被锁定在 Fern Definition 格式中，您可以随时使用 [`fern export` 命令](/cli-api-reference/cli-reference/commands#fern-export)将您的 API 定义导出为 OpenAPI 3.1。

如果您在 `fern/apis/` 文件夹中定义了多个 API，请使用 `--api` 来指定要导出的 API。

<CodeBlock title="terminal">
  ```bash
  fern export path/to/openapi.yml
  fern export path/to/openapi.json

  # 指定要导出的 API
  fern export --api public-api path/to/openapi.yml
  ```
</CodeBlock>