API
These routes run on the Prepress Buddy server. The upstream FastAPI key never reaches the browser — requests are proxied server-side.
| Method | Path | Description |
|---|---|---|
| POST | /api/upload | Upload a file. Multipart: file, mode (pdf|image), operations (JSON), outscale. |
| GET | /api/jobs/{id} | Job status: status, progress, step, error. |
| GET | /api/jobs/{id}/result | Completed job result JSON (preflight or restoration). |
| GET | /api/jobs/{id}/files/{name} | Download an output file. Whitelisted names only. |
| POST | /api/jobs/{id}/upscale | Second-pass upscale. Body: { factor: 2 | 4 | 8 }. |
| POST | /api/jobs/{id}/restore-faces | Second-pass face restoration. Body: { preset }. |
| GET | /api/jobs/{id}/bundle | All outputs for the job as a ZIP archive. |
| GET | /api/health | Backend and GPU worker status. |
Example — upload and poll
const fd = new FormData();
fd.append('file', file);
fd.append('mode', 'image');
fd.append('operations', JSON.stringify({ upscale: true, sharpen: true }));
fd.append('outscale', '2');
const { job_id } = await fetch('/api/upload', { method: 'POST', body: fd })
.then(r => r.json());
// poll until complete
let state;
do {
await new Promise(r => setTimeout(r, 2000));
state = await fetch(`/api/jobs/${job_id}`).then(r => r.json());
} while (state.status !== 'completed' && state.status !== 'failed');
const result = await fetch(`/api/jobs/${job_id}/result`).then(r => r.json());