For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Book a demoLog inStart for free
  • Overview
    • What is an API definition?
    • Project structure
      • Overview
      • Authentication
      • Types
        • Overview
        • Environments
        • Global headers
        • Errors
Checking status...
SOC2Soc 2 Type II
© 2026 Fern • Birch Solutions, Inc., a Postman company

Documentation

SDKsDocsAsk FernCLI Reference

API Definitions

OpenAPIAsyncAPIOpenRPCgRPC

Resources

BlogSupportPricing

Company

Brand KitPrivacy PolicyTerms of Service
LogoLogo
Book a demoLog inStart for free
On this page
  • Discriminate by status code
  • Discriminate by error name
  • Global errors
Fern Definitionapi.yml reference

Errors

||View as Markdown|
Was this page helpful?
Edit this page
Previous

Global configuration

Next

Packages in Fern Definition

Fern Definition isn’t recommended for new customers and Fern isn’t accepting feature requests for this format. It remains supported for existing users.

In order to generate SDKs idiomatically, Fern needs to know how to differentiate between different errors when parsing an endpoint response.

Discriminate by status code

You can specify Fern to discriminate by status code. This means on each endpoint, every error that’s listed must have a different HTTP status code.

api.yml
1name: api
2error-discrimination:
3 strategy: status-code

Discriminate by error name

You can specify Fern to discriminate by error name. If you select this strategy, then Fern will assume that every error response has an extra property denoting the error name.

If you use Fern to generate server-side code, then this option provides the most flexibility. Otherwise, you’ll probably want to use the status code discrimination strategy.

api.yml
1name: api
2error-discrimination:
3 strategy: property
4 property-name: errorName

Global errors

You can import and list errors that will be thrown by every endpoint.

api.yml
1imports:
2 commons: commons.yml
3
4errors:
5 - commons.NotFoundError
6 - commons.BadRequestError