API & workflow documentation
The MetrikData web app talks to a small set of HTTP endpoints to take a statement PDF from upload through to a saved underwriting report. This page documents those endpoints and the order in which they’re called.
These endpoints are session-authenticated, not a public API. Every endpoint below requires a valid MetrikData web session (a Supabase auth cookie set when you sign in) and resolves your active workspace from that session. There is no API-key access today — the Cookie header in the examples stands in for that session cookie. Each endpoint also enforces a minimum workspace role: viewer for reads, analyst for uploads and analysis.
Typical flow
Four calls take a raw PDF to a saved, exportable report. Each step links to its endpoint detail in the tabs above.
Send a PDF to POST /api/uploads and receive a caseId and uploadId for the new job.
Trigger parsing with POST /api/uploads/[uploadId]/process if needed, then poll GET /api/uploads/[uploadId]/status until parsing is ready.
Run the underwriting engine over the parsed data with POST /api/analyze. This consumes one statement from your allowance.
Read the saved report via GET /api/cases/[caseId]/report, then export through the CSV endpoints.
X-Request-Id header for support and log correlation. Error responses use the shape { error, details? } with an appropriate HTTP status.