Endpoint response snippet

View as Markdown

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

Usage

Response
1{
2 "turns": [
3 {
4 "role": "user",
5 "content": "Can you explain the benefits of using the Claude-4.5-sonnet model for natural language processing tasks?"
6 },
7 {
8 "role": "assistant",
9 "content": "The Claude-4.5-sonnet model offers enhanced contextual understanding and poetic language generation, making it ideal for creative writing and nuanced conversational AI applications."
10 }
11 ],
12 "citations": [
13 "https://docs.anthropic.com/claude/claude-4.5-sonnet"
14 ]
15}
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
pets.yml
1service:
2 auth: true
3 base-path: ""
4 endpoints:
5 update:
6 docs: Get a pet
7 method: GET
8 path: /pet/{petId}
9 response: Pet
10 examples:
11 - name: ExampleWithMarkley
12 docs: This is an example of a Pet
13 response:
14 body:
15 name: Markley
16 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}).

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]}).