Snippets

Get snippet for endpoint

Beta
POST
Get snippet by endpoint method and path

Request

This endpoint expects an object.
endpoint
objectRequired
orgId
stringOptional
If the same API is defined across multiple organization, you must specify an organization ID.
apiId
stringOptional
If you have more than one API, you must specify its ID.
sdks
list of unionsOptional
The SDKs for which to load snippets. If unspecified, snippets for the latest published SDKs will be returned.
payload
objectOptional
The JSON payload to be used as the input for the code snippet. This should just be thought of as the request body you'd be sending to the endpoint as a cURL. If not specified then the default payload will be used.

Response

This endpoint returns a list of unions
TypeScript
OR
Python
OR
Java
OR
Go
OR
Ruby
POST
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}'
200Successful
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]