← Blog

How to move files in and out of an AI agent's computer on Orgo

Upload inputs, drop a file in one exact folder, send large files in two steps, and export what the agent made.

Updated

Orgo's Files API moves files between your code and the computers your agents use. POST /files/upload sends a file of up to 10 MB to every running computer in a workspace, or to one folder on one computer. POST /files/uploads followed by POST /files/uploads/complete sends a larger file, up to 2 GB, to one computer. POST /files/export copies a file off a computer and returns a link that works for one hour. Large transfers must finish copying within 90 seconds, so files near 2 GB need a fast link.

Every call uses the same API key and base URL as the rest of the API, https://www.orgo.ai/api. Files that pass through workspace storage get a record you can list, download again and delete. Files placed straight into a folder do not.

Which call to use

You want toEndpointSize limitWhere the file landsStored in the workspace?
Give a small file to every running computerPOST /files/upload10 MBThe desktop folder of each running computerYes, with source upload
Put a small file in one folder on one computerPOST /files/upload with destPath10 MBThe folder you name, on one computerNo
Send a large file to one computerPOST /files/uploads, then POST /files/uploads/complete2 GB, copied within 90 sThe folder you name, on one computerNo
Get a file the agent madePOST /files/export2 GB, copied within 90 sWorkspace storage, plus a one-hour linkYes, with source export

The details below come from the Files API reference.

Uploading to every computer in a workspace

Send a multipart/form-data request to POST /files/upload with the file and a workspaceId. A desktopId associates the file with one computer but does not change where it goes (Upload file).

bash
curl -X POST https://www.orgo.ai/api/files/upload \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -F "file=@./document.pdf" \
  -F "workspaceId=$WORKSPACE_ID"
  • The file is stored in the workspace and pushed to the desktop folder of every Linux or Windows computer running at that moment. On Linux that is /root/Desktop.
  • Computers that are stopped, or created later, do not receive it. Upload again to reach them.
  • The push runs in the background and is best effort, so the response does not say whether each computer got the file.
  • Each push sends the workspace's full set of uploaded files. A computer skips a file whose name already exists in its desktop folder rather than overwriting it.

The response is the stored record under file, including the id that the download and delete endpoints take. size_bytes is a decimal string, such as "102400", so parse it before doing arithmetic.

Putting a file in one folder on one computer

Add destPath and desktopId to the same request. The file lands at <destPath>/<file name> on that computer, and nothing else receives it. Use this when an agent expects its input in a particular place, such as a folder its script watches.

bash
curl -X POST https://www.orgo.ai/api/files/upload \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -F "file=@./document.pdf" \
  -F "workspaceId=$WORKSPACE_ID" \
  -F "desktopId=$COMPUTER_ID" \
  -F "destPath=/root/Documents"

The response is {"ok": true, "placedIn": "/root/Documents"}.

  • destPath must be an absolute folder, such as /root/Documents or, on Windows, C:\Users\Public. The value desktop means the desktop folder of the computer's user.
  • A missing folder is created, on Linux and on Windows. A file of the same name is replaced.
  • No file record is created, so the file does not appear in the list and cannot be downloaded or deleted through the API.
  • If the computer does not confirm the write, or the request runs past 130 seconds, the answer is 502. If the computer can't be addressed, it is 503 with "Computer could not be reached." A desktopId that is not in workspaceId also gets that 503, not a 404, so check the pair first.
  • A computer locked for capacity takes no file and returns 402 COMPUTER_LOCKED.

Uploading a file larger than 10 MB

Use the two-step upload, which takes up to 2 GB. The bytes go straight to storage and never pass through Orgo's API (Start large upload, Complete large upload).

  1. Start. POST /files/uploads with desktopId, filename and size_bytes, and optionally destPath. Without destPath, the file lands on the computer's desktop. The answer has an upload_url and an upload_token.
  2. PUT exactly size_bytes bytes to upload_url within 15 minutes.
  3. Complete. POST /files/uploads/complete with the same desktopId and the upload_token. The computer pulls the file into place.
