Skip to main content
POST
Create snippet

Authorizations

Authorization
string
header
required

workspace API token (sk_akua_...) or OAuth2 JWT. Create tokens at https://akua.dev/developers/api-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 runtime with access to platform.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,
timeseries
description
string

Optional human-readable description

Maximum string length: 500
visibility
enum<string>

Whether the snippet is reusable workspace state or scoped to an agent session.

Available options:
workspace,
session
origin
enum<string>

Who authored the snippet descriptor.

Available options:
user,
agent,
system
agent_session_id
string
Required string length: 1 - 54
agent_turn_id
string
Required string length: 1 - 54
purpose
enum<string>
Available options:
general,
prepared_action,
reactive_read,
widget

Response

Snippet created

snippet_id
string
required