Create snippet
Snippets
Create snippet
Creates a reusable code snippet in the workspace. Snippets are async JavaScript functions executed in a sandboxed runtime with access to platform.request() for API calls.
POST
Create snippet
Authorizations
workspace API token (sk_akua_...) or OAuth2 JWT. Create tokens at https://akua.dev/developers/api-tokens
Body
application/json
Required string length:
1 - 100Example:
"Cluster Resource Audit"
Async JavaScript function body. Executed in a sandboxed runtime with access to platform.request().
Required string length:
1 - 50000Controls how the snippet result is rendered in dashboard widgets
Available options:
table, stat, json, logs, timeseries Optional human-readable description
Maximum string length:
500Whether the snippet is reusable workspace state or scoped to an agent session.
Available options:
workspace, session Who authored the snippet descriptor.
Available options:
user, agent, system Required string length:
1 - 54Required string length:
1 - 54Available options:
general, prepared_action, reactive_read, widget Response
Snippet created