Components

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 "async_client": "import VellumAsync from vellum.client\n\nclient = VellumAsync(api_key=\"YOUR_API_KEY\")\nawait client.search(query=\"Find documents written in the last 5 days\")\n",
5 "sdk": {
6 "package": "vellum-ai",
7 "version": "1.2.1"
8 },
9 "sync_client": "import Vellum from vellum.client\n\nclient = Vellum(api_key=\"YOUR_API_KEY\")\nclient.search(query=\"Find documents written in the last 5 days\")\n"
10 },
11 {
12 "type": "typescript",
13 "client": "import { VellumClient } from \"vellum-ai\";\n\nconst vellum = VellumClient({\n apiKey=\"YOUR_API_KEY\"\n})\nvellum.search({\n query: \"Find documents written in the last 5 days\"\n})\n",
14 "sdk": {
15 "package": "vellum-ai",
16 "version": "1.2.1"
17 }
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:

Define named examples

The highlighed lines show how to set the example name.

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 />