Files
Complete large upload
Place a file uploaded with Start large upload on the computer.
POST
/
files
/
uploads
/
complete
Complete file upload
curl --request POST \
--url https://www.orgo.ai/api/files/uploads/complete \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"desktopId": "a3bb189e-8bf9-3888-9912-ace4e6543002",
"upload_token": "eyJ1Ijoi…"
}
'import requests
url = "https://www.orgo.ai/api/files/uploads/complete"
payload = {
"desktopId": "a3bb189e-8bf9-3888-9912-ace4e6543002",
"upload_token": "eyJ1Ijoi…"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({desktopId: 'a3bb189e-8bf9-3888-9912-ace4e6543002', upload_token: 'eyJ1Ijoi…'})
};
fetch('https://www.orgo.ai/api/files/uploads/complete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.orgo.ai/api/files/uploads/complete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'desktopId' => 'a3bb189e-8bf9-3888-9912-ace4e6543002',
'upload_token' => 'eyJ1Ijoi…'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.orgo.ai/api/files/uploads/complete"
payload := strings.NewReader("{\n \"desktopId\": \"a3bb189e-8bf9-3888-9912-ace4e6543002\",\n \"upload_token\": \"eyJ1Ijoi…\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.orgo.ai/api/files/uploads/complete")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"desktopId\": \"a3bb189e-8bf9-3888-9912-ace4e6543002\",\n \"upload_token\": \"eyJ1Ijoi…\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.orgo.ai/api/files/uploads/complete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"desktopId\": \"a3bb189e-8bf9-3888-9912-ace4e6543002\",\n \"upload_token\": \"eyJ1Ijoi…\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"filename": "data.csv",
"placedIn": "/root/Desktop",
"size_bytes": 52428800
}Step two of the two-step upload. Call it after the file’s bytes are PUT to the
upload_url from Start large upload. The computer pulls the file into the folder you asked for, replacing a file of the same name, and the temporary copy in storage is deleted.
The computer must be running. If placing the file fails, the stored copy is kept, so you can call this again with the same upload_token until it expires (one hour after the upload started).
Request
Send a JSON body.string
required
The same computer ID you passed to Start large upload.
string
required
The
upload_token from Start large upload.Response
boolean
true when the file was placed on the computer.string
The file’s name on the computer.
string
The folder the file was placed in: your
destPath, or the desktop when you sent none or desktop. The file name is not appended.integer
The file’s size in bytes.
Example
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\": \"$UPLOAD_TOKEN\"}"
import os
import requests
response = requests.post(
"https://www.orgo.ai/api/files/uploads/complete",
headers={"Authorization": f"Bearer {os.environ['ORGO_API_KEY']}"},
json={
"desktopId": os.environ["COMPUTER_ID"],
"upload_token": os.environ["UPLOAD_TOKEN"],
},
)
print(response.json())
const response = await fetch('https://www.orgo.ai/api/files/uploads/complete', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ORGO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
desktopId: process.env.COMPUTER_ID,
upload_token: process.env.UPLOAD_TOKEN,
}),
});
console.log(await response.json());
Response
{
"ok": true,
"filename": "dataset.zip",
"placedIn": "/root/Documents",
"size_bytes": 52428800
}
Errors
Every error carries the shape{"error": "<message>"}. The scope-mismatch 403 adds code, key_workspace_id, and target_workspace_id. The checks below run in order.
| Status | Body | Cause |
|---|---|---|
401 | {"error": "Invalid API key"} | The Bearer token starts with sk_ but is not a known Orgo key. |
401 | {"error": "Authentication required"} | No Authorization header, or a Bearer token that is not an sk_ key. |
400 | {"error": "Invalid upload token. Start the upload again."} | upload_token was absent, malformed or altered. |
400 | {"error": "This upload expired. Start it again."} | More than an hour passed since the upload started. |
403 | {"error": "This upload belongs to another computer or user."} | desktopId or the caller differs from the ones the upload started with. |
404 | {"error": "Desktop not found"} | No computer has that ID. |
403 | {"error": "Access denied"} | The caller no longer belongs to the computer’s workspace, or has view-only access to it. |
402 | {"error": "Choose a plan to continue."} | The computer is a free trial computer that can no longer run. |
402 | {"error": "Manage this computer’s payment in Account → Usage."} | The computer is paid for by its own subscription or dedicated purchase, and that payment has lapsed. |
403 | {"error": "…", "code": "workspace_scope_mismatch", "key_workspace_id": "…", "target_workspace_id": "…"} | A workspace-scoped key named a computer in a different workspace. |
403 | {"error": "This computer moved to another workspace. Start the upload again."} | The computer moved to another workspace after the upload started. |
503 | {"error": "File storage did not answer. Retry shortly."} | Storage could not be checked. Retry with the same token. |
409 | {"error": "Nothing uploaded yet. PUT the file to upload_url first. If you already finished, it is in place."} | No bytes are stored for this upload: they were never PUT, or an earlier call already placed the file. |
409 | {"error": "Upload is 1024 bytes, expected 52428800."} | The stored size differs from size_bytes. |
400 | {"error": "Desktop is not running. Start it, then finish the upload."} | The computer’s status is anything other than running. The stored copy is kept. |
503 | {"error": "Computer not ready"} | The computer has no connection details recorded, so it cannot be addressed. |
409 | {"error": "A folder named dataset.zip already exists in /root/Documents. Start the upload again with another name."} | A folder in the destination has the file’s name. |
502 | {"error": "Could not place dataset.zip in /root/Documents. Try again."} | The computer could not be reached, or did not confirm it had written the file within about 90 seconds. The stored copy is kept, so retry with the same token. |
500 | {"error": "Could not finish the upload"} | Unexpected failure. |
Authorizations
API key authentication. Get your key at orgo.ai/workspaces
Body
application/json
⌘I
Complete file upload
curl --request POST \
--url https://www.orgo.ai/api/files/uploads/complete \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"desktopId": "a3bb189e-8bf9-3888-9912-ace4e6543002",
"upload_token": "eyJ1Ijoi…"
}
'import requests
url = "https://www.orgo.ai/api/files/uploads/complete"
payload = {
"desktopId": "a3bb189e-8bf9-3888-9912-ace4e6543002",
"upload_token": "eyJ1Ijoi…"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({desktopId: 'a3bb189e-8bf9-3888-9912-ace4e6543002', upload_token: 'eyJ1Ijoi…'})
};
fetch('https://www.orgo.ai/api/files/uploads/complete', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.orgo.ai/api/files/uploads/complete",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'desktopId' => 'a3bb189e-8bf9-3888-9912-ace4e6543002',
'upload_token' => 'eyJ1Ijoi…'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.orgo.ai/api/files/uploads/complete"
payload := strings.NewReader("{\n \"desktopId\": \"a3bb189e-8bf9-3888-9912-ace4e6543002\",\n \"upload_token\": \"eyJ1Ijoi…\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.orgo.ai/api/files/uploads/complete")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"desktopId\": \"a3bb189e-8bf9-3888-9912-ace4e6543002\",\n \"upload_token\": \"eyJ1Ijoi…\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.orgo.ai/api/files/uploads/complete")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"desktopId\": \"a3bb189e-8bf9-3888-9912-ace4e6543002\",\n \"upload_token\": \"eyJ1Ijoi…\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"filename": "data.csv",
"placedIn": "/root/Desktop",
"size_bytes": 52428800
}