Display HTTP snippets
HTTP snippets allow users to see API request examples using common HTTP clients like cURL, TypeScript, Python, C#, Go, Java, PHP, Ruby, and Swift.
Setup
- Ensure you have a paid Fern subscription
- Contact support to request HTTP snippets activation
- Once enabled, build your production docs
Currently, HTTP snippets are provided as an all-or-nothing set. You cannot configure which languages are displayed. If you would like this feature, please open a GitHub issue.
How It Works
Request Examples
To generate HTTP snippets, add request examples to your API definition:
- For Fern Definition: Follow the examples documentation
- For OpenAPI: Follow the request/response examples documentation
Generated Features
HTTP snippets automatically include:
- Authentication headers with placeholders (e.g.,
<apiKey>
) - Query parameters and request body formatting
- Content-Type headers
- Error handling patterns
- SSL/TLS configuration where applicable
Display Behavior
- If your API has SDK snippets, those will be shown by default
- If no SDK snippets exist, HTTP snippets will display automatically
- User language preferences are saved client-side
To see HTTP snippets in action, check out Humanloop’s API documentation for a live example of how they appear in production documentation.