Create snippet
Snippets
Create snippet
Creates a reusable code snippet in the workspace. Snippets are async JavaScript functions executed in a sandboxed V8 isolate with access to cnap.request() for API calls.
POST
Create snippet
Documentation Index
Fetch the complete documentation index at: https://docs.cnap.tech/llms.txt
Use this file to discover all available pages before exploring further.
Authorizations
Personal Access Token (cnap_pat_...) or OAuth2 JWT. Create tokens at https://cnap.tech/account/tokens
Body
application/json
Required string length:
1 - 100Example:
"Cluster Resource Audit"
Async JavaScript function body. Executed in a sandboxed V8 isolate with access to cnap.request().
Required string length:
1 - 50000Controls how the snippet result is rendered in dashboard widgets
Available options:
table, stat, json, logs Optional human-readable description
Maximum string length:
500Response
Snippet created