Skip to main content
POST
Create snippet

Authorizations

Authorization
string
header
required

Personal Access Token (cnap_pat_...) or OAuth2 JWT. Create tokens at https://cnap.tech/account/tokens

Body

application/json
name
string
required
Required string length: 1 - 100
Example:

"Cluster Resource Audit"

code
string
required

Async JavaScript function body. Executed in a sandboxed V8 isolate with access to cnap.request().

Required string length: 1 - 50000
display_type
enum<string>
required

Controls how the snippet result is rendered in dashboard widgets

Available options:
table,
stat,
json,
logs
description
string

Optional human-readable description

Maximum string length: 500

Response

Snippet created

snippet_id
string
required