curl --request GET \
--url https://api.cnap.tech/v1/snippets/{id} \
--header 'Authorization: Bearer <token>'{
"id": "j572abc123def456",
"name": "Cluster Resource Audit",
"description": "Checks resource requests and limits",
"code": "async () => { ... }",
"display_type": "table",
"workspace_id": "j572abc123def456",
"created_by": "<string>",
"created_at": 123
}Returns a snippet including its code and display type.
curl --request GET \
--url https://api.cnap.tech/v1/snippets/{id} \
--header 'Authorization: Bearer <token>'{
"id": "j572abc123def456",
"name": "Cluster Resource Audit",
"description": "Checks resource requests and limits",
"code": "async () => { ... }",
"display_type": "table",
"workspace_id": "j572abc123def456",
"created_by": "<string>",
"created_at": 123
}Personal Access Token (cnap_pat_...) or OAuth2 JWT. Create tokens at https://cnap.tech/account/tokens
Snippet ID
Snippet details
"j572abc123def456"
"Cluster Resource Audit"
"Checks resource requests and limits"
Async JavaScript function body executed in a sandboxed V8 isolate. Has access to cnap.request() for API calls.
"async () => { ... }"
Controls how the snippet result is rendered in dashboard widgets
table, stat, json, logs "table"
"j572abc123def456"
User ID of the snippet creator
Unix timestamp (seconds)