For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Slack communityLog inBook a demo
  • CLI Reference
    • Get Started with Fern CLI
    • Global Options
    • Commands
    • Changelog
  • API Reference
    • Overview
      • POSTGet snippet for endpoint
      • POSTLoad all snippets
LogoLogo
Slack communityLog inBook a demo
API ReferenceSnippets

Get snippet for endpoint

Beta
POST
https://api.buildwithfern.com/snippets
POST
/snippets
$curl -X POST https://api.buildwithfern.com/snippets \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "endpoint": {
> "path": "/v1/search",
> "method": "GET"
> }
>}'
1[
2 {
3 "type": "python",
4 "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",
5 "sdk": {
6 "package": "vellum-ai",
7 "version": "1.2.1"
8 },
9 "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"
10 },
11 {
12 "type": "typescript",
13 "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",
14 "sdk": {
15 "package": "vellum-ai",
16 "version": "1.2.1"
17 }
18 }
19]
Get snippet by endpoint method and path
Was this page helpful?
Previous

Load all snippets

Next
Built with

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
endpointobjectRequired
orgIdstringOptional
If the same API is defined across multiple organization, you must specify an organization ID.
apiIdstringOptional
If you have more than one API, you must specify its ID.
sdkslist of objectsOptional
The SDKs for which to load snippets. If unspecified, snippets for the latest published SDKs will be returned.
exampleIdentifierstringOptional
The identifier of the example to fetch the snippet for, this is ignored if a payload is passed in.
payloadobjectOptional
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 objects.
typescriptobject
OR
pythonobject
OR
javaobject
OR
goobject
OR
rubyobject

Errors

400
API ID Required Error
400
Org ID Required Error
401
Unauthorized Error
403
User Not IN Org Error
404
Endpoint Not Found
404
Org ID Not Found
404
Org ID and API ID Not Found
404
Sdknot Found
503
Unavailable Error