Endpoint Response Snippet

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

Markdown
1<EndpointResponseSnippet endpoint='POST /snippets' />

will be rendered as

Response
1[
2 {
3 "type": "python",
4 "sdk": {
5 "package": "vellum-ai",
6 "version": "1.2.1"
7 },
8 "sync_client": "import Vellum from vellum.client\nclient = Vellum(api_key=\"YOUR_API_KEY\")\nclient.search(query=\"Find documents written in the last 5 days\")\n",
9 "async_client": "import VellumAsync from vellum.client\nclient = VellumAsync(api_key=\"YOUR_API_KEY\")\nawait client.search(query=\"Find documents written in the last 5 days\")\n"
10 },
11 {
12 "type": "typescript",
13 "sdk": {
14 "package": "vellum-ai",
15 "version": "1.2.1"
16 },
17 "client": "import { VellumClient } from \"vellum-ai\";\nconst vellum = VellumClient({\n apiKey=\"YOUR_API_KEY\"\n})\nvellum.search({\n query: \"Find documents written in the last 5 days\"\n})\n"
18 }
19]

Reference particular examples

If you want to reference a particular example in the response 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.

2

Reference the example

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

1 <EndpointResponseSnippet
2 endpoint="GET /pet/{petId}"
3 example="ExampleWithMarkley"
4 />