bash
SIZE=$(wc -c < ./dataset.zip | tr -d ' ')
START=$(curl -s -X POST https://www.orgo.ai/api/files/uploads \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"desktopId\": \"$COMPUTER_ID\", \"filename\": \"dataset.zip\", \"size_bytes\": $SIZE, \"destPath\": \"/root/Documents\"}")
 
curl -T ./dataset.zip "$(echo "$START" | jq -r .upload_url)"
 
curl -X POST https://www.orgo.ai/api/files/uploads/complete \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"desktopId\": \"$COMPUTER_ID\", \"upload_token\": \"$(echo "$START" | jq -r .upload_token)\"}"
  • filename is a plain name: no / or \, not . or .., and at most 255 characters.
  • The computer need not be running when you start, but it must be running when you complete. Otherwise the answer is 400 with "Desktop is not running. Start it, then finish the upload."
  • Complete replaces a file of the same name, and creates a missing folder, on Linux and on Windows.
  • The computer pulls the file with a 90 second limit, and returns 502 "Could not place ..." if the copy doesn't finish. 2 GB in 90 seconds needs about 24 MB/s.
  • Start returns upload_url, upload_token, method (PUT), expires_in (900) and next. Complete returns ok, filename, placedIn and size_bytes.
  • The upload_token is valid for one hour, for the same caller and computer only. If placing the file fails, the stored copy is kept, so you can call complete again with the same token.
  • As with a folder upload, the file lands on one computer and no record is written.

Getting a file off the computer

Call POST /files/export with the desktopId and the absolute path of the file. The computer sends it straight to storage, up to 2 GB (Export file).

bash
curl -X POST https://www.orgo.ai/api/files/export \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"desktopId\": \"$COMPUTER_ID\", \"path\": \"/root/Desktop/results.txt\"}"

The answer has the stored file record and a signed url that expires after one hour. The export is recorded in the workspace with source set to export, so you can list it and get a fresh link later.

  • The computer must be running. A stopped one returns 400 with "Desktop is not running".
  • path must be a regular file. A folder returns 404 with "No file at ...", so archive a folder into one file first, for example with tar through the bash endpoint.
  • A file over 2 GB returns 413.
  • The copy to storage must finish within 90 seconds, or the answer is 502 "Could not copy ...". Compress large files when you can.
  • The path must match the computer's OS. A Linux path on a Windows computer, or the reverse, returns 400.

A round trip in Python

This places an input file in a folder on the agent's computer, then exports the agent's output and saves it locally. It follows the upload and export examples in the docs.

python
import os
 
import requests
 
API = "https://www.orgo.ai/api"
headers = {"Authorization": f"Bearer {os.environ['ORGO_API_KEY']}"}
workspace_id = os.environ["WORKSPACE_ID"]
computer_id = os.environ["COMPUTER_ID"]
 
# 1. Put the input in one folder on the agent's computer
with open("leads.csv", "rb") as f:
    placed = requests.post(
        f"{API}/files/upload",
        headers=headers,
        files={"file": f},
        data={
            "workspaceId": workspace_id,
            "desktopId": computer_id,
            "destPath": "/root/Documents",
        },
    )
placed.raise_for_status()
print(placed.json()["placedIn"])
 
# 2. Your agent works on /root/Documents/leads.csv and writes report.csv
 
# 3. Copy the result off the computer and save it
export = requests.post(
    f"{API}/files/export",
    headers=headers,
    json={"desktopId": computer_id, "path": "/root/Documents/report.csv"},
)
export.raise_for_status()
body = export.json()
 
with open("report.csv", "wb") as out:
    out.write(requests.get(body["url"]).content)
 
print("Stored file id:", body["file"].get("id"))

If the export record could not be saved, the answer still carries a working url, but file has only filename, size_bytes, content_type and source. That is why the sample reads id with .get().

Listing, downloading again and deleting

Files with a record, from a workspace upload or an export, can be managed later.

  • List. GET /files?workspaceId=... returns the workspace's files, newest first. Add desktopId to filter to one computer. Each entry has source, upload or export (List files).
  • Download. GET /files/download?id=... returns a signed URL, not the bytes. The URL works in any HTTP client without an auth header, carries the original file name, and expires one hour after it is issued, so request a new one rather than storing it (Download file).
  • Delete. DELETE /files/delete?id=... removes the file from storage and the workspace for good. Links issued before the delete stop working. A copy already pushed to a computer's desktop stays on that computer (Delete file).

Errors

StatusMessage or codeWhat it meansWhat to do
400"File too large (max 10MB)"A single-step upload was over 10 MBUse the two-step upload
400"destPath requires desktopId"You named a folder but not a computerAdd desktopId
400"Desktop is not running"Export or complete needs a running computerStart the computer, then retry
400"This upload expired." or "Invalid upload token."The upload_token is over an hour old or not validStart the upload again
404"No file at ..."The export path is missing or is a folderCheck the path, or archive the folder first
409"Upload is ... bytes, expected ..."The bytes you PUT don't match size_bytesStart again with the right size
409"Nothing uploaded yet. PUT the file to upload_url first."Complete ran before the PUTPUT the bytes, then complete
409"A folder named ... already exists in ..."The destination has a folder with that nameStart again with another file name
413"File is ... bytes; the limit is 2147483648"The file is over 2 GBSplit or compress it
402COMPUTER_LOCKEDThe computer is locked for capacityFree capacity, then retry
403workspace_read_onlyThe key belongs to a Can chat memberAsk the owner for Full access
403workspace_scope_mismatchA workspace-scoped key named another workspaceUse a key scoped to the right workspace
502"Could not place ..." or "Could not copy ..."The computer didn't finish in time (90 s for large transfers)Retry on a faster link, or compress. A large upload keeps its stored copy, so reuse the token
503"Computer not ready" or "Computer could not be reached."Orgo can't address the computerRetry shortly

Can chat members can't upload, export or delete files through the API. Export, the two-step upload and delete return 403 with workspace_read_only; a single-step POST /files/upload returns 403 with "Access denied".

The CLI and MCP

  • CLI. orgo files has list, upload, download, export and delete. Upload caps at 10 MB and there is no two-step upload command; for larger files use the REST or MCP start and complete calls, or pull the data in from inside the computer (CLI guide).
  • Local MCP server. The file tools are orgo_upload_file, orgo_start_file_upload, orgo_complete_file_upload, orgo_list_files, orgo_export_file, orgo_download_file and orgo_delete_file (MCP guide).
  • Hosted MCP server. An OAuth sign-in can list, export, download and delete files, and do the two-step upload. orgo_upload_file is not offered there, because it reads the file from the machine running the server, and with an API key it is refused. Use the local server for it, or the two-step upload.

For more on connecting an agent to Orgo over MCP, see Orgo MCP for AI agents.

Other details

  • Same name. A workspace upload skips a file whose name already exists in the desktop folder. A folder upload and a completed large upload replace it.
  • Windows. Use Windows paths such as C:\Users\Public for destPath and export paths. A Linux path on a Windows computer returns 400 on export and on the two-step upload. A single-step upload does not check, so always send a Windows path there.
  • Stopped computers. Files on a computer's disk are kept across stop and start (Stop computer). Deleting the computer removes them, so export what you need first. With no plan, an hourly computer stopped because its credit ran out keeps its files for 7 days, then the computer and its files are deleted unless you add credit or choose a plan with room for it (pricing).

Sources