> ## 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.

# Upload file

> Upload a file and sync it to running computers.

Uploads a file to a workspace, optionally associated with a specific computer.

## Request

Send a `multipart/form-data` request with the file and workspace information:

<ParamField body="file" type="file" required>
  File to upload. Maximum size: 10MB.
</ParamField>

<ParamField body="projectId" type="string" required>
  Workspace ID to upload the file to.
</ParamField>

<ParamField body="desktopId" type="string">
  Optional computer ID to associate the file with.
</ParamField>

## Response

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

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://www.orgo.ai/api/files/upload \
    -H "Authorization: Bearer $ORGO_API_KEY" \
    -F "file=@./document.pdf" \
    -F "projectId=550e8400-e29b-41d4-a716-446655440000" \
    -F "desktopId=a3bb189e-8bf9-3888-9912-ace4e6543002"
  ```

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

  with open("document.pdf", "rb") as f:
      response = requests.post(
          "https://www.orgo.ai/api/files/upload",
          headers={"Authorization": f"Bearer {api_key}"},
          files={"file": f},
          data={
              "projectId": workspace_id,
              "desktopId": computer_id  # optional
          }
      )

  file_info = response.json()["file"]
  print(f"Uploaded: {file_info['filename']}")
  ```

  ```javascript JavaScript theme={null}
  const formData = new FormData();
  formData.append('file', fileBlob, 'document.pdf');
  formData.append('projectId', workspaceId);
  formData.append('desktopId', computerId); // optional

  const response = await fetch('https://www.orgo.ai/api/files/upload', {
    method: 'POST',
    headers: { 'Authorization': `Bearer ${apiKey}` },
    body: formData
  });

  const { file } = await response.json();
  console.log(`Uploaded: ${file.filename}`);
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "file": {
    "id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
    "filename": "document.pdf",
    "size_bytes": 102400,
    "content_type": "application/pdf",
    "created_at": "2024-01-15T10:30:00Z"
  }
}
```

<Info>
  Uploaded files are stored in the workspace and can be accessed by all computers in that workspace.
</Info>


## OpenAPI

````yaml POST /files/upload
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/upload:
    post:
      tags:
        - Files
      summary: Upload file
      description: Uploads a file to a workspace. Maximum file size is 10MB.
      operationId: uploadFile
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
                - projectId
              properties:
                file:
                  type: string
                  format: binary
                  description: File to upload (max 10MB)
                projectId:
                  type: string
                  description: Workspace ID
                desktopId:
                  type: string
                  description: Optional computer ID to associate the file with
      responses:
        '200':
          description: File uploaded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FileUploadResponse'
        '400':
          description: File too large or missing
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
components:
  schemas:
    FileUploadResponse:
      type: object
      properties:
        file:
          $ref: '#/components/schemas/File'
    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

````