Results and downloads
Each completed task lists its results, each with a download link. Fetch the job again whenever you need fresh links.
On this page
GET /v1/jobs/{id} lists the results in each task’s outputs:
| Field | Meaning |
|---|---|
file_id | The result’s ID. |
name | Its file name. |
size | Its size in bytes. |
download_url | A link that downloads it. |
download_expires_at | When the link stops working. |
A download link works for the shorter of 7 days and the time left before the result is deleted. Fetch the job again for fresh links. The link downloads the file under its name and needs no key, so anyone who has it can download the file until it expires: keep links private.
# Each result's download_url is in the job. The link needs no key.
curl https://api.filesokay.com/v1/jobs/job_a1c9531eeb00434aba0058796f1ca517 \
-H "Authorization: Bearer $FILESOKAY_KEY"
curl -o lecture-compressed.mp4 "$DOWNLOAD_URL"import fs from "node:fs";
import { Readable } from "node:stream";
import { pipeline } from "node:stream/promises";
const res = await fetch(
"https://api.filesokay.com/v1/jobs/job_a1c9531eeb00434aba0058796f1ca517",
{ headers: { Authorization: `Bearer ${process.env.FILESOKAY_KEY}` } },
);
const job = await res.json();
for (const task of job.tasks) {
for (const output of task.outputs) {
const file = await fetch(output.download_url);
if (!file.ok) throw new Error(`${output.name}: ${file.status}`);
await pipeline(Readable.fromWeb(file.body), fs.createWriteStream(output.name));
}
}import os
import requests
job = requests.get(
"https://api.filesokay.com/v1/jobs/job_a1c9531eeb00434aba0058796f1ca517",
headers={"Authorization": f"Bearer {os.environ['FILESOKAY_KEY']}"},
).json()
for task in job["tasks"]:
for output in task["outputs"]:
with requests.get(output["download_url"], stream=True) as res:
res.raise_for_status()
with open(output["name"], "wb") as f:
for chunk in res.iter_content(chunk_size=1 << 20):
f.write(chunk)| File | Deleted |
|---|---|
| An upload that is never completed | 7 days after it starts |
| A completed upload that no job uses | 24 hours after it completes, or 3 days for a file of 10 GiB or more |
| A completed task’s input | 60 minutes after the task completes |
| A failed or cancelled task’s input | 24 hours after the task ends |
| A job’s results | 3 days after they’re ready; 7 days when the task’s input is over 5 GiB, and 10 days over 20 GiB |
Each file’s delete_at shows when it will be deleted.
DELETE /v1/jobs/{id}/files deletes an ended job’s inputs and results now. The job and its record of credits stay. A running job’s files can’t be deleted: cancel it first.
curl -X DELETE https://api.filesokay.com/v1/jobs/job_a1c9531eeb00434aba0058796f1ca517/files \
-H "Authorization: Bearer $FILESOKAY_KEY"const res = await fetch("https://api.filesokay.com/v1/jobs/job_a1c9531eeb00434aba0058796f1ca517/files", {
method: "DELETE",
headers: {
Authorization: `Bearer ${process.env.FILESOKAY_KEY}`,
},
});
console.log(res.status);import os
import requests
res = requests.delete(
"https://api.filesokay.com/v1/jobs/job_a1c9531eeb00434aba0058796f1ca517/files",
headers={
"Authorization": f"Bearer {os.environ['FILESOKAY_KEY']}",
},
)
print(res.status_code)DELETE /v1/files/{id} deletes one uploaded file now. Both are final.