For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Slack communityLog inBook a demo
  • Getting Started
    • Overview
    • Quickstart
    • Customer Showcase
  • Writing Content
    • Markdown
      • Overview
      • Accordions
      • Accordion Groups
      • Aside
      • Button
      • Callouts
      • Cards
      • Card Groups
      • Code Blocks
      • Embed
      • Endpoint Request Snippet
      • Endpoint Response Snippet
      • Endpoint Schema Snippet
      • Frames
      • Icons
      • Parameter Fields
      • Steps
      • Tabs
      • Tooltips
    • Visual Editor
    • Reusable Markdown
    • Custom React Components
    • Changelog
LogoLogo
Slack communityLog inBook a demo
On this page
  • Reference particular examples
Writing ContentComponents

Endpoint Request Snippet

Was this page helpful?
Previous

Endpoint Response Snippet

Next
Built with

The EndpointRequestSnippet component is used to reference an endpoint request from your API Reference. Below is an example of referencing the request for the POST /snippets endpoint.

Markdown
1<EndpointRequestSnippet endpoint="POST /snippets" />

will be rendered as:

POST
/snippets
1curl -X POST https://api.buildwithfern.com/snippets \
2 -H "Authorization: Bearer <token>" \
3 -H "Content-Type: application/json" \
4 -d '{
5 "endpoint": {
6 "path": "/v1/search",
7 "method": "GET"
8 }
9}'
Try it

Reference particular examples

If you want to reference a particular example in the request snippet, you can set example prop to the name of the example. See the steps below:

1

Define named examples

The highlighted lines show how to set the example name.

OpenAPI
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
Fern Definition
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

Reference the example

In the API Definition, the example had a name ExampleWithMarkley. You can reference the example directly:

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.