Endpoint response snippet

View as Markdown

Use the <EndpointResponseSnippet> component to reference an endpoint response from your API Reference. When AI agents fetch the Markdown version of a page, Fern renders the response examples as fenced code blocks, so agents consuming your docs via .md URLs or llms.txt receive the full response payloads without parsing HTML.

Usage

Response
1{
2 "turns": [
3 {
4 "role": "user",
5 "content": "Can you explain the benefits of using renewable energy sources?"
6 },
7 {
8 "role": "assistant",
9 "content": "Renewable energy sources, such as solar and wind power, provide sustainable and environmentally friendly alternatives to fossil fuels. They help reduce greenhouse gas emissions, decrease air pollution, and promote energy independence."
10 }
11 ],
12 "citations": [
13 "https://www.epa.gov/greenpower/benefits-green-power",
14 "https://www.irena.org/renewable-energy"
15 ]
16}
Markdown
1<EndpointResponseSnippet endpoint="POST /chat/{domain}" />

Reference particular examples

1

Set the example name in your spec

openapi.yml
1paths:
2 /pet/{petId}:
3 put:
4 summary: Get a pet
5 operationId: pets_get
6 responses:
7 '200':
8 content:
9 application/json:
10 schema:
11 $ref: '#/components/schemas/Pet'
12 examples:
13 ExampleWithMarkley:
14 summary: This is an example of a Pet
15 value:
16 name: Markley
17 id: 44
2

Directly reference the example

Markdown
1 <EndpointResponseSnippet
2 endpoint="GET /pet/{petId}"
3 example="ExampleWithMarkley"
4 />

Properties

endpoint
stringRequired

The endpoint to display, in the format METHOD /path (e.g., POST /chat/{domain}). If your API uses namespaces, prefix with the namespace and :: (e.g., payments::POST /chat/{domain}).

example
string

The name of a specific example to display. If the example includes a summary or docs field, use that value.

highlight
number | number[]

Line numbers to highlight in the code snippet. Accepts a single number, an array of numbers, or ranges (e.g., {[1-3, 5]}).