> ## Documentation Index
> Fetch the complete documentation index at: https://docs.akua.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Update snippet

> Updates snippet properties. Only provided fields are changed. Dashboards using this snippet will pick up code changes on next run.



## OpenAPI

````yaml /openapi-public.json patch /snippets/{id}
openapi: 3.1.0
info:
  title: Akua API
  version: 1.0.0
  description: >-
    Public API for managing Akua workspaces, clusters, products, and installs.


    Authenticate with a workspace API token via the `Authorization: Bearer
    sk_akua_...` header.


    A workspace-owned token implies its workspace. Broad tokens select the
    active workspace via the optional `Akua-Context` header.
  contact:
    name: Akua API support
    email: support@akua.dev
    url: https://akua.dev/docs
servers:
  - url: https://api.akua.dev/v1
    description: Production
security: []
tags:
  - name: Auth
    description: Authentication and token management.
  - name: Agent events
    description: Persisted agent transcripts and response recovery.
  - name: Custom domains
    description: Workspace custom domains and routing targets.
  - name: Cloudflare
    description: Cloudflare account credentials and gateway control.
  - name: Clusters
    description: Kubernetes clusters and cluster access operations.
  - name: ComputeConfigs
    description: Workspace compute provider configurations.
  - name: Entitlements
    description: Effective workspace capabilities and limits.
  - name: Dashboards
    description: Dashboard and widget resources.
  - name: Installs
    description: Installation and render operations.
  - name: Machines
    description: Compute machines and lifecycle events.
  - name: Notifications
    description: User notification state.
  - name: Offer Channels
    description: Private offer channels and policy versions.
  - name: Offers
    description: Marketplace offers and redemption tracking.
  - name: Operations
    description: Long-running operation status and controls.
  - name: Order Drafts
    description: Draft checkout orders and checkout sessions.
  - name: Organizations
    description: Organizations, memberships, and managed workspaces.
  - name: Packages
    description: Software packages, versions, and input schemas.
  - name: Products
    description: Marketplace product catalog resources.
  - name: Preview hostnames
    description: Install preview hostnames and routing state.
  - name: Quotas
    description: Workspace quota limits and usage.
  - name: Regions
    description: Available deployment regions.
  - name: Registry
    description: Container registry credentials and repositories.
  - name: Repository change requests
    description: Fork-backed repository change reviews and lifecycle actions.
  - name: Repositories
    description: Source repositories available to the workspace.
  - name: Secrets
    description: Workspace secrets and secret versions.
  - name: Snippets
    description: Reusable snippets and snippet runs.
  - name: Workspace subdomains
    description: Workspace subdomain identity.
  - name: Workspaces
    description: Workspace resources, members, and billing state.
paths:
  /snippets/{id}:
    patch:
      tags:
        - Snippets
      summary: Update snippet
      description: >-
        Updates snippet properties. Only provided fields are changed. Dashboards
        using this snippet will pick up code changes on next run.
      operationId: snippets.update
      parameters:
        - name: id
          in: path
          schema:
            type: string
            description: Snippet ID
            minLength: 1
            maxLength: 54
          required: true
        - name: if-match
          in: header
          schema:
            type: string
            minLength: 1
            maxLength: 256
            description: >-
              The `etag` of the resource version the client last read. Required
              on writes when the resource exposes an `etag` field. Mismatch
              returns 409 `ABORTED` with the current etag in the error metadata.
            examples:
              - '42'
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSnippetBody'
      responses:
        '200':
          description: Snippet updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  snippet_id:
                    type: string
                required:
                  - snippet_id
                additionalProperties: false
        '401':
          description: Missing, invalid or expired credential.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiUnauthorized'
        '404':
          description: The resource was not found in this workspace.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiNotFound'
        '409':
          description: >-
            The request conflicts with existing resource state or immutable
            intent. | The resource changed since the etag the client sent; the
            current etag is in the metadata.
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/ApiConflict'
                  - $ref: '#/components/schemas/ApiPreconditionFailed'
      security:
        - BearerAuth: []
