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

# File

> Download a file from the VM's file system

Downloads a file from the VM's file system. Use this to retrieve files created or modified during agent tasks.

<Note>
  Replace `VM_API_IP:PORT` with the actual IP and port of the VM's Desktop Environment API server.
</Note>

## Request Body

<ParamField body="path" type="string" required>
  Full path to the file in the VM's file system
</ParamField>

## Response

Returns binary file content. Save the response directly to a local file.

<ResponseField name="[binary]" type="binary">
  Binary content of the requested file
</ResponseField>

<RequestExample>
  ```bash Download Document (Linux/macOS) theme={null}
  curl -X POST "http://VM_API_IP:PORT/file" \
    -H "Content-Type: application/json" \
    -d '{"path": "/home/user/Documents/Final_Report.docx"}' \
    --output Final_Report.docx
  ```

  ```bash Download Document (Windows) theme={null}
  curl -X POST "http://VM_API_IP:PORT/file" \
    -H "Content-Type: application/json" \
    -d '{"path": "C:\\Users\\user\\Documents\\Report.xlsx"}' \
    --output Report.xlsx
  ```

  ```bash Download Image theme={null}
  curl -X POST "http://VM_API_IP:PORT/file" \
    -H "Content-Type: application/json" \
    -d '{"path": "/home/user/Pictures/diagram.png"}' \
    --output diagram.png
  ```
</RequestExample>

<ResponseExample>
  ```text Success Response theme={null}
  [Binary file content - save to file]
  ```

  ```json Error Response theme={null}
  {
    "error": "File not found: /home/user/Documents/nonexistent.docx"
  }
  ```
</ResponseExample>
