Snippets

Load all snippets

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

Query parameters

page
optional integer

Request

This endpoint expects an 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 an object.
snippets
map from strings to maps from enums to lists of unions

The snippets are returned as a map of endpoint path (e.g. /api/users) to a map of endpoint method (e.g. POST) to snippets.

next
optional integer

If present, pass this into the page query parameter to load the next page.

POST
/snippets/load
1
2
3
4
5
6
7
8
9
10
11
12
13
14
curl -X POST "https://api.buildwithfern.com/snippets/load" \
     -H "Authorization: Bearer <token>" \
     -H "Content-Type: application/json" \
     -d '{
  "orgId": "vellum",
  "apiId": "vellum-ai",
  "sdks": [
    {
      "type": "python",
      "package": "vellum-ai",
      "version": "1.2.1"
    }
  ]
}'
Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{
  "next": 2,
  "snippets": {
    "/v1/search": {
      "GET": [
        {
          "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 Vellum from vellum.client\n\nclient = Vellum(api_key=\"YOUR_API_KEY\")\nclient.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"
        }
      ]
    },
    "v1/document-indexes": {
      "POST": [
        {
          "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.document_indexes.create(name=\"meeting-reports\", status=\"ACTIVE\")\n",
          "async_client": "import VellumAsync from vellum.client\n\nclient = VellumAsync(api_key=\"YOUR_API_KEY\")\nawait client.document_indexes.create(name=\"meeting-reports\", status=\"ACTIVE\")\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.documentIndexes.create({\n  name: \"meeting-reports\",\n  status: \"ACTIVE\"\n})\n"
        }
      ]
    }
  }
}