components:
  schemas:
    UpdateSnippetBody:
      oneOf:
        - type: object
          properties:
            name:
              type: string
              minLength: 1
              maxLength: 100
            description:
              type: string
              maxLength: 500
            code:
              type: string
              minLength: 1
              maxLength: 50000
            display_type:
              type: string
              enum:
                - table
                - stat
                - json
                - logs
                - timeseries
              description: Controls how the snippet result is rendered in dashboard widgets
            inputs:
              type: array
              items:
                oneOf:
                  - type: object
                    properties:
                      key:
                        type: string
                        pattern: ^[a-z][a-z0-9_]{0,31}$
                      label:
                        type: string
                        minLength: 1
                        maxLength: 100
                      description:
                        type: string
                        maxLength: 500
                      required:
                        type: boolean
                      kind:
                        type: string
                        enum:
                          - time_range
                      default:
                        type: object
                        properties:
                          from:
                            type: integer
                          to:
                            type: integer
                        required:
                          - from
                          - to
                        additionalProperties: false
                    required:
                      - key
                      - label
                      - kind
                    additionalProperties: false
                  - type: object
                    properties:
                      key:
                        type: string
                        pattern: ^[a-z][a-z0-9_]{0,31}$
                      label:
                        type: string
                        minLength: 1
                        maxLength: 100
                      description:
                        type: string
                        maxLength: 500
                      required:
                        type: boolean
                      kind:
                        type: string
                        enum:
                          - resource
                      resource:
                        type: string
                        enum:
                          - cluster
                          - install
                          - product
                          - package
                          - region
                      default:
                        anyOf:
                          - type: string
                            maxLength: 255
                          - type: array
                            items:
                              type: string
                              maxLength: 255
                            minItems: 1
                            maxItems: 100
                      multiple:
                        type: boolean
                    required:
                      - key
                      - label
                      - kind
                      - resource
                    additionalProperties: false
                  - type: object
                    properties:
                      key:
                        type: string
                        pattern: ^[a-z][a-z0-9_]{0,31}$
                      label:
                        type: string
                        minLength: 1
                        maxLength: 100
                      description:
                        type: string
                        maxLength: 500
                      required:
                        type: boolean
                      kind:
                        type: string
                        enum:
                          - enum
                      options:
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 100
                        minItems: 1
                        maxItems: 100
                      default:
                        type: string
                        minLength: 1
                        maxLength: 100
                    required:
                      - key
                      - label
                      - kind
                      - options
                    additionalProperties: false
                  - type: object
                    properties:
                      key:
                        type: string
                        pattern: ^[a-z][a-z0-9_]{0,31}$
                      label:
                        type: string
                        minLength: 1
                        maxLength: 100
                      description:
                        type: string
                        maxLength: 500
                      required:
                        type: boolean
                      kind:
                        type: string
                        enum:
                          - boolean
                      default:
                        type: boolean
                    required:
                      - key
                      - label
                      - kind
                    additionalProperties: false
                  - type: object
                    properties:
                      key:
                        type: string
                        pattern: ^[a-z][a-z0-9_]{0,31}$
                      label:
                        type: string
                        minLength: 1
                        maxLength: 100
                      description:
                        type: string
                        maxLength: 500
                      required:
                        type: boolean
                      kind:
                        type: string
                        enum:
                          - number
                      min:
                        type: number
                      max:
                        type: number
                      default:
                        type: number
                    required:
                      - key
                      - label
                      - kind
                    additionalProperties: false
                  - type: object
                    properties:
                      key:
                        type: string
                        pattern: ^[a-z][a-z0-9_]{0,31}$
                      label:
                        type: string
                        minLength: 1
                        maxLength: 100
                      description:
                        type: string
                        maxLength: 500
                      required:
                        type: boolean
                      kind:
                        type: string
                        enum:
                          - text
                      default:
                        type: string
                        maxLength: 500
                      max_length:
                        type: integer
                        minimum: 1
                        maximum: 500
                    required:
                      - key
                      - label
                      - kind
                    additionalProperties: false
              maxItems: 16
            visibility:
              type: string
              enum:
                - workspace
                - session
              description: >-
                Whether the snippet is reusable workspace state or scoped to an
                agent session.
            purpose:
              type: string
              enum:
                - general
                - prepared_action
                - reactive_read
                - widget
            result_type:
              type: string
              enum:
                - scalar
                - timeseries
                - categorical
                - table
                - status_list
                - logs
                - json
            default_visualization:
              type: string
              enum:
                - stat
                - sparkline
                - line
                - area
                - bar
                - donut
                - table
                - status_list
                - logs
                - json
          additionalProperties: false
        - type: object
          properties:
            name:
              type: string
              minLength: 1
              maxLength: 100
            description:
              type: string
              maxLength: 500
            code:
              type: string
              minLength: 1
              maxLength: 50000
            display_type:
              type: string
              enum:
                - table
                - stat
                - json
                - logs
                - timeseries
              description: Controls how the snippet result is rendered in dashboard widgets
            inputs:
              type: array
              items:
                oneOf:
                  - type: object
                    properties:
                      key:
                        type: string
                        pattern: ^[a-z][a-z0-9_]{0,31}$
                      label:
                        type: string
                        minLength: 1
                        maxLength: 100
                      description:
                        type: string
                        maxLength: 500
                      required:
                        type: boolean
                      kind:
                        type: string
                        enum:
                          - time_range
                      default:
                        type: object
                        properties:
                          from:
                            type: integer
                          to:
                            type: integer
                        required:
                          - from
                          - to
                        additionalProperties: false
                    required:
                      - key
                      - label
                      - kind
                    additionalProperties: false
                  - type: object
                    properties:
                      key:
                        type: string
                        pattern: ^[a-z][a-z0-9_]{0,31}$
                      label:
                        type: string
                        minLength: 1
                        maxLength: 100
                      description:
                        type: string
                        maxLength: 500
                      required:
                        type: boolean
                      kind:
                        type: string
                        enum:
                          - resource
                      resource:
                        type: string
                        enum:
                          - cluster
                          - install
                          - product
                          - package
                          - region
                      default:
                        anyOf:
                          - type: string
                            maxLength: 255
                          - type: array
                            items:
                              type: string
                              maxLength: 255
                            minItems: 1
                            maxItems: 100
                      multiple:
                        type: boolean
                    required:
                      - key
                      - label
                      - kind
                      - resource
                    additionalProperties: false
                  - type: object
                    properties:
                      key:
                        type: string
                        pattern: ^[a-z][a-z0-9_]{0,31}$
                      label:
                        type: string
                        minLength: 1
                        maxLength: 100
                      description:
                        type: string
                        maxLength: 500
                      required:
                        type: boolean
                      kind:
                        type: string
                        enum:
                          - enum
                      options:
                        type: array
                        items:
                          type: string
                          minLength: 1
                          maxLength: 100
                        minItems: 1
                        maxItems: 100
                      default:
                        type: string
                        minLength: 1
                        maxLength: 100
                    required:
                      - key
                      - label
                      - kind
                      - options
                    additionalProperties: false
                  - type: object
                    properties:
                      key:
                        type: string
                        pattern: ^[a-z][a-z0-9_]{0,31}$
                      label:
                        type: string
                        minLength: 1
                        maxLength: 100
                      description:
                        type: string
                        maxLength: 500
                      required:
                        type: boolean
                      kind:
                        type: string
                        enum:
                          - boolean
                      default:
                        type: boolean
                    required:
                      - key
                      - label
                      - kind
                    additionalProperties: false
                  - type: object
                    properties:
                      key:
                        type: string
                        pattern: ^[a-z][a-z0-9_]{0,31}$
                      label:
                        type: string
                        minLength: 1
                        maxLength: 100
                      description:
                        type: string
                        maxLength: 500
                      required:
                        type: boolean
                      kind:
                        type: string
                        enum:
                          - number
                      min:
                        type: number
                      max:
                        type: number
                      default:
                        type: number
                    required:
                      - key
                      - label
                      - kind
                    additionalProperties: false
                  - type: object
                    properties:
                      key:
                        type: string
                        pattern: ^[a-z][a-z0-9_]{0,31}$
                      label:
                        type: string
                        minLength: 1
                        maxLength: 100
                      description:
                        type: string
                        maxLength: 500
                      required:
                        type: boolean
                      kind:
                        type: string
                        enum:
                          - text
                      default:
                        type: string
                        maxLength: 500
                      max_length:
                        type: integer
                        minimum: 1
                        maximum: 500
                    required:
                      - key
                      - label
                      - kind
                    additionalProperties: false
              maxItems: 16
            visibility:
              type: string
              enum:
                - workspace
                - session
              description: >-
                Whether the snippet is reusable workspace state or scoped to an
                agent session.
            purpose:
              type: string
              enum:
                - general
                - prepared_action
                - reactive_read
                - widget
            result_contract_version:
              type: number
              enum:
                - 1
            result_type:
              type: string
              enum:
                - scalar
                - timeseries
                - categorical
                - table
                - status_list
                - logs
                - json
            default_visualization:
              type: string
              enum:
                - stat
                - sparkline
                - line
                - area
                - bar
                - donut
                - table
                - status_list
                - logs
                - json
          required:
            - result_contract_version
            - result_type
            - default_visualization
          additionalProperties: false
      x-platform-exact-union: true
    ApiUnauthorized:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - Unauthorized
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - $ref: '#/components/schemas/ApiErrorEntry'
          minItems: 1
          items:
            $ref: '#/components/schemas/ApiErrorEntry'
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiNotFound:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - NotFound
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - $ref: '#/components/schemas/ApiErrorEntry'
          minItems: 1
          items:
            $ref: '#/components/schemas/ApiErrorEntry'
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiConflict:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - Conflict
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - $ref: '#/components/schemas/ApiErrorEntry'
          minItems: 1
          items:
            $ref: '#/components/schemas/ApiErrorEntry'
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiPreconditionFailed:
      type: object
      properties:
        _tag:
          type: string
          enum:
            - PreconditionFailed
        success:
          type: boolean
          enum:
            - false
        errors:
          type: array
          prefixItems:
            - type: object
              properties:
                code:
                  type: number
                  enum:
                    - 7006
                message:
                  type: string
                metadata:
                  type: object
                  properties:
                    current_etag:
                      type: string
                  required:
                    - current_etag
                  allOf:
                    - type: object
                      additionalProperties:
                        type: string
              required:
                - code
                - message
                - metadata
              additionalProperties: false
          maxItems: 1
          minItems: 1
        result:
          type: object
          additionalProperties: false
      required:
        - _tag
        - success
        - errors
        - result
      additionalProperties: false
    ApiErrorEntry:
      type: object
      properties:
        code:
          type: integer
          description: Machine-readable error code
          examples:
            - 7002
        message:
          type: string
          description: Human-readable error message
          examples:
            - Resource not found
        path:
          type: array
          items:
            type: string
          description: Field path that caused the error, when applicable
          examples:
            - - body
              - name
        metadata:
          type: object
          additionalProperties:
            type: string
      required:
        - code
        - message
      additionalProperties: false
  securitySchemes:
    BearerAuth:
      description: >-
        workspace API token (sk_akua_...) or OAuth2 JWT. Create tokens at
        https://akua.dev/developers/api-tokens
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.