Files
Export file
Export a file from a computer to cloud storage.
POST
/
files
/
export
Export file
curl --request POST \
--url https://www.orgo.ai/api/files/export \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"desktopId": "a3bb189e-8bf9-3888-9912-ace4e6543002",
"path": "Desktop/results.txt"
}
'import requests
url = "https://www.orgo.ai/api/files/export"
payload = {
"desktopId": "a3bb189e-8bf9-3888-9912-ace4e6543002",
"path": "Desktop/results.txt"
}
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', path: 'Desktop/results.txt'})
};
fetch('https://www.orgo.ai/api/files/export', 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/export",
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',
'path' => 'Desktop/results.txt'
]),
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/export"
payload := strings.NewReader("{\n \"desktopId\": \"a3bb189e-8bf9-3888-9912-ace4e6543002\",\n \"path\": \"Desktop/results.txt\"\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/export")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"desktopId\": \"a3bb189e-8bf9-3888-9912-ace4e6543002\",\n \"path\": \"Desktop/results.txt\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.orgo.ai/api/files/export")
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 \"path\": \"Desktop/results.txt\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"file": {
"id": "<string>",
"filename": "<string>",
"size_bytes": 123,
"content_type": "<string>",
"created_at": "2023-11-07T05:31:56Z"
},
"url": "<string>"
}{
"error": "<string>"
}{
"error": "Invalid API key"
}{
"error": "Resource not found"
}Exports a file from a computer’s filesystem and returns a download URL.
The computer must be running to export files.
Request
string
required
Computer ID to export from.
string
required
Path to the file on the computer.
Path formats
| Format | Example |
|---|---|
| Relative to home | Desktop/results.txt |
| Absolute path | /home/user/Desktop/results.txt |
| With tilde | ~/Desktop/results.txt |
Response
boolean
true if export succeeded.object
The exported file object.
string
Signed download URL (expires in 1 hour).
Example
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"
}'
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']}")
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}`);
Response
{
"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/..."
}
Files can only be exported from within
/home/user. Paths outside this directory return a 403 error.Authorizations
API key authentication. Get your key at orgo.ai/workspaces
Body
application/json
⌘I
Export file
curl --request POST \
--url https://www.orgo.ai/api/files/export \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"desktopId": "a3bb189e-8bf9-3888-9912-ace4e6543002",
"path": "Desktop/results.txt"
}
'import requests
url = "https://www.orgo.ai/api/files/export"
payload = {
"desktopId": "a3bb189e-8bf9-3888-9912-ace4e6543002",
"path": "Desktop/results.txt"
}
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', path: 'Desktop/results.txt'})
};
fetch('https://www.orgo.ai/api/files/export', 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/export",
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',
'path' => 'Desktop/results.txt'
]),
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/export"
payload := strings.NewReader("{\n \"desktopId\": \"a3bb189e-8bf9-3888-9912-ace4e6543002\",\n \"path\": \"Desktop/results.txt\"\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/export")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"desktopId\": \"a3bb189e-8bf9-3888-9912-ace4e6543002\",\n \"path\": \"Desktop/results.txt\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.orgo.ai/api/files/export")
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 \"path\": \"Desktop/results.txt\"\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"file": {
"id": "<string>",
"filename": "<string>",
"size_bytes": 123,
"content_type": "<string>",
"created_at": "2023-11-07T05:31:56Z"
},
"url": "<string>"
}{
"error": "<string>"
}{
"error": "Invalid API key"
}{
"error": "Resource not found"
}