Snippets

Get snippet for endpoint

Beta
POST
https://api.buildwithfern.com/snippets

Get snippet by endpoint method and path

Request

This endpoint expects an object.
endpoint
object
orgId
optional string

If the same API is defined across multiple organization, you must specify an organization ID.

apiId
optional string

If you have more than one API, you must specify its ID.

sdks
optional list of unions

The SDKs for which to load snippets. If unspecified, snippets for the latest published SDKs will be returned.

loadLevel
optional enum

The level of detail to load for the snippet. If unspecified, the full snippet will be returned.

Allowed values: fullendpoint

Response

This endpoint return a list of unions.
Typescript
OR
Python
OR
Java
OR
Go
POST
/snippets
1
2
3
4
5
6
7
8
9
curl -X POST "https://api.buildwithfern.com/snippets" \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "endpoint": {
    "method": "GET",
    "path": "/v1/search"
  }
}'
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
[
  {
    "type": "python",
    "sdk": {
      "package": "vellum-ai",
      "version": "1.2.1"
    },
    "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",
    "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"
  },
  {
    "type": "typescript",
    "sdk": {
      "package": "vellum-ai",
      "version": "1.2.1"
    },
    "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"
  }
]