# Endpoint response snippet

> Reference an endpoint response from your API Reference

Use the `<EndpointResponseSnippet>` component to reference an endpoint response from
your API Reference.

## Usage

<div>
  <EndpointResponseSnippet endpoint="POST /chat/{domain}" />
</div>

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

## Reference particular examples

<Steps>
  ### Set the example name in your spec

  <AccordionGroup>
    <Accordion title="OpenAPI">
      ```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
      ```
    </Accordion>

    <Accordion title="Fern Definition">
      ```yaml pets.yml {11}
      service:
        auth: true
        base-path: ""
        endpoints:
          update:
            docs: Get a pet
            method: GET
            path: /pet/{petId}
            response: Pet
            examples:
              - name: ExampleWithMarkley
                docs: This is an example of a Pet
                response:
                  body: 
                    name: Markley
                    id: 44
      ```
    </Accordion>
  </AccordionGroup>

  ### Directly reference the example

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

## Properties

<ParamField path="endpoint" type="string" required={true}>
  The endpoint to display, in the format `METHOD /path` (e.g., `POST /chat/{domain}`).
</ParamField>

<ParamField path="example" type="string" required={false}>
  The name of a specific example to display. If the example includes a `summary` or `docs` field, use that value.
</ParamField>

<ParamField path="highlight" type="number | number[]" required={false}>
  Line numbers to highlight in the code snippet. Accepts a single number, an array of numbers, or ranges (e.g., `{[1-3, 5]}`).
</ParamField>