Files
Download file
Get a signed download URL for a file.
GET
/
files
/
download
Download file
curl --request GET \
--url https://www.orgo.ai/api/files/download \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.orgo.ai/api/files/download"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.orgo.ai/api/files/download', 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/download",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.orgo.ai/api/files/download"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.orgo.ai/api/files/download")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.orgo.ai/api/files/download")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"url": "<string>"
}{
"error": "Invalid API key"
}{
"error": "Resource not found"
}Returns a signed download URL for a file.
Query parameters
string
required
File ID.
Response
string
Signed download URL (expires in 1 hour).
Example
curl "https://www.orgo.ai/api/files/download?id=f47ac10b-58cc-4372-a567-0e02b2c3d479" \
-H "Authorization: Bearer $ORGO_API_KEY"
import requests
response = requests.get(
"https://www.orgo.ai/api/files/download",
headers={"Authorization": f"Bearer {api_key}"},
params={"id": file_id}
)
url = response.json()["url"]
# Download the file
file_response = requests.get(url)
with open("downloaded.txt", "wb") as f:
f.write(file_response.content)
const response = await fetch(`https://www.orgo.ai/api/files/download?id=${fileId}`, {
headers: { 'Authorization': `Bearer ${apiKey}` }
});
const { url } = await response.json();
// Download the file
const fileResponse = await fetch(url);
const blob = await fileResponse.blob();
Response
{
"url": "https://storage.example.com/files/..."
}
The returned URL is pre-signed and can be used directly in a browser or with any HTTP client. URLs expire after 1 hour.
⌘I
Download file
curl --request GET \
--url https://www.orgo.ai/api/files/download \
--header 'Authorization: Bearer <token>'import requests
url = "https://www.orgo.ai/api/files/download"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://www.orgo.ai/api/files/download', 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/download",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://www.orgo.ai/api/files/download"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://www.orgo.ai/api/files/download")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.orgo.ai/api/files/download")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"url": "<string>"
}{
"error": "Invalid API key"
}{
"error": "Resource not found"
}