welcometoFightclub's picture
Upload 48 files
a263bf4 verified
Raw History Blame Contribute Delete
2.47 kB
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>API contract | PDF Extractor Docs</title><link rel="stylesheet" href="guide.css"></head><body><a class="skip-link" href="#content">Skip to content</a><header class="topbar"><a class="brand" href="index.html">PDF Extractor <span>Docs</span></a><button class="menu-button" type="button" aria-expanded="false" aria-controls="navigation">Menu</button><button class="theme-button" type="button">Theme</button></header><div class="layout"><nav id="navigation" class="navigation" aria-label="Documentation"><a href="index.html">Overview</a><a href="architecture.html">Architecture</a><a href="low-level-design.html">Low-level design</a><a href="dependencies.html">External dependencies</a><a href="api.html">API contract</a><a href="operations.html">Operations and limits</a><a href="setup.html">Local setup</a></nav><main id="content"><p class="eyebrow">Public interface</p><h1>API contract</h1><section><h2>Upload a document</h2><p><code>POST /api/v1/documents</code></p><p>Send a multipart form with one field named <code>file</code>. The field must contain a PDF.</p><pre><code>{<br> "job_id": "a UUID value",<br> "status": "PROCESSING"<br>}</code></pre><p>The server returns HTTP <code>202 Accepted</code>.</p></section><section><h2>Read job status</h2><p><code>GET /api/v1/jobs/{job_id}</code></p><pre><code>{<br> "job_id": "a UUID value",<br> "filename": "invoice.pdf",<br> "status": "PROCESSING",<br> "result_available": false,<br> "error": null<br>}</code></pre><p>Possible status values are <code>PENDING</code>, <code>PROCESSING</code>, <code>COMPLETED</code>, <code>FAILED</code>, and <code>CANCELLED</code>.</p></section><section><h2>Read the result</h2><p><code>GET /api/v1/jobs/{job_id}/result</code></p><pre><code>{<br> "job_id": "a UUID value",<br> "status": "COMPLETED",<br> "data": {},<br> "metadata": {}<br>}</code></pre><p>The server returns HTTP <code>409 Conflict</code> when extraction is not complete.</p></section><section><h2>Error response</h2><pre><code>{<br> "error": {<br> "code": "INVALID_PDF",<br> "message": "Upload a PDF file."<br> }<br>}</code></pre><p>Common error codes are <code>INVALID_PDF</code>, <code>JOB_NOT_FOUND</code>, <code>RESULT_NOT_AVAILABLE</code>, and <code>EXTRACTION_SUBMISSION_FAILED</code>.</p></section></main></div><script src="guide.js"></script></body></html>