OpenAPI

Use OpenAPI for your API definition

Fern supports the use of the OpenAPI specification (up to and including version 3.1) to define APIs. Alternatively, you can use Fern’s simpler format called Fern Definition.

Fern generates SDKs and API reference documentation from your OpenAPI spec. Get started by creating a fern/ project through one of our Quickstarts, then replace the file in the fern/openapi/ folder with your own. You can use either JSON or YAML for your file.

Run fern check to validate the OpenAPI spec. Resolve any errors. Having trouble? Reach out in the Fern Discord server.

If you’re having trouble understanding the errors, run the command fern write-definition. This command will convert your OpenAPI spec into a Fern Definition. Read more.

If there are no errors, you can run fern generate to generate SDKs or fern generate —docs to generate docs.