Display HTTP snippets

View as Markdown

HTTP snippets show API request examples using common HTTP clients like cURL, Python’s requests library, and TypeScript’s fetch API. These are generic code examples that demonstrate how to call your API directly, without using an SDK.

If you configure SDK snippets, those are shown by default. Otherwise, HTTP snippets display automatically in your API Reference language dropdown. See Hume’s API Reference for an example.

HTTP code snippet selector

Snippets automatically include authentication headers, query parameters, request body formatting, and content type headers.

Configuration

1

Add request examples to your API definition

HTTP snippets are generated from request examples in your API definition:

2

Choose which languages to display

To show only specific languages in the HTTP snippet selector (in addition to cURL), list them in docs.yml. Supported values: csharp, curl, dotnet, go, java, python, ruby, typescript.

docs.yml
1settings:
2 http-snippets:
3 - python
4 - ruby

Fern development work is driven by customer requests. Request support for languages not listed here by opening an issue.

Additional options

Set default snippet language

Use the default-language key at the top indentation level of docs.yml. This setting applies to both HTTP snippets and SDK snippets.

docs.yml
1default-language: python
2
3navigation:
4 - api: API Reference

Disable the language dropdown

To disable the HTTP snippet language dropdown and show only cURL examples, set http-snippets to false:

docs.yml
1settings:
2 http-snippets: false

This removes all HTTP snippet languages except cURL from the selector. cURL is always displayed and can’t be removed via docs.yml configuration. To hide cURL, use custom CSS.