API Endpoints Overview
This document provides a clear overview of the two distinct API products and their endpoints.
🏢 RLS API (Renovation Lending Software)
Base Path: /api/rls/*
Authentication: API Key (Header: X-API-Key)
Target Audience: Construction lending institutions, mortgage companies
Specialization: SOR and Insurance Certificate processing
Endpoints
1. Document Extraction
- POST
/api/rls/extract- Submit SOR or Insurance Certificate for extraction
- Supports PDF (50MB), JPEG/PNG (10MB)
- Optional webhook notifications
- Returns job ID for polling
2. Job Status
- GET
/api/rls/extract/{jobId}- Check extraction status and results
- Includes RLS-specific analysis for SOR and Insurance docs
- Compliance status indicators
3. API Information
- GET
/api/rls/extract- Returns API capabilities and supported document types
- Lists RLS-specific extraction features
Key Features
- Specialized extraction for construction lending documents
- ACORD form processing for insurance certificates
- Cost breakdown analysis for SOR documents
- Compliance validation
- Webhook support with retry logic
Document Types
SOR (Statement of Repairs)
- Consultant details
- Property information
- Repair sections with itemized costs
- Total project costs with contingency
Insurance Certificates
- Policy numbers and coverage amounts
- Effective/expiration dates
- Named insureds and certificate holders
- ACORD form compliance
👥 B2C API (Consumer Document Extraction)
Base Path: /api/b2c/*
Authentication: Session-based (Supabase Auth)
Target Audience: Individual consumers, small businesses
Specialization: Custom template-based extraction
Endpoints
1. Document Extraction
- POST
/api/b2c/extract- Submit document with custom template ID
- Supports PDF (20MB), JPEG/PNG (5MB)
- Optional webhook notifications
- Returns extraction ID for polling
2. Extraction Status
- GET
/api/b2c/extract/{extractionId}- Check extraction status and results
- Returns extracted data based on template fields
- Includes confidence scores
3. Templates
- GET
/api/b2c/templates- List available templates for organization
- Shows field definitions and document types
4. API Information
- GET
/api/b2c/extract- Returns API capabilities and limits
- Lists available endpoints
Key Features
- Custom template creation
- Multi-field extraction
- User-defined document types
- Template library management
- Real-time status polling
Template System
- Users create templates for any document type
- Define custom fields with names, types, and descriptions
- Reusable for similar documents
- Organization-level template sharing
🔄 Migration Guide
If you're currently using the old /api/documents/extract endpoint:
For RLS Customers
- Update your base URL to use
/api/rls/extract - The request format remains the same
- Response includes additional RLS-specific fields
- API key authentication unchanged
For B2C Users
- Use the web interface for template-based extraction
- API access available at
/api/b2c/extract - Requires template ID (create via web UI)
- Session-based authentication required
📊 Comparison Table
| Feature | RLS API | B2C API |
|---|---|---|
| Authentication | API Key | Session/Cookie |
| Document Types | SOR, Insurance Cert | Any (custom templates) |
| Max File Size | PDF: 50MB, Image: 10MB | PDF: 20MB, Image: 5MB |
| Extraction Type | Specialized/Fixed | Template-based/Custom |
| Webhook Support | ✅ | ✅ |
| Batch Processing | ✅ | ❌ |
| Compliance Features | ✅ | ❌ |
| Custom Fields | ❌ | ✅ |
| Rate Limiting | Based on plan | Based on subscription |
🚀 Quick Start
RLS API
curl -X POST https://api.example.com/api/rls/extract \
-H "X-API-Key: dk_live_your_api_key" \
-F "file=@statement_of_repairs.pdf" \
-F "webhookUrl=https://your-webhook.com/notify"
B2C API
# First, authenticate via web UI, then:
curl -X POST https://api.example.com/api/b2c/extract \
-H "Cookie: your-session-cookie" \
-F "file=@invoice.pdf" \
-F "templateId=550e8400-e29b-41d4-a716-446655440000"
📚 Full Documentation
- RLS API: See
docs/api-swagger-rls.yaml - B2C API: See
docs/api-swagger-b2c.yaml - Postman Collection:
docs/document-extraction-api.postman_collection.json