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

# Export file

> Export a file from a computer to cloud storage.

Exports a file from a computer's filesystem and returns a download URL.

<Info>
  The computer must be running to export files.
</Info>

## Request

<ParamField body="desktopId" type="string" required>
  Computer ID to export from.
</ParamField>

<ParamField body="path" type="string" required>
  Path to the file on the computer.
</ParamField>

### Path formats

| Format           | Example                          |
| ---------------- | -------------------------------- |
| Relative to home | `Desktop/results.txt`            |
| Absolute path    | `/home/user/Desktop/results.txt` |
| With tilde       | `~/Desktop/results.txt`          |

## Response

<ResponseField name="success" type="boolean">
  `true` if export succeeded.
</ResponseField>

<ResponseField name="file" type="object">
  The exported file object.
</ResponseField>

<ResponseField name="url" type="string">
  Signed download URL (expires in 1 hour).
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://www.orgo.ai/api/files/export \
    -H "Authorization: Bearer $ORGO_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "desktopId": "a3bb189e-8bf9-3888-9912-ace4e6543002",
      "path": "Desktop/results.txt"
    }'
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
      "https://www.orgo.ai/api/files/export",
      headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
      json={
          "desktopId": computer_id,
          "path": "Desktop/results.txt"
      }
  )

  result = response.json()
  print(f"Download URL: {result['url']}")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://www.orgo.ai/api/files/export', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${apiKey}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      desktopId: computerId,
      path: 'Desktop/results.txt'
    })
  });

  const { url } = await response.json();
  console.log(`Download URL: ${url}`);
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "success": true,
  "file": {
    "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "filename": "results.txt",
    "size_bytes": 1024,
    "content_type": "text/plain",
    "created_at": "2024-01-15T10:30:00Z"
  },
  "url": "https://storage.example.com/files/..."
}
```

<Warning>
  Files can only be exported from within `/home/user`. Paths outside this directory return a 403 error.
</Warning>


## OpenAPI

````yaml POST /files/export
openapi: 3.1.0
info:
  title: Orgo API
  description: >-
    Launch cloud computers that AI agents can control and interact with. Create
    workspaces, provision computers, and control them programmatically.
  version: 2.0.0
  contact:
    name: Orgo Support
    email: spencer@orgo.ai
    url: https://orgo.ai
servers:
  - url: https://www.orgo.ai/api
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Workspaces
    description: Organize computers into named workspaces
  - name: Computers
    description: Provision and manage virtual computers
  - name: Computer Lifecycle
    description: Start, stop, and restart computers
  - name: Computer Actions
    description: Control mouse, keyboard, and execute commands
  - name: Streaming
    description: Stream computer display via RTMP
  - name: Files
    description: Upload and download files
  - name: Templates
    description: Author, build, and launch reproducible computers from templates
paths:
  /files/export:
    post:
      tags:
        - Files
      summary: Export file
      description: >-
        Exports a file from the computer's filesystem and returns a download
        URL.
      operationId: exportFile
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FileExportRequest'
            example:
              desktopId: a3bb189e-8bf9-3888-9912-ace4e6543002
              path: Desktop/results.txt
      responses:
        '200':
          description: File exported
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileExportResponse'
        '400':
          description: Computer not running or invalid path
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    FileExportRequest:
      type: object
      required:
        - desktopId
        - path
      properties:
        desktopId:
          type: string
          description: Computer ID
        path:
          type: string
          description: Path to file on computer (e.g., Desktop/results.txt)
    FileExportResponse:
      type: object
      properties:
        success:
          type: boolean
        file:
          $ref: '#/components/schemas/File'
        url:
          type: string
          description: Signed download URL (expires in 1 hour)
    Error:
      type: object
      properties:
        error:
          type: string
          description: Error message
    File:
      type: object
      properties:
        id:
          type: string
          description: File ID
        filename:
          type: string
          description: Original filename
        size_bytes:
          type: integer
          description: File size in bytes
        content_type:
          type: string
          description: MIME type
        created_at:
          type: string
          format: date-time
  responses:
    Unauthorized:
      description: Invalid or missing API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Invalid API key
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: Resource not found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key authentication. Get your key at orgo.ai/workspaces

````