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

# Sync Volume Endpoint

> Sync one attached volume of a running VM sandbox to its committed head.

Read-only and discard syncs unmount and re-attach without publishing. A
read-write sync unmounts, publishes this sandbox's own writes if the
unmount reports dirty blocks and waits for their merge, then
re-attaches. Poll the sync GET until ``state`` is DONE or FAILED.



## OpenAPI

````yaml https://api.primeintellect.ai/api/v1/sandbox/openapi.json post /api/v1/sandbox/{sandbox_id}/volumes/{name}/sync
openapi: 3.1.0
info:
  title: PI API
  version: 0.1.0
servers:
  - url: https://api.primeintellect.ai
security: []
paths:
  /api/v1/sandbox/{sandbox_id}/volumes/{name}/sync:
    post:
      tags:
        - Sandbox Volumes
      summary: Sync Volume Endpoint
      description: |-
        Sync one attached volume of a running VM sandbox to its committed head.

        Read-only and discard syncs unmount and re-attach without publishing. A
        read-write sync unmounts, publishes this sandbox's own writes if the
        unmount reports dirty blocks and waits for their merge, then
        re-attaches. Poll the sync GET until ``state`` is DONE or FAILED.
      operationId: >-
        sync_volume_endpoint_api_v1_sandbox__sandbox_id__volumes__name__sync_post
      parameters:
        - name: sandbox_id
          in: path
          required: true
          schema:
            type: string
            title: Sandbox Id
        - name: name
          in: path
          required: true
          schema:
            type: string
            title: Name
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VolumeSyncRequest'
              default:
                discard: false
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VolumeSyncResponse'
        '401':
          description: Authorization failed
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    VolumeSyncRequest:
      properties:
        discard:
          type: boolean
          title: Discard
          description: >-
            Drop this sandbox's unpublished volume writes and re-attach at the
            committed head without publishing.
          default: false
      type: object
      title: VolumeSyncRequest
      description: Body of POST /api/v1/sandbox/{sandbox_id}/volumes/{name}/sync.
    VolumeSyncResponse:
      properties:
        sync_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Sync Id
        state:
          anyOf:
            - type: string
            - type: 'null'
          title: State
        head_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Head Id
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
        failure:
          anyOf:
            - type: string
            - type: 'null'
          title: Failure
      type: object
      title: VolumeSyncResponse
      description: >-
        One attachment's sync state machine row.


        state is null before the first sync; head_id is the attachment's

        current head (the synced head once state is DONE); updated_at is the

        last transition time. failure says why the sync failed (BUSY,

        PUBLISH_FAILED, MERGE_FAILED, DEADLINE, NODE_ERROR or ROLLBACK_FAILED);
        it

        is set from the moment the sync starts rolling back and stays set when
        the

        sandbox itself leaves RUNNING mid-rollback.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````