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

# Update a volume



## OpenAPI

````yaml /api-reference/openapi.personal.json patch /v1/orgs/{slug}/volumes/{id}
openapi: 3.1.0
info:
  title: Personal token API
  description: User-scoped API for account and organization management.
  version: 0.1.0
servers:
  - url: https://api.microsandbox.dev
security:
  - bearer: []
paths:
  /v1/orgs/{slug}/volumes/{id}:
    patch:
      tags:
        - Volumes
      summary: Update a volume
      operationId: update_volume
      parameters:
        - name: slug
          in: path
          description: Organization slug
          required: true
          schema:
            type: string
        - name: id
          in: path
          description: Volume id
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateVolumeRequest'
        required: true
      responses:
        '200':
          description: Volume updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VolumeResponse'
        '400':
          description: Invalid request (e.g. cap exceeds the org cap)
        '401':
          description: Unauthorized
        '403':
          description: Insufficient permissions
        '404':
          description: Volume not found
        '409':
          description: The host volume cannot be capped
      security:
        - bearer: []
components:
  schemas:
    UpdateVolumeRequest:
      type: object
      description: >-
        PATCH /v1/orgs/{slug}/volumes/{id} - update the cap and/or labels
        (#496).


        Every field is independently optional: an **omitted** field is left
        unchanged.

        `capacity_gib` uses the double-`Option` distinction - omit to leave
        as-is,

        explicit `null` to clear the cap, a number to set it.
      properties:
        capacity_gib:
          type:
            - integer
            - 'null'
          format: int32
          description: >-
            New per-volume storage cap in GiB. Omitted = unchanged; `null` =
            clear the

            cap (back to no per-volume limit); a value sets it. A set value must
            be

            `>= 1` and `<= the org's storage cap`.
          minimum: 0
        labels:
          type:
            - object
            - 'null'
          description: >-
            Replacement label set. Omitted = unchanged; an object replaces the
            labels

            wholesale (an empty object clears them). Reserved-prefix keys are
            rejected.
          additionalProperties:
            type: string
          propertyNames:
            type: string
    VolumeResponse:
      type: object
      description: Volume details and usage.
      required:
        - id
        - kind
        - storage
        - status
        - labels
        - created_at
        - updated_at
      properties:
        capacity_bytes:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            The volume's configured per-volume storage cap in bytes, or `null`
            when

            no cap is set (#496). Derived from the stored `capacity_gib` (the
            user's

            configured intent) - the effective ceiling is `min(this, org cap)`.
          minimum: 0
        created_at:
          type: string
          format: date-time
        id:
          type: string
          format: uuid
        kind:
          $ref: '#/components/schemas/VolumeKind'
          description: |-
            `host` - the org's shared host disk (not deletable); `managed` - a
            user-created named volume.
        labels:
          type: object
          description: User-defined labels (empty object when none set).
          additionalProperties:
            type: string
          propertyNames:
            type: string
        name:
          type:
            - string
            - 'null'
          description: |-
            User-facing name. `null` for the host volume (it has no name; it's
            identified by `kind`).
        status:
          $ref: '#/components/schemas/VolumeStatus'
        storage:
          $ref: '#/components/schemas/VolumeType'
          description: How the volume is physically backed (`block` today).
        updated_at:
          type: string
          format: date-time
        used_bytes:
          type:
            - integer
            - 'null'
          format: int64
          description: >-
            Bytes currently used under this volume's subtree. `null` when usage
            is

            unavailable - the usage service is disabled or unreachable (list
            degrades

            gracefully rather than failing) - or on create/delete, which don't
            sample

            it.
          minimum: 0
    VolumeKind:
      type: string
      description: >-
        Volume role: the organization's shared host volume or a named managed
        volume.
      enum:
        - host
        - managed
    VolumeStatus:
      type: string
      description: Lifecycle status of a volume.
      enum:
        - active
        - deleting
    VolumeType:
      type: string
      description: >-
        How a volume is physically backed - distinct from [`VolumeKind`]
        (ownership).

        Every volume is `Block` today; the enum exists so future backings can be
        added

        (and reported to the SDK) without another schema change.
      enum:
        - block
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        Personal access token (msb_pat_…) or session JWT - the credential an
        agent acts with on a user's behalf.

````