> This page is for Docs.

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt.

# Endpoint response snippet

> Reference an endpoint response from your API Reference

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

## Usage

### Response (200)

```json
{
  "turns": [
    {
      "role": "user",
      "content": "Can you explain the main features of the Claude-4.5-sonnet model?"
    },
    {
      "role": "assistant",
      "content": "Claude-4.5-sonnet is an advanced language model designed for nuanced and creative text generation, optimized for both conversational and literary tasks."
    }
  ],
  "citations": [
    "Claude-4.5-sonnet model documentation, BuildWithFern"
  ],
  "sources": [
    {
      "url": "https://fai.buildwithfern.com/docs/models/claude-4.5-sonnet",
      "title": "Claude-4.5-sonnet Model Documentation"
    }
  ]
}
```

**`Markdown`**

```jsx Markdown
<EndpointResponseSnippet endpoint="POST /chat/{domain}" />
```

## Reference particular examples

### Set the example name in your spec

**`openapi.yml`**

```yaml openapi.yml {13}
paths:
  /pet/{petId}:
    put:
      summary: Get a pet 
      operationId: pets_get
      responses: 
        '200': 
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
              examples:
                ExampleWithMarkley:
                  summary: This is an example of a Pet
                  value: 
                    name: Markley
                    id: 44
```

### Directly reference the example

**`Markdown`**

```jsx Markdown {3}
  <EndpointResponseSnippet 
    endpoint="GET /pet/{petId}" 
    example="ExampleWithMarkley"
  />
```

## Properties

**`endpoint`** `string` — required

The endpoint to display, in the format `METHOD /path` (e.g., `POST /chat/{domain}`). If your API uses [namespaces](/learn/api-definitions/overview/project-structure#combined-sdks-from-multiple-apis), 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]}`).

---