Endpoint
Download a file
GET
/v1/files/{id}/contentAnswers 302 to a single-use URL valid for 5 minutes. Follow the redirect without the Authorization header.
- Scope a restricted key needs
files:read- Publishable key
- Not allowed: secret or restricted key only
- Idempotency-Key
- Not used. A GET is already safe to repeat.
Parameters
| Parameter | Type and place | Meaning |
|---|---|---|
idrequired | stringpath | The id of the file. |
Orrerie-Version | stringheader | API version date. Default: the version the key was created with. Example 2026-10-11. |
Example request
curl
curl --fail-with-body -L -o downloaded-file https://api.orrerie.com/v1/files/file_xn5cz8fk5zmyx3kp37rvddgs/content \
-H "Authorization: Bearer $ORRERIE_SECRET_KEY"JavaScript
import { writeFile } from "node:fs/promises";
const response = await fetch("https://api.orrerie.com/v1/files/file_xn5cz8fk5zmyx3kp37rvddgs/content", {
headers: {
Authorization: `Bearer ${process.env.ORRERIE_SECRET_KEY}`,
},
});
if (!response.ok) {
const result = await response.json();
throw new Error(`${result.error.code}: ${result.error.message}`);
}
await writeFile("downloaded-file", Buffer.from(await response.arrayBuffer()));Python
import os
import requests
response = requests.get(
"https://api.orrerie.com/v1/files/file_xn5cz8fk5zmyx3kp37rvddgs/content",
headers={"Authorization": f"Bearer {os.environ['ORRERIE_SECRET_KEY']}"},
timeout=30,
)
if not response.ok:
result = response.json()
raise RuntimeError(f"{result['error']['code']}: {result['error']['message']}")
with open("downloaded-file", "wb") as saved:
saved.write(response.content)PHP
<?php
$request = curl_init('https://api.orrerie.com/v1/files/file_xn5cz8fk5zmyx3kp37rvddgs/content');
curl_setopt_array($request, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('ORRERIE_SECRET_KEY'),
],
]);
$body = curl_exec($request);
if ($body === false) {
throw new RuntimeException(curl_error($request));
}
if (curl_getinfo($request, CURLINFO_HTTP_CODE) >= 400) {
$result = json_decode($body, true);
throw new RuntimeException($result['error']['code'] . ': ' . $result['error']['message']);
}
file_put_contents('downloaded-file', $body);Responses
302 Found
The answer is a redirect to the file. Follow the Location header. Headers: Location.
Any other status: an error
A status of 400 or above answers with the error object. Branch on its code, never on its message.
Errors
This call has no error of its own. It answers with the errors every call can answer with: a bad key, a missing scope, an object that does not exist, the rate limit. Every error code has its own entry.