Endpoints
POST /api/v1/upload/contract
Uploads a contract file (PDF/DOC/DOCX) to MinIO. Returns the storage key. Request: multipart/form-data withfile field
Response: { "file_key": "contracts/uuid.pdf", "filename": "Nike_contract.pdf", "size": 24500 }
POST /api/v1/upload/extract
Downloads the file from MinIO, parses it with pdfplumber, and extracts structured deal fields using regex NLP. Query params:file_key, filename
Response:
POST /api/v1/upload/confirm
Creates a NilDeal record from the user-reviewed extraction data. Storesai_extraction_data and ai_confidence_scores as JSONB for audit trail.
GET /api/v1/upload/download
Generates a presigned MinIO URL (1-hour expiry) for downloading a contract file. Query params:key (the file_key from upload)
Response: { "url": "http://localhost:9000/nil-contracts/contracts/...?X-Amz-Signature=...", "filename": "Nike_contract.pdf" }