Endpoint request snippet

View as Markdown

Use the <EndpointRequestSnippet> components to reference an endpoint request from your API Reference.

Usage

POST
/chat/:domain
1curl -X POST https://fai.buildwithfern.com/chat/domain \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "messages": [
6 {
7 "role": "user",
8 "content": "Can you explain the benefits of using the Claude-4.5-sonnet model for natural language processing tasks?"
9 }
10 ]
11}'
Markdown
1<EndpointRequestSnippet endpoint="POST /chat/{domain}" />

Reference particular examples

1

Set the example name in your spec

openapi.yml
1paths:
2 /pet:
3 put:
4 summary: Update an existing pet
5 operationId: pets_update
6 requestBody:
7 content:
8 application/json:
9 schema:
10 $ref: '#/components/schemas/Pet'
11 examples:
12 ExampleWithMarkley:
13 value:
14 name: Markley
15 id: 44
pets.yml
1service:
2 auth: true
3 base-path: ""
4 endpoints:
5 update:
6 docs: Update an existing pet
7 method: PUT
8 path: /pet
9 request: Pet
10 examples:
11 - name: ExampleWithMarkley
12 request:
13 name: Markley
14 id: 44
2

Directly reference the example

Markdown
1 <EndpointRequestSnippet
2 endpoint="PUT /pet"
3 example="ExampleWithMarkley"
4 />
Referencing examples

If the example includes a summary or docs field, use that for the example prop. If not summary is set, use the example name.

Variants

Filter languages

Use the languages prop to filter which languages appear in the dropdown and control their order.

POST
/chat/:domain
1curl -X POST https://fai.buildwithfern.com/chat/domain \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "messages": [
6 {
7 "role": "user",
8 "content": "Can you explain the benefits of using the Claude-4.5-sonnet model for natural language processing tasks?"
9 }
10 ]
11}'
Markdown
1<EndpointRequestSnippet
2 endpoint="POST /chat/{domain}"
3 languages={["curl", "python", "typescript"]}
4/>

Show payload

The payload option displays the raw JSON request body for POST/PUT/PATCH requests, or query parameters for GET requests.

POST
/chat/:domain
1curl -X POST https://fai.buildwithfern.com/chat/domain \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "messages": [
6 {
7 "role": "user",
8 "content": "Can you explain the benefits of using the Claude-4.5-sonnet model for natural language processing tasks?"
9 }
10 ]
11}'
Markdown
1<EndpointRequestSnippet
2 endpoint="POST /chat/{domain}"
3 languages={["curl", "python", "payload"]}
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]}).

languages
string[]

Specifies which languages to show in the dropdown and in what order. Supported values include curl, python, typescript, javascript, go, ruby, java, kotlin, csharp, php, swift, rust, and payload. When not specified, all available languages are shown.