Display SDK snippets
If you use Fern to generate SDKs, you can display SDK code snippets in your API Reference. These snippets show examples using your actual SDK in TypeScript, Python, Go, and other supported languages.
Once configured, SDK snippets replace HTTP snippets.
Dynamic snippets
By default, SDK snippets are dynamic code examples that allow users to modify parameters and see code examples update in real time across all supported languages.
Alternatively, you can disable dynamic snippets in your docs.yml and use static code examples.

Configuration
To configure SDK snippets, first name your SDKs in generators.yml and then reference that name in docs.yml.
Add examples to your API definition
Fern needs to read request examples from your API definition to generate code snippets.
- For Fern Definition, follow the examples documentation.
- For OpenAPI, follow Swagger’s examples documentation.
Define a package name for your SDK(s)
Configure package names in your generators.yml file:
- For Python, TypeScript, Ruby, and .NET/C#, add
package-name: your-package-nameto theoutputsection. - For Java, add
coordinate: com.your-org:your-package-nameto theoutputsection. - For PHP, add
packageName: YourPackageNameto theconfigsection. - For Go, add
repository: your-organization/your-repositoryto thegithubsection.
Add the package name to your docs configuration
Add the package name for the corresponding SDK to your docs.yml file:
- For Python, TypeScript, Ruby, and .NET/C#,
your-package-namemust match theyour-package-namethat you configured in yourgenerators.ymlfile. - For Java,
com.your-org:your-package-namemust match thecoordinatethat you configured in yourgenerators.ymlfile. - For PHP,
YourPackageNamemust match thepackageNamethat you configured in yourgenerators.ymlfile. - For Go, use the exact URL where the SDK repository is located, including the
https://github.com/.
To display different package names for SDK users versus documentation users, use overrides files.
Additional options
Specify SDK versions
You can specify which SDK version to use when generating code snippets.
Set default snippet language
Use the default-language key at the top indentation level of docs.yml. This setting applies to both SDK snippets and HTTP snippets.
Endpoint request and response snippets
Looking for information on generating API endpoint request and response snippets? See our documentation on Endpoint Request Snippets and Endpoint Response Snippets.